[OE-core] [PATCH] wic: Add include-dir option
Martin Hundebøll
martin at geanix.com
Thu Feb 27 08:12:15 UTC 2020
Hi Armin,
On 27/02/2020 05.26, Armin Kuster wrote:
> This option allows for the inclusion of a single directory
> for a partition.
I am unsure how this is used in a .wks file.
From the code it looks similar to the include-path option, but relative
to the rootfs source dir instead of the wic working dir?
But the include-dir value is also used in the destination path?
Thanks,
Martin
> Signed-off-by: Armin Kuster <akuster808 at gmail.com>
> ---
> scripts/lib/wic/help.py | 3 +++
> scripts/lib/wic/ksparser.py | 1 +
> scripts/lib/wic/partition.py | 1 +
> scripts/lib/wic/plugins/source/rootfs.py | 10 ++++++++--
> 4 files changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py
> index 4d342fcf05..517f68e11e 100644
> --- a/scripts/lib/wic/help.py
> +++ b/scripts/lib/wic/help.py
> @@ -979,6 +979,9 @@ DESCRIPTION
> copies. This option only has an effect with the rootfs
> source plugin.
>
> + --include-dir: This option is specific to wic. It adds the contents
> + of the given directory to the resulting partition.
> +
> --extra-space: This option is specific to wic. It adds extra
> space after the space filled by the content
> of the partition. The final size can go
> diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
> index 650b976223..b8abc33c87 100644
> --- a/scripts/lib/wic/ksparser.py
> +++ b/scripts/lib/wic/ksparser.py
> @@ -138,6 +138,7 @@ class KickStart():
> part.add_argument('--align', type=int)
> part.add_argument('--exclude-path', nargs='+')
> part.add_argument('--include-path', nargs='+')
> + part.add_argument('--include-dir')
> part.add_argument("--extra-space", type=sizetype)
> part.add_argument('--fsoptions', dest='fsopts')
> part.add_argument('--fstype', default='vfat',
> diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py
> index 2d95f78439..0b735fffd9 100644
> --- a/scripts/lib/wic/partition.py
> +++ b/scripts/lib/wic/partition.py
> @@ -31,6 +31,7 @@ class Partition():
> self.extra_space = args.extra_space
> self.exclude_path = args.exclude_path
> self.include_path = args.include_path
> + self.include_dir = args.include_dir
> self.fsopts = args.fsopts
> self.fstype = args.fstype
> self.label = args.label
> diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py
> index 705aeb5563..d1c59cab8a 100644
> --- a/scripts/lib/wic/plugins/source/rootfs.py
> +++ b/scripts/lib/wic/plugins/source/rootfs.py
> @@ -71,7 +71,7 @@ class RootfsPlugin(SourcePlugin):
>
> new_rootfs = None
> # Handle excluded paths.
> - if part.exclude_path or part.include_path:
> + if part.exclude_path or part.include_path or part.include_dir:
> # We need a new rootfs directory we can delete files from. Copy to
> # workdir.
> new_rootfs = os.path.realpath(os.path.join(cr_workdir, "rootfs%d" % part.lineno))
> @@ -79,7 +79,13 @@ class RootfsPlugin(SourcePlugin):
> if os.path.lexists(new_rootfs):
> shutil.rmtree(os.path.join(new_rootfs))
>
> - copyhardlinktree(part.rootfs_dir, new_rootfs)
> + if part.include_dir:
> + src = os.path.realpath(os.path.join(part.rootfs_dir, part.include_dir))
> + dst = os.path.realpath(os.path.join(new_rootfs, part.include_dir))
> + copyhardlinktree(src, dst)
> +
> + else:
> + copyhardlinktree(part.rootfs_dir, new_rootfs)
>
> for path in part.include_path or []:
> copyhardlinktree(path, new_rootfs)
>
More information about the Openembedded-core
mailing list