Skip to contentSkip to conversation

lib/oe/rootfs: tell intercepts where the native sysroot is

PATCH New Ross Burton 1 participant 3 messages Oct 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 lib/oe/rootfs: tell intercepts where the native sysroot is

Some intercepts may want to access files in the native sysroot that are not on $PATH (such as something in $libexecdir) but any use of STAGING_DIR_NATIVE in the postinst that calls the intercept will be "baked" into the package, so if sstate is reused it will use paths that may not exist.

Solve this by exporting the location of the native sysroot in the environment so the postinst and intercept can use an environment variable instead of a bitbake variable.

---
 meta/lib/oe/rootfs.py | 1 +
 1 file changed, 1 insertion(+)
meta/lib/oe/rootfs.py +1 -0
index 4e81263..ff29083 100644
@@ -278,6 +278,7 @@ class Rootfs(object):
 
         bb.note("Running intercept scripts:")
         os.environ['D'] = self.image_rootfs
+        os.environ['STAGING_DIR_NATIVE'] = self.d.getVar('STAGING_DIR_NATIVE', True)
         for script in os.listdir(intercepts_dir):
             script_full = os.path.join(intercepts_dir, script)
 
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/3 intercepts/update_icon_cache: use STAGING_DIR_NATIVE from environment

Instead of expecting that the calling postinst has exported STAGING_LIBDIR_NATIVE (which will get set to the sysroot at package build time and may not be correct if sstate is used), use the new STAGING_DIR_NATIVE that is exported by rootfs.py.

[ YOCTO #8547 ]

---
 scripts/postinst-intercepts/update_icon_cache | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/postinst-intercepts/update_icon_cache +1 -1
index c02273d..df9bdec 100644
@@ -3,7 +3,7 @@
 set -e
 
 # update native pixbuf loaders
-${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
+$STAGING_DIR_NATIVE/${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
 
 for icondir in $D/usr/share/icons/*/ ; do
     if [ -d $icondir ] ; then
Signature · 1 line
2.1.4
#2 lore raw

PATCH 3/3 classes/gtk-icon-cache: don't pass STAGING_LIBDIR_NATIVE to intercepts

In reply to Ross Burton

The intercept doesn't need STAGING_LIBDIR_NATIVE anymore, so don't pass it.

---
 meta/classes/gtk-icon-cache.bbclass | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
meta/classes/gtk-icon-cache.bbclass +2 -4
index 6195fa4..425397a 100644
@@ -6,8 +6,7 @@ gtk_icon_cache_postinst() {
 if [ "x$D" != "x" ]; then
 	$INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
 		mlprefix=${MLPREFIX} \
-		libdir=${libdir} \
-		STAGING_LIBDIR_NATIVE=${STAGING_LIBDIR_NATIVE}
+		libdir=${libdir}
 else
 
 	# Update the pixbuf loaders in case they haven't been registered yet
@@ -25,8 +24,7 @@ gtk_icon_cache_postrm() {
 if [ "x$D" != "x" ]; then
 	$INTERCEPT_DIR/postinst_intercept update_icon_cache ${PKG} \
 		mlprefix=${MLPREFIX} \
-		libdir=${libdir} \
-		STAGING_LIBDIR_NATIVE=${STAGING_LIBDIR_NATIVE}
+		libdir=${libdir}
 else
 	for icondir in /usr/share/icons/* ; do
 		if [ -d $icondir ] ; then
Signature · 1 line
2.1.4