All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2] glibc-locale: Rewrite do_install using install utility instead of cp
@ 2019-02-07 18:04 Khem Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2019-02-07 18:04 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>
---
v2: Turn the common install loop into a shell function ( Thanks Peter
Kjellerstedt)
 meta/recipes-core/glibc/glibc-locale.inc | 43 ++++++++++++------------
 1 file changed, 21 insertions(+), 22 deletions(-)

diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
index 6384f9cbf1..c51fa482a9 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}
-	fi
-	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
+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
+        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] 2+ messages in thread

* Re: [PATCH V2] glibc-locale: Rewrite do_install using install utility instead of cp
@ 2019-02-07 19:21 Peter Kjellerstedt
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Kjellerstedt @ 2019-02-07 19:21 UTC (permalink / raw)
  To: Khem Raj, openembedded-core

> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-
> core-bounces@lists.openembedded.org> On Behalf Of Khem Raj
> Sent: den 7 februari 2019 19:04
> To: openembedded-core@lists.openembedded.org
> Subject: [OE-core] [PATCH V2] glibc-locale: Rewrite do_install using
> install utility instead of cp
> 
> 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>
> ---
> v2: Turn the common install loop into a shell function ( Thanks Peter
> Kjellerstedt)
>  meta/recipes-core/glibc/glibc-locale.inc | 43 ++++++++++++------------
>  1 file changed, 21 insertions(+), 22 deletions(-)
> 
> diff --git a/meta/recipes-core/glibc/glibc-locale.inc b/meta/recipes-core/glibc/glibc-locale.inc
> index 6384f9cbf1..c51fa482a9 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}
> -	fi
> -	cp -R --no-dereference --preserve=mode,links ${LOCALETREESRC}/SUPPORTED ${WORKDIR}
> +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
> +        copy_locale_files ${datadir}/locale 0644
> +        install -m 0644 ${LOCALETREESRC}/SUPPORTED ${WORKDIR}/SUPPORTED
>  }
> 
>  inherit libc-package
> --
> 2.20.1

Except for that you turned all the tabs into spaces, it looks fine.

//Peter



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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-07 18:04 [PATCH V2] glibc-locale: Rewrite do_install using install utility instead of cp Khem Raj
2019-02-07 19:21 Peter Kjellerstedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.