On Wed, 2023-03-22 at 16:54 +0100, [email protected] wrote:
> From: Dit Kozmaj <[email protected]>
> 
> So far part.label has been used to define GPT partition label even if
> part.part_name was defined.
> Fix the code to use part.part_name whenever available, as it makes sense
> to have a GPT partition label which is different from the contained
> filesystem label.
> 
> Signed-off-by: Dit Kozmaj <[email protected]>
> Signed-off-by: Diego Rondini <[email protected]>
> ---
>  scripts/lib/wic/plugins/imager/direct.py | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/scripts/lib/wic/plugins/imager/direct.py 
> b/scripts/lib/wic/plugins/imager/direct.py
> index dfaa901567..1f06b89f8e 100644
> --- a/scripts/lib/wic/plugins/imager/direct.py
> +++ b/scripts/lib/wic/plugins/imager/direct.py
> @@ -571,11 +571,12 @@ class PartitionedImage():
>              self._create_partition(self.path, part.type,
>                                     parted_fs_type, part.start, part.size_sec)
>  
> -            if part.part_name:
> +            if part.part_name or part.label:
> +                partition_label = part.part_name if part.part_name else 
> part.label
>                  logger.debug("partition %d: set name to %s",
> -                             part.num, part.part_name)
> +                             part.num, partition_label)
>                  exec_native_cmd("sgdisk --change-name=%d:%s %s" % \
> -                                         (part.num, part.part_name,
> +                                         (part.num, partition_label,
>                                            self.path), self.native_sysroot)
>  
>              if part.part_type:
> @@ -592,13 +593,6 @@ class PartitionedImage():
>                                  (part.num, part.uuid, self.path),
>                                  self.native_sysroot)
>  
> -            if part.label and self.ptable_format == "gpt":
> -                logger.debug("partition %d: set name to %s",
> -                             part.num, part.label)
> -                exec_native_cmd("parted -s %s name %d %s" % \
> -                                (self.path, part.num, part.label),
> -                                self.native_sysroot)
> -
>              if part.active:
>                  flag_name = "legacy_boot" if self.ptable_format == 'gpt' 
> else "boot"
>                  logger.debug("Set '%s' flag for partition '%s' on disk '%s'",

This was flagged on irc as not having a response. We're struggling with
a lack of a maintainer for wic at the moment so review is slow and I'm
not really a wic expert but I'm all we have :/.

As mentioned, changes to code like this are much more likely if there
is a test case included. The existing tests can be run with "oe-
selftest -r wic".

Can you confirm this patch doesn't regress the current tests?

Would you be able to add a test so this change doesn't regress in
future?

Cheers,

Richard



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#179291): 
https://lists.openembedded.org/g/openembedded-core/message/179291
Mute This Topic: https://lists.openembedded.org/mt/97781388/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to