diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2024-01-02 11:52:58 -0500 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-02-07 04:00:02 -1000 |
commit | 89b80f507ff84cbadc2536b8e357c67e020e4db6 (patch) | |
tree | 1ea39e872fa83309ce82c24064eca18b038a72bb | |
parent | 84d3e21ba8ba67676dab23dd59e5d638ef016384 (diff) | |
download | poky-89b80f507ff84cbadc2536b8e357c67e020e4db6.tar.gz |
scripts/runqemu: fix regex escape sequences
When invoking runqemu with Python 3.12, the following warning is
encountered:
|SyntaxWarning: invalid escape sequence '\.'
This is because the interpreter scans the string before it is processed
by the regex module, and it interprets the backslash as part of an
escape sequence, but not a standard one. This will be registered as an
error rather than a warning in future Python versions. To avoid the it,
simply add an extra backslash so that Python doesn't misinterpret the
string, while the regex parser still sees an escaped '.' character.
(From OE-Core rev: 145672043d6d75a9e5a03afb4c205e8008218a3b)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 0e8a4142bb90a92d175df6b2537d24a372356f98)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rwxr-xr-x | scripts/runqemu | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/runqemu b/scripts/runqemu index 6fca7439a1..63562cf6dc 100755 --- a/scripts/runqemu +++ b/scripts/runqemu | |||
@@ -367,7 +367,7 @@ class BaseConfig(object): | |||
367 | if p.endswith('.qemuboot.conf'): | 367 | if p.endswith('.qemuboot.conf'): |
368 | self.qemuboot = p | 368 | self.qemuboot = p |
369 | self.qbconfload = True | 369 | self.qbconfload = True |
370 | elif re.search('\.bin$', p) or re.search('bzImage', p) or \ | 370 | elif re.search('\\.bin$', p) or re.search('bzImage', p) or \ |
371 | re.search('zImage', p) or re.search('vmlinux', p) or \ | 371 | re.search('zImage', p) or re.search('vmlinux', p) or \ |
372 | re.search('fitImage', p) or re.search('uImage', p): | 372 | re.search('fitImage', p) or re.search('uImage', p): |
373 | self.kernel = p | 373 | self.kernel = p |
@@ -381,19 +381,19 @@ class BaseConfig(object): | |||
381 | fst = t | 381 | fst = t |
382 | break | 382 | break |
383 | if not fst: | 383 | if not fst: |
384 | m = re.search('.*\.(.*)$', self.rootfs) | 384 | m = re.search('.*\\.(.*)$', self.rootfs) |
385 | if m: | 385 | if m: |
386 | fst = m.group(1) | 386 | fst = m.group(1) |
387 | if fst: | 387 | if fst: |
388 | self.check_arg_fstype(fst) | 388 | self.check_arg_fstype(fst) |
389 | qb = re.sub('\.' + fst + "$", '.qemuboot.conf', self.rootfs) | 389 | qb = re.sub('\\.' + fst + "$", '.qemuboot.conf', self.rootfs) |
390 | if os.path.exists(qb): | 390 | if os.path.exists(qb): |
391 | self.qemuboot = qb | 391 | self.qemuboot = qb |
392 | self.qbconfload = True | 392 | self.qbconfload = True |
393 | else: | 393 | else: |
394 | logger.warning("%s doesn't exist, will try to remove '.rootfs' from filename" % qb) | 394 | logger.warning("%s doesn't exist, will try to remove '.rootfs' from filename" % qb) |
395 | # They to remove .rootfs (IMAGE_NAME_SUFFIX) as well | 395 | # They to remove .rootfs (IMAGE_NAME_SUFFIX) as well |
396 | qb = re.sub('\.rootfs.qemuboot.conf$', '.qemuboot.conf', qb) | 396 | qb = re.sub('\\.rootfs.qemuboot.conf$', '.qemuboot.conf', qb) |
397 | if os.path.exists(qb): | 397 | if os.path.exists(qb): |
398 | self.qemuboot = qb | 398 | self.qemuboot = qb |
399 | self.qbconfload = True | 399 | self.qbconfload = True |