Skip to contentSkip to conversation

Simplify how to stage directories in the sysroot

PATCH Superseded Peter Kjellerstedt 2 participants 19 messages May 11, 2016 – May 12, 2016

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#2 lore raw

PATCH 2/16 u-boot-fw-utils: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb +1 -4
index dfda5c1..79f1548 100644
@@ -40,10 +40,7 @@ do_install_class-cross () {
 	install -m 755 ${S}/tools/env/fw_printenv ${D}${bindir_cross}/fw_setenv
 }
 
-SYSROOT_PREPROCESS_FUNCS_class-cross = "uboot_fw_utils_cross"
-uboot_fw_utils_cross() {
-	sysroot_stage_dir ${D}${bindir_cross} ${SYSROOT_DESTDIR}${bindir_cross}
-}
+SYSROOT_DIRS_append_class-cross = " ${bindir_cross}"
 
 PACKAGE_ARCH = "${MACHINE_ARCH}"
 BBCLASSEXTEND = "cross"
Signature · 1 line
2.1.0
#4 lore raw

PATCH 4/16 qemuwrapper-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meta/recipes-devtools/qemu/qemuwrapper-cross_1.0.bb +1 -5
index 7f4c6d9..53b302d 100644
@@ -41,10 +41,6 @@ EOF
 	chmod +x ${D}${bindir_crossscripts}/qemuwrapper
 }
 
-SYSROOT_PREPROCESS_FUNCS += "qemuwrapper_sysroot_preprocess"
-
-qemuwrapper_sysroot_preprocess () {
-	sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
-}
+SYSROOT_DIRS += "${bindir_crossscripts}"
 
 INHIBIT_DEFAULT_DEPS = "1"
Signature · 1 line
2.1.0
#5 lore raw

PATCH 5/16 tcl: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/tcltk/tcl_8.6.4.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-devtools/tcltk/tcl_8.6.4.bb +1 -4
index 8e92b3e..61be81d 100644
@@ -68,10 +68,7 @@ do_install() {
 	done
 }
 
-SYSROOT_PREPROCESS_FUNCS += "tcl_sysroot_preprocess"
-tcl_sysroot_preprocess () {
-	sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
-}
+SYSROOT_DIRS += "${bindir_crossscripts}"
 
 PACKAGES =+ "tcl-lib"
 FILES_tcl-lib = "${libdir}/libtcl8.6.so.*"
Signature · 1 line
2.1.0
#6 lore raw

PATCH 6/16 shadow-sysroot: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-extended/shadow/shadow-sysroot_4.2.1.bb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-extended/shadow/shadow-sysroot_4.2.1.bb +2 -4
index 697569c..ef01462 100644
@@ -21,12 +21,10 @@ S = "${WORKDIR}"
 
 do_install() {
 	install -d ${D}${sysconfdir}
-	install -p -m 755 ${S}/login.defs_shadow-sysroot ${D}${sysconfdir}/login.defs
+	install -p -m 644 ${S}/login.defs_shadow-sysroot ${D}${sysconfdir}/login.defs
 }
 
-sysroot_stage_all() {
-	sysroot_stage_dir ${D} ${SYSROOT_DESTDIR}
-}
+SYSROOT_DIRS += "${sysconfdir}"
 
 # don't create any packages
 # otherwise: dbus-dev depends on shadow-sysroot-dev which depends on shadow-sysroot 
Signature · 1 line
2.1.0
#9 lore raw

PATCH 9/16 signing-keys: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-core/meta/signing-keys.bb | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/recipes-core/meta/signing-keys.bb +2 -4
index e843301..ea7400b 100644
@@ -12,6 +12,8 @@ inherit allarch deploy
 EXCLUDE_FROM_WORLD = "1"
 INHIBIT_DEFAULT_DEPS = "1"
 
+SYSROOT_DIRS += "${sysconfdir}/pki"
+
 PACKAGES =+ "${PN}-ipk ${PN}-rpm ${PN}-packagefeed"
 
 FILES_${PN}-rpm = "${sysconfdir}/pki/rpm-gpg"
@@ -54,10 +56,6 @@ do_install () {
     fi
 }
 
-sysroot_stage_all_append () {
-    sysroot_stage_dir ${D}${sysconfdir}/pki ${SYSROOT_DESTDIR}${sysconfdir}/pki
-}
-
 do_deploy () {
     if [ -f "${B}/rpm-key" ]; then
         install -D -m 0644 "${B}/rpm-key" "${DEPLOYDIR}/RPM-GPG-KEY-${DISTRO_VERSION}"
Signature · 1 line
2.1.0
#11 lore raw

PATCH 11/16 gobject-introspection: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 .../gobject-introspection/gobject-introspection_1.46.0.bb        | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
meta/recipes-gnome/gobject-introspection/gobject-introspection_1.46.0.bb +4 -5
index 47102ca..861af5f 100644
@@ -151,13 +151,12 @@ FILES_${PN}-staticdev += "${libdir}/gobject-introspection/giscanner/*.a"
 
 # we need target versions of introspection tools in sysroot so that they can be run via qemu
 # when building introspection files in other packages
-SYSROOT_PREPROCESS_FUNCS_append_class-target += "gi_binaries_sysroot_preprocess"
+SYSROOT_DIRS_append_class-target = " ${bindir}"
 
+SYSROOT_PREPROCESS_FUNCS_append_class-target = " gi_binaries_sysroot_preprocess"
 gi_binaries_sysroot_preprocess() {
-        sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
-
-        # Also, tweak the binary names in introspection pkgconfig file, so that it picks up our 
-        # wrappers which do the cross-compile and qemu magic.
+        # Tweak the binary names in the introspection pkgconfig file, so that it
+        # picks up our wrappers which do the cross-compile and qemu magic.
         sed -i \
            -e "s|g_ir_scanner=.*|g_ir_scanner=${bindir}/g-ir-scanner-wrapper|" \
            -e "s|g_ir_compiler=.*|g_ir_compiler=${bindir}/g-ir-compiler-wrapper|" \
Signature · 1 line
2.1.0
#13 lore raw

PATCH 13/16 gettext: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-core/gettext/gettext_0.16.1.bb | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
meta/recipes-core/gettext/gettext_0.16.1.bb +1 -6
index cd0b759..6095c83 100644
@@ -102,11 +102,6 @@ do_install_append() {
 # available, and we don't want to use older macros from the target gettext in
 # a non-gplv3 build, so kill them and let dependent recipes rely on
 # gettext-native.
-
-SYSROOT_PREPROCESS_FUNCS += "remove_sysroot_m4_macros"
-
-remove_sysroot_m4_macros () {
-    rm -r "${SYSROOT_DESTDIR}${datadir}/aclocal"
-}
+SYSROOT_DIRS_BLACKLIST += "${datadir}/aclocal"
 
 BBCLASSEXTEND = "native nativesdk"
Signature · 1 line
2.1.0
#14 lore raw

PATCH 14/16 gcc-target.inc: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/gcc/gcc-target.inc | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
meta/recipes-devtools/gcc/gcc-target.inc +1 -3
index b8dabe5..a960ed4 100644
@@ -205,6 +205,4 @@ do_install_append () {
 # and builds track file dependencies (e.g. perl and its makedepends code).
 # For determinism we don't install this ever and rely on the copy from gcc-cross.
 # [YOCTO #7287]
-sysroot_stage_dirs_append () {
-	rm -rf $to${libdir}/gcc
-}
+SYSROOT_DIRS_BLACKLIST += "${libdir}/gcc"
Signature · 1 line
2.1.0
#15 lore raw

PATCH 15/16 libtool: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/libtool/libtool_2.4.6.bb | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
meta/recipes-devtools/libtool/libtool_2.4.6.bb +5 -8
index 3851ec7..8858f6e 100644
@@ -5,7 +5,11 @@ RDEPENDS_${PN} += "bash"
 #
 # We want the results of libtool-cross preserved - don't stage anything ourselves.
 #
-SYSROOT_PREPROCESS_FUNCS += "libtool_sysroot_preprocess"
+SYSROOT_DIRS_BLACKLIST += " \
+    ${bindir} \
+    ${datadir}/aclocal \
+    ${datadir}/libtool/build-aux \
+"
 
 do_install_append () {
         sed -e 's@--sysroot=${STAGING_DIR_HOST}@@g' \
@@ -18,10 +22,3 @@ do_install_append () {
             -e 's@^\(postdep_objects="\).*@\1"@' \
             -i ${D}${bindir}/libtool
 }
-
-libtool_sysroot_preprocess () {
-	rm -rf ${SYSROOT_DESTDIR}${bindir}/*
-	rm -rf ${SYSROOT_DESTDIR}${datadir}/aclocal/*
-	rm -rf ${SYSROOT_DESTDIR}${datadir}/libtool/build-aux/*
-}
-
Signature · 1 line
2.1.0
#16 lore raw

PATCH 16/16 font-util: Remove ${datadir}/fonts from SYSROOT_DIRS_BLACKLIST

In reply to Peter Kjellerstedt
---
 meta/recipes-graphics/xorg-font/font-util_1.3.1.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-graphics/xorg-font/font-util_1.3.1.bb +1 -4
index 2285124..34646ff 100644
@@ -19,7 +19,4 @@ BBCLASSEXTEND = "native"
 SRC_URI[md5sum] = "23756dab809f9ec5011bb27fb2c3c7d6"
 SRC_URI[sha256sum] = "aa7ebdb0715106dd255082f2310dbaa2cd7e225957c2a77d719720c7cc92b921"
 
-SYSROOT_PREPROCESS_FUNCS += "fontutil_sysroot_preprocess"
-fontutil_sysroot_preprocess () {
-	sysroot_stage_dir ${D}${datadir}/fonts/ ${SYSROOT_DESTDIR}${datadir}/fonts/
-}
+SYSROOT_DIRS_BLACKLIST_remove = "${datadir}/fonts"
Signature · 1 line
2.1.0
#3 lore raw

PATCH 3/16 libtool-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
meta/recipes-devtools/libtool/libtool-cross_2.4.6.bb +1 -6
index 0204d34..b268310 100644
@@ -35,11 +35,6 @@ do_install () {
 	install -c -m 0644 ${S}/m4/*.m4 ${D}${target_datadir}/aclocal/
 }
 
-SYSROOT_PREPROCESS_FUNCS += "libtoolcross_sysroot_preprocess"
-
-libtoolcross_sysroot_preprocess () {
-	sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
-	sysroot_stage_dir ${D}${target_datadir} ${SYSROOT_DESTDIR}${target_datadir}
-}
+SYSROOT_DIRS += "${bindir_crossscripts} ${target_datadir}"
 
 SSTATE_SCAN_FILES += "libtoolize *-libtool"
Signature · 1 line
2.1.0
#7 lore raw

PATCH 7/16 depmodwrapper-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
meta/recipes-kernel/kmod/depmodwrapper-cross_1.0.bb +1 -5
index c2c2589..5c7dd52 100644
@@ -41,10 +41,6 @@ EOF
 	chmod +x ${D}${bindir_crossscripts}/depmodwrapper
 }
 
-SYSROOT_PREPROCESS_FUNCS += "depmodwrapper_sysroot_preprocess"
-
-depmodwrapper_sysroot_preprocess () {
-	sysroot_stage_dir ${D}${bindir_crossscripts} ${SYSROOT_DESTDIR}${bindir_crossscripts}
-}
+SYSROOT_DIRS += "${bindir_crossscripts}"
 
 inherit nopackages
Signature · 1 line
2.1.0
#8 lore raw

PATCH 8/16 base-files: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-core/base-files/base-files_3.0.14.bb | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-core/base-files/base-files_3.0.14.bb +1 -4
index d391707..5333110 100644
@@ -165,9 +165,7 @@ do_install_append_linuxstdbase() {
         done
 }
 
-sysroot_stage_all_append () {
-	sysroot_stage_dir ${D}${sysconfdir}/skel ${SYSROOT_DESTDIR}${sysconfdir}/skel
-}
+SYSROOT_DIRS += "${sysconfdir}/skel"
 
 PACKAGES = "${PN}-doc ${PN} ${PN}-dev ${PN}-dbg"
 FILES_${PN} = "/"
@@ -177,4 +175,3 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 
 CONFFILES_${PN} = "${sysconfdir}/fstab ${@['', '${sysconfdir}/hostname'][(d.getVar('hostname', True) != '')]} ${sysconfdir}/shells"
 CONFFILES_${PN} += "${sysconfdir}/motd ${sysconfdir}/nsswitch.conf ${sysconfdir}/profile"
-
Signature · 1 line
2.1.0
#10 lore raw

PATCH 10/16 vala.inc: Use SYSROOT_DIRS to add dirs to stage in sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-devtools/vala/vala.inc | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
meta/recipes-devtools/vala/vala.inc +6 -7
index 2a8875f..37aa38f 100644
@@ -36,15 +36,14 @@ do_install_append_class-target() {
         install ${B}/vapigen-wrapper ${D}${bindir}/
 }
 
+# Put vapigen wrapper into target sysroot so that it can be used when building
+# vapi files.
+SYSROOT_DIRS_append_class-target = " ${bindir}"
 
-SYSROOT_PREPROCESS_FUNCS_append_class-target += "vapigen_sysroot_preprocess"
-
+SYSROOT_PREPROCESS_FUNCS_append_class-target = " vapigen_sysroot_preprocess"
 vapigen_sysroot_preprocess() {
-        # Put vapigen wrapper into target sysroot so that it can be used when building vapi files.
-        sysroot_stage_dir ${D}${bindir} ${SYSROOT_DESTDIR}${bindir}
-
-        # Also, tweak the vapigen name in vapigen pkgconfig file, so that it picks up our
-        # wrapper.
+        # Tweak the vapigen name in the vapigen pkgconfig file, so that it picks
+        # up our wrapper.
         sed -i \
            -e "s|vapigen=.*|vapigen=${bindir}/vapigen-wrapper|" \
            ${SYSROOT_DESTDIR}${datadir}/pkgconfig/vapigen-${SHRT_VER}.pc
Signature · 1 line
2.1.0
#0 lore raw

cover Simplify how to stage directories in the sysroot

The first commit in this set makes it possible to specify the directories that will be staged in the sysroot via variables rather than hardcoding it in sysroot_stage_dirs(). This should make it a lot easier to add/remove directories to stage.

The rest of the commits just change recipes to take advantage of the new variables.

Because of the following if statement in sysroot_stage_dirs():

	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then

I have split the list of directories into SYSROOT_DIRS and SYSROOT_DIRS_NATIVE, where the latter is included if that if statement is true. I am not sure when that statement is true (my understanding is that it should be true for native builds, but I am not sure if it is also true for other builds like cross, nativesdk, etc). If it is only true for native builds then that if statement could be removed, and the SYSROOT_DIRS_NATIVE variable could be replaced by SYSROOT_DIRS_append_class-native...

//Peter

The following changes since commit 28433319ad8299aa23b1fcfdddbe100b29e86517:

bitbake: toaster: tests browser Add test for creating a project (2016-05-11 11:32:58 +0100)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib pkj/sysroot_dirs
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/sysroot_dirs

Peter Kjellerstedt (16):
staging.bbclass: Make it easier to define which dirs to stage
u-boot-fw-utils: Use SYSROOT_DIRS to add dirs to stage in sysroot
libtool-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot
qemuwrapper-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot
tcl: Use SYSROOT_DIRS to add dirs to stage in sysroot
shadow-sysroot: Use SYSROOT_DIRS to add dirs to stage in sysroot
depmodwrapper-cross: Use SYSROOT_DIRS to add dirs to stage in sysroot
base-files: Use SYSROOT_DIRS to add dirs to stage in sysroot
signing-keys: Use SYSROOT_DIRS to add dirs to stage in sysroot vala.inc: Use SYSROOT_DIRS to add dirs to stage in sysroot
gobject-introspection: Use SYSROOT_DIRS to add dirs to stage in
sysroot
grub2.inc: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot
gettext: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot gcc-target.inc: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from
sysroot
libtool: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot
font-util: Remove ${datadir}/fonts from SYSROOT_DIRS_BLACKLIST

 meta/classes/staging.bbclass                       | 69 ++++++++++++----------
 meta/recipes-bsp/grub/grub2.inc                    |  5 +-
 meta/recipes-bsp/u-boot/u-boot-fw-utils_2016.03.bb |  5 +-
 meta/recipes-core/base-files/base-files_3.0.14.bb  |  5 +-
 meta/recipes-core/gettext/gettext_0.16.1.bb        |  7 +--
 meta/recipes-core/meta/signing-keys.bb             |  6 +-
 meta/recipes-devtools/gcc/gcc-target.inc           |  4 +-
 .../libtool/libtool-cross_2.4.6.bb                 |  7 +--
 meta/recipes-devtools/libtool/libtool_2.4.6.bb     | 13 ++--
 .../recipes-devtools/qemu/qemuwrapper-cross_1.0.bb |  6 +-
 meta/recipes-devtools/tcltk/tcl_8.6.4.bb           |  5 +-
 meta/recipes-devtools/vala/vala.inc                | 13 ++--
 .../shadow/shadow-sysroot_4.2.1.bb                 |  6 +-
 .../gobject-introspection_1.46.0.bb                |  9 ++-
 meta/recipes-graphics/xorg-font/font-util_1.3.1.bb |  5 +-
 .../recipes-kernel/kmod/depmodwrapper-cross_1.0.bb |  6 +-
 16 files changed, 67 insertions(+), 104 deletions(-)
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/16 staging.bbclass: Make it easier to define which dirs to stage

The directories that should be staged in the sysroot are now specified in the SYSROOT_DIRS variable. Extra directories that should be staged for native are specified in SYSROOT_DIRS_NATIVE. Finally, directories that should not be staged are specified in SYSROOT_DIRS_BLACKLIST.

This also removes the sysroot_stage_libdir() function as it is no longer used (it was just a wrapper for sysroot_stage_dir()).

---
 meta/classes/staging.bbclass | 69 ++++++++++++++++++++++++--------------------
 1 file changed, 38 insertions(+), 31 deletions(-)
meta/classes/staging.bbclass +38 -31
index bc5dfa8..2460d5d 100644
@@ -1,3 +1,30 @@
+SYSROOT_DIRS = " \
+    ${includedir} \
+    ${libdir} \
+    ${base_libdir} \
+    ${nonarch_base_libdir} \
+    ${datadir} \
+"
+
+SYSROOT_DIRS_NATIVE = " \
+    ${bindir} \
+    ${sbindir} \
+    ${base_bindir} \
+    ${base_sbindir} \
+    ${libexecdir} \
+    ${sysconfdir} \
+    ${localstatedir} \
+"
+
+SYSROOT_DIRS_BLACKLIST = " \
+    ${mandir} \
+    ${docdir} \
+    ${infodir} \
+    ${datadir}/locale \
+    ${datadir}/applications \
+    ${datadir}/fonts \
+    ${datadir}/pixmaps \
+"
 
 sysroot_stage_dir() {
 	src="$1"
@@ -14,43 +41,23 @@ sysroot_stage_dir() {
 	)
 }
 
-sysroot_stage_libdir() {
-	src="$1"
-	dest="$2"
-
-	sysroot_stage_dir $src $dest
-}
-
 sysroot_stage_dirs() {
 	from="$1"
 	to="$2"
 
-	sysroot_stage_dir $from${includedir} $to${includedir}
+	dirs="${SYSROOT_DIRS}"
 	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
-		sysroot_stage_dir $from${bindir} $to${bindir}
-		sysroot_stage_dir $from${sbindir} $to${sbindir}
-		sysroot_stage_dir $from${base_bindir} $to${base_bindir}
-		sysroot_stage_dir $from${base_sbindir} $to${base_sbindir}
-		sysroot_stage_dir $from${libexecdir} $to${libexecdir}
-		sysroot_stage_dir $from${sysconfdir} $to${sysconfdir}
-		sysroot_stage_dir $from${localstatedir} $to${localstatedir}
+		dirs="$dirs ${SYSROOT_DIRS_NATIVE}"
 	fi
-	if [ -d $from${libdir} ]
-	then
-		sysroot_stage_libdir $from${libdir} $to${libdir}
-	fi
-	if [ -d $from${base_libdir} ]
-	then
-		sysroot_stage_libdir $from${base_libdir} $to${base_libdir}
-	fi
-	if [ -d $from${nonarch_base_libdir} ]
-	then
-		sysroot_stage_libdir $from${nonarch_base_libdir} $to${nonarch_base_libdir}
-	fi
-	sysroot_stage_dir $from${datadir} $to${datadir}
-	# We don't care about docs/info/manpages/locales
-	rm -rf $to${mandir}/ $to${docdir}/ $to${infodir}/ ${to}${datadir}/locale/
-	rm -rf $to${datadir}/applications/ $to${datadir}/fonts/ $to${datadir}/pixmaps/
+
+	for dir in $dirs; do
+		sysroot_stage_dir "$from$dir" "$to$dir"
+	done
+
+	# Remove directories we do not care about
+	for dir in ${SYSROOT_DIRS_BLACKLIST}; do
+		rm -rf "$to$dir"
+	done
 }
 
 sysroot_stage_all() {
Signature · 1 line
2.1.0
#12 lore raw

PATCH 12/16 grub2.inc: Use SYSROOT_DIRS_BLACKLIST to exclude dirs from the sysroot

In reply to Peter Kjellerstedt
---
 meta/recipes-bsp/grub/grub2.inc | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
meta/recipes-bsp/grub/grub2.inc +1 -4
index 146dde6..dd1ffe2 100644
@@ -63,7 +63,4 @@ do_configure_prepend() {
 
 # grub and grub-efi's sysroot/${datadir}/grub/grub-mkconfig_lib are
 # conflicted, remove it since no one uses it.
-SYSROOT_PREPROCESS_FUNCS_class-target += "remove_sysroot_mkconfig_lib"
-remove_sysroot_mkconfig_lib() {
-    rm -r "${SYSROOT_DESTDIR}${datadir}/grub/grub-mkconfig_lib"
-}
+SYSROOT_DIRS_BLACKLIST += "${datadir}/grub/grub-mkconfig_lib"
Signature · 1 line
2.1.0
#17 lore raw
In reply to Peter Kjellerstedt
Quoted 12 lines · Peter Kjellerstedt

The first commit in this set makes it possible to specify the directories that will be staged in the sysroot via variables rather than hardcoding it in sysroot_stage_dirs(). This should make it a lot easier to add/remove directories to stage.

The rest of the commits just change recipes to take advantage of the new variables.

Because of the following if statement in sysroot_stage_dirs():

	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
Quoted 9 lines

I have split the list of directories into SYSROOT_DIRS and SYSROOT_DIRS_NATIVE, where the latter is included if that if statement
is true. I am not sure when that statement is true (my understanding is that it should be true for native builds, but I am not sure if it is also true for other builds like cross, nativesdk, etc). If it is only true for native builds then that if statement could be removed, and the SYSROOT_DIRS_NATIVE variable could be replaced by SYSROOT_DIRS_append_class-native...

It matches binaries that can run on the build system so it needs to match native and cross. Something like:

SYSROOT_DIRS_append_class-native = "${SYSROOT_DIRS_NATIVE}" SYSROOT_DIRS_append_class-cross = "${SYSROOT_DIRS_NATIVE}"

I hadn't realised how much duplication there was in that class. Cleanup I'd never gotten around to doing. I guess most people don't even remember how we ended up with that code or the horrors of do_stage functions :)

Cheers,

Richard

#18 lore raw
Quoted 29 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Purdie
Sent: den 11 maj 2016 23:35
To: Peter Kjellerstedt; [email protected]
Subject: Re: [OE-core] [PATCH 00/16] Simplify how to stage directories in the sysroot

Quoted 12 lines · Peter Kjellerstedt

The first commit in this set makes it possible to specify the directories that will be staged in the sysroot via variables rather than hardcoding it in sysroot_stage_dirs(). This should make it a lot easier to add/remove directories to stage.

The rest of the commits just change recipes to take advantage of the new variables.

Because of the following if statement in sysroot_stage_dirs():

	if [ "${BUILD_SYS}" = "${HOST_SYS}" ]; then
Quoted 8 lines

I have split the list of directories into SYSROOT_DIRS and SYSROOT_DIRS_NATIVE, where the latter is included if that if statement is true. I am not sure when that statement is true (my understanding is that it should be true for native builds, but I am not sure if it is also true for other builds like cross, nativesdk, etc). If it is only true for native builds then that if statement could be removed, and the SYSROOT_DIRS_NATIVE variable could be replaced by SYSROOT_DIRS_append_class-native...

Quoted 5 lines

It matches binaries that can run on the build system so it needs to match native and cross. Something like:

SYSROOT_DIRS_append_class-native = "${SYSROOT_DIRS_NATIVE}" SYSROOT_DIRS_append_class-cross = "${SYSROOT_DIRS_NATIVE}"

Apparently it is true for crossssdk as well (I ran recipes from each of the five classes through bitbake -e to verify). I will send an updated patch that uses the _append solution instead.

Quoted 4 lines

I hadn't realised how much duplication there was in that class. Cleanup I'd never gotten around to doing. I guess most people don't even remember how we ended up with that code or the horrors of do_stage functions :)

I looked at some of the horrors in the git log while investigating how it works. I am glad you got rid of them. ;)

Quoted 3 lines

Cheers,

Richard

//Peter