Skip to contentSkip to conversation

wic: engine.py: use raw string for escape sequence

PATCH In review Enrico Jörns 4 participants 7 messages Jun 4, 2024 – Jul 9, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 wic: engine.py: use raw string for escape sequence

Fixes:

| poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

---
 scripts/lib/wic/engine.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/wic/engine.py +1 -1
index 674ccfc244..ce7e6c5d75 100644
@@ -359,7 +359,7 @@ class Disk:
         Remove files/dirs and their contents from the partition.
         This only applies to ext* partition.
         """
-        abs_path = re.sub('\/\/+', '/', path)
+        abs_path = re.sub(r'\/\/+', '/', path)
         cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs,
                                             self._get_part_image(pnum),
                                             abs_path)
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/2 wic: bootimg-efi: fix error handling

If we check for empty variables, it does not make sense to print their content in case they are empty.

Additionally, the error message in the 'kernel' check attempted to print the wrong variable ('target') which was not even defined, yet.

Also, raising WicError doesn't require an extra newline.

---
 scripts/lib/wic/plugins/source/bootimg-efi.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/lib/wic/plugins/source/bootimg-efi.py +2 -2
index 13a9cddf4e..7cc5131541 100644
@@ -428,10 +428,10 @@ class BootimgEFIPlugin(SourcePlugin):
             elif source_params['loader'] == 'uefi-kernel':
                 kernel = get_bitbake_var("KERNEL_IMAGETYPE")
                 if not kernel:
-                    raise WicError("Empty KERNEL_IMAGETYPE %s\n" % target)
+                    raise WicError("Empty KERNEL_IMAGETYPE")
                 target = get_bitbake_var("TARGET_SYS")
                 if not target:
-                    raise WicError("Unknown arch (TARGET_SYS) %s\n" % target)
+                    raise WicError("Empty TARGET_SYS")
 
                 if re.match("x86_64", target):
                     kernel_efi_image = "bootx64.efi"
Signature · 1 line
2.39.2
#2 lore raw
In reply to Enrico Jörns

Hi RP,

We do see this issue in scarthgap, Can you get this patch backported to scarthgap branch?

Thanks,

Sandeep

Quoted 31 lines · Enrico Jörns via lists.openembedded.org

Fixes:

| poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

---
  scripts/lib/wic/engine.py | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
scripts/lib/wic/engine.py +1 -2
index 674ccfc244..ce7e6c5d75 100644
@@ -359,7 +359,7 @@ class Disk:
          Remove files/dirs and their contents from the partition.
          This only applies to ext* partition.
          """
-        abs_path = re.sub('\/\/+', '/', path)
+        abs_path = re.sub(r'\/\/+', '/', path)
          cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs,
                                              self._get_part_image(pnum),
                                              abs_path)
 
-=-=-=-=-=-=-=-=-=-=-=-

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

#3 lore raw
Quoted 6 lines · Sandeep

Hi RP,

We do see this issue in scarthgap, Can you get this patch backported to
scarthgap branch?

Quoted 12 lines

Thanks,

Sandeep

Quoted 7 lines · Enrico Jörns via lists.openembedded.org

Fixes:

Quoted 2 lines

poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

---

You need to talk to the stable maintainer for scarthgap, Steve Sakoman (copied on this reply) about that rather than me.

Cheers,

Richard

#4 lore raw
Quoted 18 lines · Richard Purdie
Quoted 16 lines · Sandeep

Hi RP,

We do see this issue in scarthgap, Can you get this patch backported to
scarthgap branch?

Thanks,

Sandeep

Quoted 5 lines · Enrico Jörns via lists.openembedded.org

Fixes:

Quoted 2 lines

poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

Quoted 6 lines
Quoted 2 lines
Quoted 2 lines

---

You need to talk to the stable maintainer for scarthgap, Steve Sakoman (copied on this reply) about that rather than me.

I've got it, thanks!

Steve

#5 lore raw
Quoted 16 lines · Steve Sakoman
Quoted 14 lines · Richard Purdie
Quoted 13 lines · Sandeep

Hi RP,

We do see this issue in scarthgap, Can you get this patch backported to
scarthgap branch?

Thanks,

Sandeep

Quoted 2 lines · Enrico Jörns via lists.openembedded.org

Fixes:

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

---

You need to talk to the stable maintainer for scarthgap, Steve Sakoman (copied on this reply) about that rather than me.

I've got it, thanks!

Thanks RP and Steve. Steve when this will be available in scarthgap branch?

Quoted 2 lines

Steve

#6 lore raw
Quoted 21 lines · Sandeep
Quoted 18 lines · Steve Sakoman
Quoted 16 lines · Richard Purdie
Quoted 15 lines · Sandeep

Hi RP,

We do see this issue in scarthgap, Can you get this patch backported to
scarthgap branch?

Thanks,

Sandeep

Quoted 4 lines · Enrico Jörns via lists.openembedded.org

Fixes:

Quoted 2 lines

poky/scripts/lib/wic/engine.py:362: SyntaxWarning: invalid escape sequence '\/'

Quoted 7 lines
Quoted 6 lines
Quoted 5 lines
Quoted 2 lines
Quoted 2 lines

---

You need to talk to the stable maintainer for scarthgap, Steve Sakoman (copied on this reply) about that rather than me.

I've got it, thanks!

Thanks RP and Steve. Steve when this will be available in scarthgap branch?

It is in my current test queue (stable/scarthgap-nut), if it passes autobuilder testing then it will be posted to the list along with the other patches for review. If no comments during the two business day review period then they will be merged to scarthgap.

Steve