Fix and enhance packaging and post scripts 12/180912/2 accepted/tizen_5.0_unified tizen_5.0 accepted/tizen/5.0/unified/20181102.020201 accepted/tizen/unified/20180629.154209 submit/tizen/20180629.060528 submit/tizen_5.0/20181101.000003
authorAnastasia Lyupa <a.lyupa@samsung.com>
Tue, 5 Jun 2018 08:43:12 +0000 (11:43 +0300)
committerAnastasia Lyupa <a.lyupa@samsung.com>
Wed, 6 Jun 2018 10:54:56 +0000 (13:54 +0300)
- Fix locale-archive path
- Do not install locales from subfolders
- Fix cp zonefile 'are the same file' error
- Enhance find commands
- Use %{_prefix}, %{_sbindir}, %{_datadir} everywhere

Change-Id: I3dfee1c64adaf5699d7dd66cce2e615a78038f43
Signed-off-by: Anastasia Lyupa <a.lyupa@samsung.com>
packaging/tizen-build-locale-archive
packaging/tizen-locale.spec
packaging/tzdata-update

index 5a06adcad31236860415128c3cc70ac494f7e858..61bac241b81d439931cf2b0ae3a58473d31960bd 100755 (executable)
@@ -1,14 +1,20 @@
 #!/bin/bash
 
 ALIAS_FILE="__DATADIR__/locale/locale.alias"
-LOCAR_FILE="__PREFIX__/locale/locale-archive"
+LOCAR_FILE="__PREFIX__/lib/locale/locale-archive"
 LOC_PATH="__PREFIX__/lib/locale/"
+SBIN_DIR="__SBINDIR__"
 
 rm -f ${LOCAR_FILE}
 
 if [ ! -d ${LOC_PATH} ]; then
        echo "Cannot open directory \"${LOC_PATH}\""
-       #exit 1
+       exit 1
+fi
+
+if [ ! -f ${ALIAS_FILE} ]; then
+       echo "Cannot open alias file \"${ALIAS_FILE}\""
+       exit 1
 fi
 
 PRIMARY=${LC_ALL}
@@ -25,12 +31,10 @@ if [ x"${PRIMARY}" != x"" ]; then
        fi
 
        if [ -d ${PRIMARY} ]; then
-               /usr/bin/localedef --alias-file=${ALIAS_FILE} --add-to-archive ${PRIMARY}
+               localedef --alias-file=${ALIAS_FILE} --add-to-archive ${PRIMARY}
        fi
 fi
 
-find ${LOC_PATH} -type d | while read loc; do
-       /usr/bin/localedef --alias-file=${ALIAS_FILE} --add-to-archive  ${loc}
-done
+find ${LOC_PATH} -mindepth 1 -maxdepth 1 -type d -exec localedef --alias-file=${ALIAS_FILE} --add-to-archive {} \;
 
-exec /usr/sbin/tzdata-update
+exec ${SBIN_DIR}/tzdata-update
index 542b4f7cc0fc9854e1c3754eb1e49ff477b450ff..11776377496777970eadab34223eacdc0f567d79 100644 (file)
@@ -14,7 +14,7 @@ BuildRequires: tzdata >= 2003a
 Requires: findutils
 Requires: coreutils
 Requires: tzdata
-#Requires: glibc-common
+Requires: glibc-locale
 
 %description
 carring locale information for tizen platform
@@ -26,6 +26,8 @@ carring locale information for tizen platform
 %{?asan:%gcc_unforce_options}
 sed -ie "s#__DATADIR__#%{_datadir}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
 sed -ie "s#__PREFIX__#%{_prefix}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
+sed -ie "s#__SBINDIR__#%{_sbindir}#" $RPM_SOURCE_DIR/tizen-build-locale-archive
+sed -ie "s#__DATADIR__#%{_datadir}#" $RPM_SOURCE_DIR/tzdata-update
 
 
 %install
@@ -37,11 +39,11 @@ mkdir -p %{buildroot}%{_sbindir}
 install -m 0700 $RPM_SOURCE_DIR/tizen-build-locale-archive %{buildroot}%{_sbindir}
 install -m 0700 $RPM_SOURCE_DIR/tzdata-update %{buildroot}%{_sbindir}
 
-mkdir -p %{buildroot}/usr/lib/locale
+mkdir -p %{buildroot}%{_prefix}/lib/locale
 
 
 CHARSET=UTF-8
-LOCALE_DIR=%{buildroot}/usr/lib/locale
+LOCALE_DIR=%{buildroot}%{_prefix}/lib/locale
 mkdir -p $LOCALE_DIR
 
 %if "%{?tizen_profile_name}" == "tv"
@@ -58,20 +60,20 @@ do
        I18NPATH=localedata GCONV_PATH=iconvdata localedef --quiet -c -f $CHARSET -i ${LOCALE%%.*} $LOCALE_DIR/$LOCALE
 done
 
-mkdir -p %{buildroot}/usr/share/i18n/
-make -f %{SOURCE10} IN=localedata/SUPPORTED OUT=%{buildroot}/usr/share/i18n/SUPPORTED
+mkdir -p %{buildroot}%{_datadir}/i18n/
+make -f %{SOURCE10} IN=localedata/SUPPORTED OUT=%{buildroot}%{_datadir}/i18n/SUPPORTED
 
-%post -p /usr/sbin/tizen-build-locale-archive
+%post -p %{_sbindir}/tizen-build-locale-archive
 
 %triggerin -- tzdata
-/usr/sbin/tzdata-update
+%{_sbindir}/tzdata-update
 
 %postun
 
 %posttrans
-ls /usr/lib/locale/ | /bin/grep _ | /usr/bin/xargs -I {} /bin/rm -rf /usr/lib/locale/{}
-rm -rf /usr/lib/locale/C.UTF-8
-find /usr/share/locale/ -name libc.mo | /bin/grep -v en_GB | /usr/bin/xargs -I {} /bin/rm {}
+find %{_prefix}/lib/locale/ -name "*_*" -delete
+find %{_prefix}/lib/locale/ -name "C.UTF-8" -delete
+find %{_datadir}/locale/ -not -path "*/en_GB/*" -name "libc.mo" -delete
 
 %clean
 rm -rf "$RPM_BUILD_ROOT"
@@ -80,7 +82,7 @@ rm -rf "$RPM_BUILD_ROOT"
 %defattr(-,root,root)
 %license COPYING COPYING.LIB
 %{_prefix}/lib/locale/*
-%attr(0644,root,root) %config %{_prefix}/share/i18n/SUPPORTED
+%attr(0644,root,root) %config %{_datadir}/i18n/SUPPORTED
 %{_sbindir}/tizen-build-locale-archive
 %{_sbindir}/tzdata-update
 %manifest tizen-locale.manifest
index 92776b1a9bdd4ff052a42cf50df80420d1fdeb41..e4c8cefc85dc25cdd37e5f74deda38349fff1083 100755 (executable)
@@ -14,10 +14,10 @@ do
                continue
        fi
        zonename=$(echo $line | sed -e 's#^[[:space:]]*ZONE[[:space:]]*=[[:space:]]*"\?\([^[:space:]\n"]*\).*#\1#')
-       zonefile="/usr/share/zoneinfo/${zonename}"
+       zonefile="__DATADIR__/zoneinfo/${zonename}"
        break
 done < $CLOCK
 
 if [ -e /etc/localtime ]; then
-    cp ${zonefile} /etc/localtime
+    cp -b ${zonefile} /etc/localtime
 fi