]> code.ossystems Code Review - openembedded-core.git/commitdiff
glibc-locale: Rewrite do_install using install utility instead of cp
authorKhem Raj <raj.khem@gmail.com>
Fri, 8 Feb 2019 00:56:11 +0000 (16:56 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 8 Feb 2019 14:11:45 +0000 (14:11 +0000)
This has been a constant source of trouble for build failures due to host-user-contaminated QA
errors of sort

ERROR: QA Issue: glibc-locale: /glibc-binary-localedata-ca-es+valencia/usr/lib/locale/ca_ES@valencia/LC_MONETARY is owned by uid 3004, which is the same as the user running bitbake. This may be due to host contamination [host-user-contaminated]

So far we have tried to mould cp command into not carrying the build
user permissions into install area but it is never entirely fixed since
the issue keeps popping up in various scenes

This patch replaces use of cp with install utility and specifies install
mode for files explcitly

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-core/glibc/glibc-locale.inc

index 6384f9cbf114860b3271b2a9405e359d9cf6c3d5..a985d26c75d7da3963516fa88153fb665f0d2d8c 100644 (file)
@@ -71,28 +71,27 @@ FILES_localedef = "${bindir}/localedef"
 
 LOCALETREESRC = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/glibc-stash-locale"
 
-do_install () {
-       mkdir -p ${D}${bindir} ${D}${datadir}
-       if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then
-               cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${bindir}/* ${D}${bindir}
-       fi
-       if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then
-               mkdir -p ${D}${localedir}
-               cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${localedir}/* ${D}${localedir}
-       fi
-       if [ ${@d.getVar('PACKAGE_NO_GCONV')} -eq 0 ]; then
-               mkdir -p ${D}${libdir}
-               if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then
-                       cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir}
-               fi
-               if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then
-                       cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir}
-               fi
-       fi
-       if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then
-               cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/${datadir}/locale ${D}${datadir}
+copy_locale_files() {
+       local dir=$1 mode=$2
+
+       [ -e "${LOCALETREESRC}$dir" ] || return 0
+
+       for d in . $(find "${LOCALETREESRC}$dir" -type d -printf '%P '); do
+               install -d ${D}$dir/$d
+               find "${LOCALETREESRC}$dir/$d" -maxdepth 1 -type f \
+                       -exec install -m $mode -t "${D}$dir/$d" {} \;
+       done
+}
+
+do_install() {
+       copy_locale_files ${bindir} 0755
+       copy_locale_files ${localedir} 0644
+       if [ ${PACKAGE_NO_GCONV} -eq 0 ]; then
+               copy_locale_files ${libdir}/gconv 0755
+               copy_locale_files ${datadir}/i18n 0644
        fi
-       cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+       copy_locale_files ${datadir}/locale 0644
+       install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package