From 26ac981bffc1261f9d5e7a298de73c3cd45ab0d7 Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Wed, 15 Jul 2020 01:22:52 -0700 Subject: [PATCH] [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 --- packaging/wrtjs.spec | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) 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 -- 2.7.4