From: Youngsoo Choi Date: Wed, 15 Jul 2020 08:22:52 +0000 (-0700) Subject: [UWE] Notify internal API compatibility when installing rpm X-Git-Tag: accepted/tizen/unified/20200826.133035~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F98%2F238898%2F8;p=platform%2Fframework%2Fweb%2Fwrtjs.git [UWE] Notify internal API compatibility when installing rpm Previously, the second and third versions haven't been used. So, this removes the unused versions except for the wrtjs version and newly adds {TPK_VERSION} and {INTERNAL_API_REVISION} like below: {TPK_VERSION}.{INTERNAL_API_REVISION}.{WRTJS_VERSION} The {TPK_VERSION} needs for deploying tpk file via app server. The {INTERNAL_API_REVISION} needs to check API compatibility between chromium-efl and wrtjs. In addition, this notifies internal API version compatibility result using the {INTERNAL_API_REVISION} when installing rpm file. The internal API compatibility can be guaranteed only if the {INTERNAL_API_REVISION} is same with chromium-efl. '\033[32m' means green, '\033[31m' means red color, and '\033[m' means end of the colors in the %pre script. Change-Id: Ib00f4bf3523e9e022c388b838e8d96cc7089d599 Signed-off-by: Youngsoo Choi --- diff --git a/packaging/wrtjs.spec b/packaging/wrtjs.spec index 0659467..d97c6c3 100755 --- a/packaging/wrtjs.spec +++ b/packaging/wrtjs.spec @@ -1,6 +1,8 @@ Name: wrtjs Summary: Javascript based Runtime for Tizen -Version: 1.0.0 +# Version: {TPK_VERSION}.{INTERNAL_API_REVISION}.{WRTJS_VERSION} +# The {INTERNAL_API_REVISION} is used to check compatibility with chromium-efl. +Version: 1.0.1 Release: 1 Group: Web Framework/Web Runtime License: Apache-2.0 @@ -157,6 +159,42 @@ cp -r %{app_dir}/* %{buildroot}%{_resourcedir}/ echo "No TPK generation" %endif +%pre +if (( $(rpm -qa | grep 'chromium-efl-[[:digit:]]' | wc -l) > 1 )); then + echo -e "\033[31m*****************************************************" + echo -e "Please remove chromium-efl rpm(s) except for one:\n" + rpm -qa | grep 'chromium-efl-[[:digit:]]' + echo -e "*****************************************************\033[m" + exit 1 +fi + +export CHROMIUM_REVISION=$(rpm -qa | grep chromium-efl | awk -F. '{print $2}') +export WRTJS_REVISION=$(echo %{version} | awk -F. '{print $2}') +if [[ "${CHROMIUM_REVISION}" == "" ]]; then + CHROMIUM_REVISION="not installed" +fi + +echo -e "\033[32m*****************************************************" +echo -e "* chromium-efl revision : ${CHROMIUM_REVISION}" +echo -e "* wrtjs revision : ${WRTJS_REVISION}" +echo -e "*" +if [[ "${CHROMIUM_REVISION}" == "not installed" ]] || \ + (( ${CHROMIUM_REVISION} == ${WRTJS_REVISION} )); then + echo -e "* Succeeded to check rpm versions" + echo -e "*****************************************************\033[m" +else + if (( ${CHROMIUM_REVISION} > ${WRTJS_REVISION} )); then + echo -e "\033[31m* You're trying to install too old wrtjs." + echo -e "* Please install wrtjs as revision $CHROMIUM_REVISION" + echo -e "* or" + else + echo -e "\033[31m* You have too old chromium-efl." + fi + echo -e "* please re-install chromium-efl as revision $WRTJS_REVISION first." + echo -e "*****************************************************\033[m" + exit 1 +fi + %post %postun