[OE-core] [PATCH] gdk-pixbuf: export XDG_DATA_DIRS in wrappers

Stefan Agner stefan at agner.ch
Sun Mar 3 10:31:06 UTC 2019


On 03.03.2019 10:08, liu.ming50 at gmail.com wrote:
> From: Ming Liu <liu.ming50 at gmail.com>
> 
> We need export XDG_DATA_DIRS to be ${STAGING_DATADIR} for gdk-pixbuf*
> wrappers or else they will try to load mime from /usr/share/mime of the
> host machine.

This fixes a build issue I have seen on a Ubuntu 18.04 machine when
building psplash with a custom png splash screen.

ERROR: psplash-0.1+gitAUTOINC+2015f7073e-r15 do_compile: Error executing
a python function in exec_python_func() autogenerated:                  
                                                                 
                                                                        
                                                                        
                                                                 
The stack trace of python calls that resulted in this exception/failure
was:                                                                    
                                                                  
File: 'exec_python_func() autogenerated', lineno: 2, function: <module> 
                                                                        
                                                                 
     0001:                                                              
                                                                        
                                                                 
 *** 0002:do_compile(d)                                                 
                                                                        
                                                                 
     0003:                                                              
                                                                        
                                                                 
File:
'/workdir/oe/build/conf/../../layers/meta-toradex-torizon/recipes-core/psplash/psplash_git.bbappend',
lineno: 34, function: do_compile                                        
                              
     0030:    for localfile, outputfile in zip(localfiles, outputfiles):
                                                                        
                                                                 
     0031:        if localfile.endswith(".png"):                        
                                                                        
                                                                 
     0032:            subprocess.call([ convertscript,
os.path.join(workdir, localfile), 'POKY' ], cwd=workdir)                
                                                                        
          
     0033:            fbase = os.path.splitext(localfile)[0]            
                                                                        
                                                                 
 *** 0034:            shutil.copyfile(os.path.join(workdir, "%s-img.h" %
fbase), destfile)                                                       
                                                                 
     0035:        else:                                                 
                                                                        
                                                                 
     0036:            shutil.copyfile(os.path.join(workdir, localfile),
destfile)                                                               
                                                                  
     0037:        # For some reason just updating the header is not
enough, we have to touch the .c                                         
                                                                      
     0038:        # file in order to get it to rebuild                  
                                                                        
                                                                 
File: '/usr/lib/python3.6/shutil.py', lineno: 120, function: copyfile   
                                                                        
                                                                 
     0116:                                                              
                                                                        
                                                                 
     0117:    if not follow_symlinks and os.path.islink(src):           
                                                                        
                                                                 
     0118:        os.symlink(os.readlink(src), dst)                     
                                                                        
                                                                 
     0119:    else:                                                     
                                                                        
                                                                 
 *** 0120:        with open(src, 'rb') as fsrc:                         
                                                                        
                                                                 
     0121:            with open(dst, 'wb') as fdst:                     
                                                                        
                                                                 
     0122:                copyfileobj(fsrc, fdst)                       
                                                                        
                                                                 
     0123:    return dst                                                
                                                                        
                                                                 
     0124:                                                              
                                                                        
                                                                 
Exception: FileNotFoundError: [Errno 2] No such file or directory:
'/workdir/oe/tmp/work/cortexa7t2hf-neon-torizon-linux-gnueabi/psplash/0.1+gitAUTOINC+2015f7073e-r15/torizon-blue-img.h'


Note that the error is somewhat misleading since the real problem
happened in the convert script, where the header did not get created due
to gdk-pixbuf-csource not recognizing the png file (Couldn't recognize
the image file format for file ..). This patch fixes the problem!

Tested-by: Stefan Agner <stefan.agner at toradex.com>

Thanks Ming for looking into this!

--
Stefan

> 
> Signed-off-by: Ming Liu <liu.ming50 at gmail.com>
> ---
>  meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.38.0.bb | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.38.0.bb
> b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.38.0.bb
> index 3a544bd..a5bd7c6 100644
> --- a/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.38.0.bb
> +++ b/meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.38.0.bb
> @@ -112,19 +112,24 @@ do_install_append_class-native() {
>  	find ${D}${libdir} -name "libpixbufloader-*.la" -exec rm \{\} \;
>  
>  	create_wrapper ${D}/${bindir}/gdk-pixbuf-csource \
> +		XDG_DATA_DIRS=${STAGING_DATADIR} \
>
> 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
>  
>  	create_wrapper ${D}/${bindir}/gdk-pixbuf-pixdata \
> +		XDG_DATA_DIRS=${STAGING_DATADIR} \
>
> 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
>  
>  	create_wrapper ${D}/${bindir}/gdk-pixbuf-print-mime-types \
> +		XDG_DATA_DIRS=${STAGING_DATADIR} \
>
> 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
>  
>  	create_wrapper ${D}/${libdir}/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders \
> +		XDG_DATA_DIRS=${STAGING_DATADIR} \
>
> 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
> \
>  		GDK_PIXBUF_MODULEDIR=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders
>  
>  	create_wrapper ${D}/${bindir}/gdk-pixbuf-query-loaders \
> +		XDG_DATA_DIRS=${STAGING_DATADIR} \
>
> 		GDK_PIXBUF_MODULE_FILE=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders.cache
> \
>  		GDK_PIXBUF_MODULEDIR=${STAGING_LIBDIR_NATIVE}/gdk-pixbuf-2.0/${LIBV}/loaders
>  }
> -- 
> 2.7.4


More information about the Openembedded-core mailing list