mirror of
https://git.yoctoproject.org/poky
synced 2026-03-17 04:39:40 +01:00
classes: Correctly markup regex strings
There are various escape characters in these stings which python warns about so use the correct regex markup for them. (From OE-Core rev: 252b69c9f2abe3258366c540f56b156ed63e5437) (From OE-Core rev: 778f33d40c7e2f4174cc99d25516e5db63d6f75b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
def get_minor_dir(v):
|
||||
import re
|
||||
m = re.match("^([0-9]+)\.([0-9]+)", v)
|
||||
m = re.match(r"^([0-9]+)\.([0-9]+)", v)
|
||||
return "%s.%s" % (m.group(1), m.group(2))
|
||||
|
||||
def get_real_name(n):
|
||||
import re
|
||||
m = re.match("^([a-z]+(-[a-z]+)?)(-[0-9]+\.[0-9]+)?", n)
|
||||
m = re.match(r"^([a-z]+(-[a-z]+)?)(-[0-9]+\.[0-9]+)?", n)
|
||||
return "%s" % (m.group(1))
|
||||
|
||||
VERMINOR = "${@get_minor_dir("${PV}")}"
|
||||
|
||||
@@ -20,7 +20,7 @@ python() {
|
||||
elif generator == "Ninja":
|
||||
d.appendVar("DEPENDS", " ninja-native")
|
||||
d.setVar("OECMAKE_GENERATOR_ARGS", "-G Ninja -DCMAKE_MAKE_PROGRAM=ninja")
|
||||
d.setVarFlag("do_compile", "progress", "outof:^\[(\d+)/(\d+)\]\s+")
|
||||
d.setVarFlag("do_compile", "progress", r"outof:^\[(\d+)/(\d+)\]\s+")
|
||||
else:
|
||||
bb.fatal("Unknown CMake Generator %s" % generator)
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ def package_qa_check_rpath(file,name, d, elf, messages):
|
||||
phdrs = elf.run_objdump("-p", d)
|
||||
|
||||
import re
|
||||
rpath_re = re.compile("\s+RPATH\s+(.*)")
|
||||
rpath_re = re.compile(r"\s+RPATH\s+(.*)")
|
||||
for line in phdrs.split("\n"):
|
||||
m = rpath_re.match(line)
|
||||
if m:
|
||||
@@ -140,7 +140,7 @@ def package_qa_check_useless_rpaths(file, name, d, elf, messages):
|
||||
phdrs = elf.run_objdump("-p", d)
|
||||
|
||||
import re
|
||||
rpath_re = re.compile("\s+RPATH\s+(.*)")
|
||||
rpath_re = re.compile(r"\s+RPATH\s+(.*)")
|
||||
for line in phdrs.split("\n"):
|
||||
m = rpath_re.match(line)
|
||||
if m:
|
||||
@@ -203,8 +203,8 @@ def package_qa_check_libdir(d):
|
||||
# The re's are purposely fuzzy, as some there are some .so.x.y.z files
|
||||
# that don't follow the standard naming convention. It checks later
|
||||
# that they are actual ELF files
|
||||
lib_re = re.compile("^/lib.+\.so(\..+)?$")
|
||||
exec_re = re.compile("^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
|
||||
lib_re = re.compile(r"^/lib.+\.so(\..+)?$")
|
||||
exec_re = re.compile(r"^%s.*/lib.+\.so(\..+)?$" % exec_prefix)
|
||||
|
||||
for root, dirs, files in os.walk(pkgdest):
|
||||
if root == pkgdest:
|
||||
@@ -302,7 +302,7 @@ def package_qa_check_arch(path,name,d, elf, messages):
|
||||
# Check the architecture and endiannes of the binary
|
||||
is_32 = (("virtual/kernel" in provides) or bb.data.inherits_class("module", d)) and \
|
||||
(target_os == "linux-gnux32" or target_os == "linux-muslx32" or \
|
||||
target_os == "linux-gnu_ilp32" or re.match('mips64.*32', d.getVar('DEFAULTTUNE')))
|
||||
target_os == "linux-gnu_ilp32" or re.match(r'mips64.*32', d.getVar('DEFAULTTUNE')))
|
||||
is_bpf = (oe.qa.elf_machine_to_string(elf.machine()) == "BPF")
|
||||
if not ((machine == elf.machine()) or is_32 or is_bpf):
|
||||
package_qa_add_message(messages, "arch", "Architecture did not match (%s, expected %s) on %s" % \
|
||||
@@ -342,7 +342,7 @@ def package_qa_textrel(path, name, d, elf, messages):
|
||||
sane = True
|
||||
|
||||
import re
|
||||
textrel_re = re.compile("\s+TEXTREL\s+")
|
||||
textrel_re = re.compile(r"\s+TEXTREL\s+")
|
||||
for line in phdrs.split("\n"):
|
||||
if textrel_re.match(line):
|
||||
sane = False
|
||||
@@ -952,7 +952,7 @@ python do_package_qa () {
|
||||
|
||||
import re
|
||||
# The package name matches the [a-z0-9.+-]+ regular expression
|
||||
pkgname_pattern = re.compile("^[a-z0-9.+-]+$")
|
||||
pkgname_pattern = re.compile(r"^[a-z0-9.+-]+$")
|
||||
|
||||
taskdepdata = d.getVar("BB_TASKDEPDATA", False)
|
||||
taskdeps = set()
|
||||
@@ -1160,7 +1160,7 @@ python () {
|
||||
if pn in overrides:
|
||||
msg = 'Recipe %s has PN of "%s" which is in OVERRIDES, this can result in unexpected behaviour.' % (d.getVar("FILE"), pn)
|
||||
package_qa_handle_error("pn-overrides", msg, d)
|
||||
prog = re.compile('[A-Z]')
|
||||
prog = re.compile(r'[A-Z]')
|
||||
if prog.search(pn):
|
||||
package_qa_handle_error("uppercase-pn", 'PN: %s is upper case, this can result in unexpected behavior.' % pn, d)
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ def write_license_files(d, license_manifest, pkg_dic):
|
||||
except oe.license.LicenseError as exc:
|
||||
bb.fatal('%s: %s' % (d.getVar('P'), exc))
|
||||
else:
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub('[|&()*]', ' ', pkg_dic[pkg]["LICENSE"])
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub(' *', ' ', pkg_dic[pkg]["LICENSES"])
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub(r'[|&()*]', ' ', pkg_dic[pkg]["LICENSE"])
|
||||
pkg_dic[pkg]["LICENSES"] = re.sub(r' *', ' ', pkg_dic[pkg]["LICENSES"])
|
||||
pkg_dic[pkg]["LICENSES"] = pkg_dic[pkg]["LICENSES"].split()
|
||||
|
||||
if not "IMAGE_MANIFEST" in pkg_dic[pkg]:
|
||||
@@ -78,7 +78,7 @@ def write_license_files(d, license_manifest, pkg_dic):
|
||||
for lic in pkg_dic[pkg]["LICENSES"]:
|
||||
lic_file = os.path.join(d.getVar('LICENSE_DIRECTORY'),
|
||||
pkg_dic[pkg]["PN"], "generic_%s" %
|
||||
re.sub('\+', '', lic))
|
||||
re.sub(r'\+', '', lic))
|
||||
# add explicity avoid of CLOSED license because isn't generic
|
||||
if lic == "CLOSED":
|
||||
continue
|
||||
@@ -119,14 +119,14 @@ def write_license_files(d, license_manifest, pkg_dic):
|
||||
pkg_license = os.path.join(pkg_license_dir, lic)
|
||||
pkg_rootfs_license = os.path.join(pkg_rootfs_license_dir, lic)
|
||||
|
||||
if re.match("^generic_.*$", lic):
|
||||
if re.match(r"^generic_.*$", lic):
|
||||
generic_lic = canonical_license(d,
|
||||
re.search("^generic_(.*)$", lic).group(1))
|
||||
re.search(r"^generic_(.*)$", lic).group(1))
|
||||
|
||||
# Do not copy generic license into package if isn't
|
||||
# declared into LICENSES of the package.
|
||||
if not re.sub('\+$', '', generic_lic) in \
|
||||
[re.sub('\+', '', lic) for lic in \
|
||||
if not re.sub(r'\+$', '', generic_lic) in \
|
||||
[re.sub(r'\+', '', lic) for lic in \
|
||||
pkg_manifest_licenses]:
|
||||
continue
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ def get_perl_version(d):
|
||||
return None
|
||||
l = f.readlines();
|
||||
f.close();
|
||||
r = re.compile("^version='(\d*\.\d*\.\d*)'")
|
||||
r = re.compile(r"^version='(\d*\.\d*\.\d*)'")
|
||||
for s in l:
|
||||
m = r.match(s)
|
||||
if m:
|
||||
|
||||
Reference in New Issue
Block a user