Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp
@ 2019-02-08  0:56 Khem Raj
  2019-02-08  8:44 ` Peter Kjellerstedt
  0 siblings, 1 reply; 22+ messages in thread
From: Khem Raj @ 2019-02-08  0:56 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/recipes-core/glibc/glibc-locale.inc | 41 ++++++++++++------------
 1 file changed, 20 insertions(+), 21 deletions(-)

diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
index 6384f9cbf1..9cce61bf0b 100644
--- a/meta/recipes-core/glibc/glibc-locale.inc
+++ b/meta/recipes-core/glibc/glibc-locale.inc
@@ -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
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread
* [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp
@ 2019-02-07  0:35 Khem Raj
  2019-02-07  9:00 ` Richard Purdie
                   ` (2 more replies)
  0 siblings, 3 replies; 22+ messages in thread
From: Khem Raj @ 2019-02-07  0:35 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/recipes-core/glibc/glibc-locale.inc | 44 ++++++++++++++----------
 1 file changed, 25 insertions(+), 19 deletions(-)

diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
index 6384f9cbf1..9b256a5108 100644
--- a/meta/recipes-core/glibc/glibc-locale.inc
+++ b/meta/recipes-core/glibc/glibc-locale.inc
@@ -72,27 +72,33 @@ 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
+        install -d ${D}${bindir}
+        find "${LOCALETREESRC}/${bindir}" -maxdepth 1 -type f \
+        -exec install -m 0755 -t "${D}${bindir}" {} \;
+
+        for d in . $(find "${LOCALETREESRC}/${localedir}" -type d -printf '%P ') ; do
+                install -d "${D}${localedir}/$d"
+                find "${LOCALETREESRC}/${localedir}/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${localedir}/$d" {} \;
+        done
 	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}
+                for d in . $(find "${LOCALETREESRC}/${libdir}/gconv" -type d -printf '%P ') ; do
+                        install -d "${D}${libdir}/gconv/$d"
+                        find "${LOCALETREESRC}/${libdir}/gconv/$d" -maxdepth 1 -type f \
+                        -exec install -m 0755 -t "${D}${libdir}/gconv/$d" {} \;
+                done
+                for d in . $(find "${LOCALETREESRC}/${datadir}/i18n" -type d -printf '%P ') ; do
+                        install -d "${D}${datadir}/i18n/$d"
+                        find "${LOCALETREESRC}/${datadir}/i18n/$d" -maxdepth 1 -type f \
+                        -exec install -m 0644 -t "${D}${datadir}/i18n/$d" {} \;
+                done
 	fi
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+        for d in . $(find "${LOCALETREESRC}/${datadir}/locale" -type d -printf '%P ') ; do
+                install -d "${D}${datadir}/locale/$d"
+                find "${LOCALETREESRC}/${datadir}/locale/$d" -maxdepth 1 -type f \
+                -exec install -m 0644 -t "${D}${datadir}/locale/$d" {} \;
+        done
+	install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
 }
 
 inherit libc-package
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2019-02-28 15:21 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-08  0:56 [PATCH] glibc-locale: Rewrite do_install using install utility instead of cp Khem Raj
2019-02-08  8:44 ` Peter Kjellerstedt
2019-02-08 15:21   ` Khem Raj
2019-02-10  0:34     ` Peter Kjellerstedt
  -- strict thread matches above, loose matches on Subject: below --
2019-02-07  0:35 Khem Raj
2019-02-07  9:00 ` Richard Purdie
2019-02-07 14:49   ` Khem Raj
2019-02-07 16:17     ` Martin Jansa
2019-02-07 16:44       ` Joshua Watt
2019-02-07 16:59         ` Joshua Watt
2019-02-07 17:11           ` Martin Jansa
2019-02-07 17:21           ` Richard Purdie
2019-02-07 19:34             ` Joshua Watt
2019-02-10  1:29   ` Peter Kjellerstedt
2019-02-10  6:25     ` Peter Kjellerstedt
2019-02-10 23:32       ` Peter Kjellerstedt
2019-02-11  2:09         ` Khem Raj
2019-02-13 17:42           ` Khem Raj
2019-02-07 11:44 ` Peter Kjellerstedt
2019-02-07 14:53   ` Khem Raj
2019-02-28  1:53 ` ChenQi
2019-02-28 15:21   ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox