[OE-core] [PATCH v7] do_image: Implement IMAGE_ROOTFS_EXCLUDE_PATH feature.

Kristian Amlie kristian.amlie at northern.tech
Thu Mar 15 09:29:10 UTC 2018


On 13/02/18 02:29, Cal Sullivan wrote:
>> ...
>> +
>> +        if path.endswith(os.sep):
> We need to check if full_path exists here, else it may try modifying
> things that don't exist. E.g., if I have IMAGE_ROOTFS_EXCLUDE_PATH =
> "boot" in local.conf and do 'bitbake core-image-minimal-initramfs' I get
> the following:
> 
> ERROR: core-image-minimal-initramfs-1.0-r0 do_image_cpio: 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:prepare_excluded_directories(d)
>      0003:
> File: '/home/clsulliv/yocto/poky/meta/classes/image.bbclass', lineno:
> 572, function: prepare_excluded_directories
>      0568:                else:
>      0569:                    os.remove(full_entry)
>      0570:        else:
>      0571:            # Delete whole directory.
>  *** 0572:            shutil.rmtree(full_path)
>      0573:
>      0574:    # Save old value for cleanup later.
>      0575:    d.setVar('IMAGE_ROOTFS_ORIG', rootfs_orig)
>      0576:    d.setVar('IMAGE_ROOTFS', new_rootfs)
> File: '/usr/lib64/python3.6/shutil.py', lineno: 471, function: rmtree
>      0467:        # lstat()/open()/fstat() trick.
>      0468:        try:
>      0469:            orig_st = os.lstat(path)
>      0470:        except Exception:
>  *** 0471:            onerror(os.lstat, path, sys.exc_info())
>      0472:            return
>      0473:        try:
>      0474:            fd = os.open(path, os.O_RDONLY)
>      0475:        except Exception:
> File: '/usr/lib64/python3.6/shutil.py', lineno: 469, function: rmtree
>      0465:            path = os.fsdecode(path)
>      0466:        # Note: To guard against symlink races, we use the
> standard
>      0467:        # lstat()/open()/fstat() trick.
>      0468:        try:
>  *** 0469:            orig_st = os.lstat(path)
>      0470:        except Exception:
>      0471:            onerror(os.lstat, path, sys.exc_info())
>      0472:            return
>      0473:        try:
> Exception: FileNotFoundError: [Errno 2] No such file or directory:
> '/home/clsulliv/yocto/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-minimal-initramfs/1.0-r0/rootfs.image_cpio/boot'
> 
> 
> ERROR: core-image-minimal-initramfs-1.0-r0 do_image_cpio: Function
> failed: prepare_excluded_directories
> ERROR: Logfile of failure stored in:
> /home/clsulliv/yocto/poky/build/tmp/work/intel_corei7_64-poky-linux/core-image-minimal-initramfs/1.0-r0/temp/log.do_image_cpio.23514
> 
> ERROR: Task
> (/home/clsulliv/yocto/poky/meta/recipes-core/images/core-image-minimal-initramfs.bb:do_image_cpio)
> failed with exit code '1'
> 
> Besides this, it works well. I'm using it here[1] as part of my attempt
> to improve EFI images.
> 
> [1].
> https://git.yoctoproject.org/cgit/cgit.cgi/poky-contrib/log/?h=clsulliv/image-creation-exclude-path

Sorry for coming late to the party here. Nice find though, and the fix
looks good too.

Will you be pushing to get this merged in master? The process of getting
it merged has been quite slow until now, so I've been considering
implementing this downstream in the meta-mender layer instead, even
though I think it could benefit many OE/poky users.

-- 
Kristian



More information about the Openembedded-core mailing list