From: Youngsoo Choi Date: Wed, 2 Sep 2020 12:04:32 +0000 (-0700) Subject: [D2D] Support wgt-in-rpm for d2d server X-Git-Tag: submit/tizen/20200903.112022^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0be80ca6c5379a92a9020becdbb9ada7978de655;p=platform%2Fframework%2Fweb%2Fwrtjs.git [D2D] Support wgt-in-rpm for d2d server This supports signing, packaging and installing for d2d server. After installing the d2d server, the wgt file is deleted to save ROM size. Currently, d2d sever is enabled by default for public profile since it is public feature. If you want to use d2d server feature for the other profiles, please use d2d option like below: $ ./tizen/build/build_tv.sh --d2d Change-Id: Ief216021799723782a5777aba9c19b940f6c2cb8 Signed-off-by: Youngsoo Choi --- diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 60d32901..6eb01154 100755 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -11,6 +11,10 @@ Source: %{name}-%{version}.tar.gz %define app_dir out/gen/app %define crosswalk_extensions_service tizen-extensions-crosswalk-service +# The d2d is public feature +%if "%{?tizen_profile_name}" != "tv" && "%{?profile}" != "wearable" && "%{?_with_da_profile}" != "1" + %define _use_d2d 1 +%endif BuildRequires: pkgconfig(chromium-efl) @@ -19,7 +23,7 @@ BuildRequires: ninja BuildRequires: pkgconfig(dlog) %endif -%if 0%{?_use_tpk} +%if 0%{?_use_tpk} || 0%{?_use_d2d} %if "%{?profile}" == "tv" BuildRequires: app-signer %endif @@ -32,6 +36,7 @@ Web Runtime Engine based on Electron %define _tizen_version %{tizen_version_major}%{tizen_version_minor} %define _pkgid org.tizen.%{name} +%define __pkgid %{_pkgid} %if 0%{?_use_tpk} # The tv profile has a different tpk generation policy. # 2 types(update, upgrade) of tpk can be generated and used simultaneously. @@ -39,18 +44,14 @@ Web Runtime Engine based on Electron # is generated by default. %if "%{?profile}" == "tv" %if "%{?tpktype}" == "upgrade" || (0%{!?tpktype:1} && %{_tizen_version} < 60) - %define _tpkid %{_pkgid}-upgrade + %define __pkgid %{_pkgid}-upgrade %endif %endif - %if 0%{!?_tpkid:1} - %define _tpkid %{_pkgid} - %endif - - # WRTjs TPK install directory - %global WRTJS_TPK_DIR /tmp - # Directory for WRTjs tizen application package - %global WRTJS_APP_DIR %{TZ_SYS_RO_APP}/%{_tpkid} %endif +# Generated app directory +%global GENERATED_APP_DIR /tmp/%{name} +# Directory for WRTjs tizen application package +%global WRTJS_APP_DIR %{TZ_SYS_RO_APP}/%{__pkgid} %prep %setup -q @@ -91,7 +92,7 @@ absolute_appdir=$PWD/%{app_dir} %endif sed -e 's#@TIZEN_VERSION@#%{tizen_version_major}.%{tizen_version_minor}#g' \ -e 's#@WRTJS_VERSION@#%{version}#g' \ - -e 's#@PACKAGE_ID@#%{_tpkid}#g' \ + -e 's#@PACKAGE_ID@#%{__pkgid}#g' \ packaging/%{_manifestname}.xml.in \ > packaging/tizen-manifest-tpk.xml %endif @@ -109,21 +110,25 @@ absolute_appdir=$PWD/%{app_dir} %ifarch x86_64 %define ARCHITECTURE x86_64 %endif + %define _resourcedir /usr/share/wrt/app +install -d %{GENERATED_APP_DIR} install -d %{buildroot}%{_bindir} install -d %{buildroot}%{_datadir}/aul install -d %{buildroot}%{_resourcedir} install -d %{buildroot}%{WRTJS_APP_DIR} -%if 0%{?__package_signing} - install -m 0644 tizen/downloadable/vd_sign/author-signature.xml %{buildroot}%{WRTJS_APP_DIR} - install -m 0644 tizen/downloadable/vd_sign/signature1.xml %{buildroot}%{WRTJS_APP_DIR} -%else - %define tizen_sign 1 - %define tizen_sign_base %{WRTJS_APP_DIR} - %define tizen_sign_level platform - %define tizen_author_sign 1 - %define tizen_dist_sign 1 +%if 0%{?_use_tpk} + %if 0%{?__package_signing} + install -m 0644 tizen/downloadable/vd_sign/author-signature.xml %{buildroot}%{WRTJS_APP_DIR} + install -m 0644 tizen/downloadable/vd_sign/signature1.xml %{buildroot}%{WRTJS_APP_DIR} + %else + %define tizen_sign 1 + %define tizen_sign_base %{WRTJS_APP_DIR} + %define tizen_sign_level platform + %define tizen_author_sign 1 + %define tizen_dist_sign 1 + %endif %endif %if "%{?profile}" == "tv" @@ -149,9 +154,9 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ # The debugsources.list is needed by __spec_install_post to generate tpk file # but it's missing in the build process. So, the temporary file is touched. touch debugsources.list - %define _tpk_file_name %{_tpkid}-%{version}-v%{tizen_version_major}.%{tizen_version_minor}.%{repo_name}.%{ARCHITECTURE} + %define _tpk_file_name %{__pkgid}-%{version}-v%{tizen_version_major}.%{tizen_version_minor}.%{repo_name}.%{ARCHITECTURE}.tpk %define __tpk_install_post \ - tizen/build/build_tpk.sh %{buildroot}%{WRTJS_APP_DIR} %{WRTJS_TPK_DIR} %{_tpk_file_name} %{_tpkid} %{?profile} + tizen/build/build_app.sh %{GENERATED_APP_DIR} wrtjs_tpk_root %{_tpk_file_name} tpk %{?profile} %define __spec_install_post \ %{?__tpk_install_post} \ %{nil} @@ -159,6 +164,12 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ echo "No TPK generation" %endif +%if 0%{?_use_d2d} + %define _d2d_file_name GlobalDeviceWebServer.wgt + tizen/build/build_app.sh %{GENERATED_APP_DIR} d2d_wgt_root %{_d2d_file_name} wgt %{?profile} + mv %{GENERATED_APP_DIR}/%{_d2d_file_name} %{buildroot}%{WRTJS_APP_DIR} +%endif + %pre if (( $(rpm -q chromium-efl | wc -l) > 1 )); then echo -e "\033[31m*****************************************************" @@ -196,8 +207,20 @@ else fi %post +%if 0%{?_use_d2d} + echo "* Install D2D Server..." + pkgcmd -i -p %{WRTJS_APP_DIR}/%{_d2d_file_name} + rm -f %{WRTJS_APP_DIR}/%{_d2d_file_name} +%endif %postun +%if 0%{?_use_d2d} + %define _d2d_pkgid 9z6IujVul3 + if [[ "$(app_launcher -l | grep %{_d2d_pkgid})" != "" ]]; then + echo "* Uninstall D2D Server..." + pkgcmd -u -n %{_d2d_pkgid} + fi +%endif %clean rm -fr %{buildroot} @@ -205,6 +228,9 @@ rm -fr %{buildroot} %files %manifest packaging/wrtjs.manifest %license LICENSE +%if 0%{?_use_d2d} + %{WRTJS_APP_DIR}/%{_d2d_file_name} +%endif %if "%{?tizen_profile_name}" != "tv" %caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/wrt-loader %else diff --git a/tizen/build/build_app.sh b/tizen/build/build_app.sh new file mode 100755 index 00000000..d004068e --- /dev/null +++ b/tizen/build/build_app.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +output_path=${1} +source_dir_name=${2} +source_path=${output_path}/${source_dir_name} +file_name=${3} +file_extension=${4} +profile=${5} + +echo "Start $0..." +echo "ARGS=$@" +echo "PWD=$PWD" +echo "output_path=$output_path" +echo "source_path=$source_path" +echo "file_name=$file_name" +echo "profile=$profile" + +if [ "${file_extension}" == "tpk" ]; then + # Upgradable WRTjs + rm -rf ${source_path} + install -d ${source_path}/shared/res/wrt + install -d ${source_path}/license + install -m 0644 packaging/tizen-manifest-tpk.xml ${source_path}/tizen-manifest.xml + install -m 0644 LICENSE ${source_path}/license + cp -rf out/gen/app ${source_path}/shared/res/wrt/app +elif [ "${file_extension}" == "wgt" ]; then + # D2D Server + cp -rf d2d_app ${source_path} + rm -rf ${source_path}/.project ${source_path}/.tproject +else + echo "Please add proper file extension." + exit 1 +fi + +# Test signing +/usr/bin/hash-signer.sh -a -d -p platform -b ${output_path} ${source_dir_name} + +pushd ${source_path} +echo "* zip" +zip -yr $file_name * +mv $file_name ../ +popd + +# tpkresigning from app-signer package +if [ "${profile}" == "tv" ]; then + tpkresigner -a -d -p platform -n %{4} ${output_path}/${file_name} +fi +ls ${output_path} +rm -rf ${source_path} + +echo "Finished $0" diff --git a/tizen/build/build_tpk.sh b/tizen/build/build_tpk.sh deleted file mode 100755 index e38318e9..00000000 --- a/tizen/build/build_tpk.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/bash - -ro_app_root=$1 -output_dir=$2 -tpk_root=${output_dir}/tpk_root -tpk_fname=${3}.tpk -tpk_id=$4 -profile=$5 - -echo "Start $0..." -echo "ARGS=$@" -echo "PWD=$PWD" -echo "ro_app_root=$ro_app_root" -echo "tpk_root=$tpk_root" -echo "tpk_fname=$tpk_fname" -echo "tpk_id=$tpk_id" -echo "profile=$profile" -echo "output_dir=$output_dir" - -ls ${output_dir} -rm -rf ${tpk_root} -install -d ${tpk_root}/shared/res/wrt -install -d ${tpk_root}/license -install -m 0644 packaging/tizen-manifest-tpk.xml ${tpk_root}/tizen-manifest.xml -install -m 0644 LICENSE ${tpk_root}/license -cp -rf out/gen/app ${tpk_root}/shared/res/wrt/app - -# Test signing -/usr/bin/hash-signer.sh -a -d -p platform -b ${output_dir} tpk_root - -echo "* ls" -ls -alR ${tpk_root} -pushd ${tpk_root} -echo "* zip" -zip -yr $tpk_fname * -mv $tpk_fname ../ -popd - -# tpkresigning from app-signer package -if [ "${profile}" == "tv" ]; then - tpkresigner -a -d -p platform -n %{4} ${output_dir}/${tpk_fname} -fi - -echo "Finished $0" diff --git a/tizen/build/common.sh b/tizen/build/common.sh index a92886b9..98325fe0 100755 --- a/tizen/build/common.sh +++ b/tizen/build/common.sh @@ -24,10 +24,12 @@ function setupAndExecuteTargetBuild() { local platform="$1" shift - local PROFILE local ARCHITECTURE local CONF_FLAG local LOCAL_BUILD=1 + local PROFILE + local USE_D2D + local USE_TPK local -a ARGS # "|| :" means "or always succeeding built-in command" @@ -37,6 +39,9 @@ function setupAndExecuteTargetBuild() { while [[ $# > 0 ]]; do case "$1" in + --d2d) + USE_D2D=1 + ;; --standard*) PROFILE=tz_$(echo $1 | sed 's/--//g') ;; @@ -65,6 +70,9 @@ function setupAndExecuteTargetBuild() { if [ "$LOCAL_BUILD" == "1" ]; then ARGS+=(--define "_local_build 1") fi + if [ "$USE_D2D" == "1" ]; then + ARGS+=(--define "_use_d2d 1") + fi if [ "$USE_TPK" == "1" ]; then ARGS+=(--define "_use_tpk 1") if [ "$USE_TPK_UPGRADE" == "1" ] && [ $platform == "tv" ]; then