summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-14 15:49:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-16 15:35:07 +0000
commitcd4b8a8553f9d551af27941910cf4d3405ecb7b0 (patch)
tree4f2c58eca95fd5ea9a4538a66a4875fd9d947b0d /meta/classes
parent1ee53881eea3a7ca4d4f6a5ca9c4c6e6488d2348 (diff)
downloadpoky-cd4b8a8553f9d551af27941910cf4d3405ecb7b0.tar.gz
meta: Fix Deprecated warnings from regexs
Fix handling of escape characters in regexs and hence fix python Deprecation warnings which will be problematic in python 3.8. Note that some show up as: """ meta/classes/package.bbclass:1293: DeprecationWarning: invalid escape sequence \.   """ where the problem isn't on 1293 in package.bbclass but in some _prepend to a package.bbclass function in a different file like mesa.inc, often from do_package_split() calls. (From OE-Core rev: 4b1c0c7d5525fc4cea9e0f02ec54e92a6fbc6199) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/debian.bbclass6
-rw-r--r--meta/classes/gconf.bbclass2
-rw-r--r--meta/classes/kernel-module-split.bbclass2
-rw-r--r--meta/classes/kernel.bbclass2
-rw-r--r--meta/classes/libc-package.bbclass26
-rw-r--r--meta/classes/package.bbclass22
6 files changed, 30 insertions, 30 deletions
diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass
index 989ea8f8d2..6f8a599ccb 100644
--- a/meta/classes/debian.bbclass
+++ b/meta/classes/debian.bbclass
@@ -29,11 +29,11 @@ python debian_package_name_hook () {
29 29
30 pkgdest = d.getVar("PKGDEST") 30 pkgdest = d.getVar("PKGDEST")
31 packages = d.getVar('PACKAGES') 31 packages = d.getVar('PACKAGES')
32 so_re = re.compile("lib.*\.so") 32 so_re = re.compile(r"lib.*\.so")
33 33
34 def socrunch(s): 34 def socrunch(s):
35 s = s.lower().replace('_', '-') 35 s = s.lower().replace('_', '-')
36 m = re.match("^(.*)(.)\.so\.(.*)$", s) 36 m = re.match(r"^(.*)(.)\.so\.(.*)$", s)
37 if m is None: 37 if m is None:
38 return None 38 return None
39 if m.group(2) in '0123456789': 39 if m.group(2) in '0123456789':
@@ -79,7 +79,7 @@ python debian_package_name_hook () {
79 try: 79 try:
80 cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f] 80 cmd = [d.expand("${TARGET_PREFIX}objdump"), "-p", f]
81 output = subprocess.check_output(cmd).decode("utf-8") 81 output = subprocess.check_output(cmd).decode("utf-8")
82 for m in re.finditer("\s+SONAME\s+([^\s]+)", output): 82 for m in re.finditer(r"\s+SONAME\s+([^\s]+)", output):
83 if m.group(1) not in sonames: 83 if m.group(1) not in sonames:
84 sonames.append(m.group(1)) 84 sonames.append(m.group(1))
85 except subprocess.CalledProcessError: 85 except subprocess.CalledProcessError:
diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass
index 4e0ee2e7d5..3e3c509d5f 100644
--- a/meta/classes/gconf.bbclass
+++ b/meta/classes/gconf.bbclass
@@ -49,7 +49,7 @@ python populate_packages_append () {
49 for pkg in packages: 49 for pkg in packages:
50 schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) 50 schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg)
51 schemas = [] 51 schemas = []
52 schema_re = re.compile(".*\.schemas$") 52 schema_re = re.compile(r".*\.schemas$")
53 if os.path.exists(schema_dir): 53 if os.path.exists(schema_dir):
54 for f in os.listdir(schema_dir): 54 for f in os.listdir(schema_dir):
55 if schema_re.match(f): 55 if schema_re.match(f):
diff --git a/meta/classes/kernel-module-split.bbclass b/meta/classes/kernel-module-split.bbclass
index e8996cf59b..e8d3eb5105 100644
--- a/meta/classes/kernel-module-split.bbclass
+++ b/meta/classes/kernel-module-split.bbclass
@@ -133,7 +133,7 @@ python split_kernel_module_packages () {
133 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel" 133 kernel_package_name = d.getVar("KERNEL_PACKAGE_NAME") or "kernel"
134 kernel_version = d.getVar("KERNEL_VERSION") 134 kernel_version = d.getVar("KERNEL_VERSION")
135 135
136 module_regex = '^(.*)\.k?o$' 136 module_regex = r'^(.*)\.k?o$'
137 137
138 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX') 138 module_pattern_prefix = d.getVar('KERNEL_MODULE_PACKAGE_PREFIX')
139 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX') 139 module_pattern_suffix = d.getVar('KERNEL_MODULE_PACKAGE_SUFFIX')
diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index 45cb4fabc1..c0889bd3ee 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -578,7 +578,7 @@ pkg_postinst_${KERNEL_PACKAGE_NAME}-base () {
578PACKAGESPLITFUNCS_prepend = "split_kernel_packages " 578PACKAGESPLITFUNCS_prepend = "split_kernel_packages "
579 579
580python split_kernel_packages () { 580python split_kernel_packages () {
581 do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex='^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='') 581 do_split_packages(d, root='${nonarch_base_libdir}/firmware', file_regex=r'^(.*)\.(bin|fw|cis|csp|dsp)$', output_pattern='${KERNEL_PACKAGE_NAME}-firmware-%s', description='Firmware for %s', recursive=True, extra_depends='')
582} 582}
583 583
584# Many scripts want to look in arch/$arch/boot for the bootable 584# Many scripts want to look in arch/$arch/boot for the bootable
diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass
index 82d642e15e..0b4c666a74 100644
--- a/meta/classes/libc-package.bbclass
+++ b/meta/classes/libc-package.bbclass
@@ -113,8 +113,8 @@ python package_do_split_gconvs () {
113 def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group): 113 def calc_gconv_deps(fn, pkg, file_regex, output_pattern, group):
114 deps = [] 114 deps = []
115 f = open(fn, "rb") 115 f = open(fn, "rb")
116 c_re = re.compile('^copy "(.*)"') 116 c_re = re.compile(r'^copy "(.*)"')
117 i_re = re.compile('^include "(\w+)".*') 117 i_re = re.compile(r'^include "(\w+)".*')
118 for l in f.readlines(): 118 for l in f.readlines():
119 l = l.decode("latin-1") 119 l = l.decode("latin-1")
120 m = c_re.match(l) or i_re.match(l) 120 m = c_re.match(l) or i_re.match(l)
@@ -128,15 +128,15 @@ python package_do_split_gconvs () {
128 if bpn != 'glibc': 128 if bpn != 'glibc':
129 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) 129 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc'))
130 130
131 do_split_packages(d, gconv_libdir, file_regex='^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \ 131 do_split_packages(d, gconv_libdir, file_regex=r'^(.*)\.so$', output_pattern=bpn+'-gconv-%s', \
132 description='gconv module for character set %s', hook=calc_gconv_deps, \ 132 description='gconv module for character set %s', hook=calc_gconv_deps, \
133 extra_depends=bpn+'-gconv') 133 extra_depends=bpn+'-gconv')
134 134
135 def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group): 135 def calc_charmap_deps(fn, pkg, file_regex, output_pattern, group):
136 deps = [] 136 deps = []
137 f = open(fn, "rb") 137 f = open(fn, "rb")
138 c_re = re.compile('^copy "(.*)"') 138 c_re = re.compile(r'^copy "(.*)"')
139 i_re = re.compile('^include "(\w+)".*') 139 i_re = re.compile(r'^include "(\w+)".*')
140 for l in f.readlines(): 140 for l in f.readlines():
141 l = l.decode("latin-1") 141 l = l.decode("latin-1")
142 m = c_re.match(l) or i_re.match(l) 142 m = c_re.match(l) or i_re.match(l)
@@ -150,14 +150,14 @@ python package_do_split_gconvs () {
150 if bpn != 'glibc': 150 if bpn != 'glibc':
151 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) 151 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc'))
152 152
153 do_split_packages(d, charmap_dir, file_regex='^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \ 153 do_split_packages(d, charmap_dir, file_regex=r'^(.*)\.gz$', output_pattern=bpn+'-charmap-%s', \
154 description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='') 154 description='character map for %s encoding', hook=calc_charmap_deps, extra_depends='')
155 155
156 def calc_locale_deps(fn, pkg, file_regex, output_pattern, group): 156 def calc_locale_deps(fn, pkg, file_regex, output_pattern, group):
157 deps = [] 157 deps = []
158 f = open(fn, "rb") 158 f = open(fn, "rb")
159 c_re = re.compile('^copy "(.*)"') 159 c_re = re.compile(r'^copy "(.*)"')
160 i_re = re.compile('^include "(\w+)".*') 160 i_re = re.compile(r'^include "(\w+)".*')
161 for l in f.readlines(): 161 for l in f.readlines():
162 l = l.decode("latin-1") 162 l = l.decode("latin-1")
163 m = c_re.match(l) or i_re.match(l) 163 m = c_re.match(l) or i_re.match(l)
@@ -171,13 +171,13 @@ python package_do_split_gconvs () {
171 if bpn != 'glibc': 171 if bpn != 'glibc':
172 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc')) 172 d.setVar('RPROVIDES_%s' % pkg, pkg.replace(bpn, 'glibc'))
173 173
174 do_split_packages(d, locales_dir, file_regex='(.*)', output_pattern=bpn+'-localedata-%s', \ 174 do_split_packages(d, locales_dir, file_regex=r'(.*)', output_pattern=bpn+'-localedata-%s', \
175 description='locale definition for %s', hook=calc_locale_deps, extra_depends='') 175 description='locale definition for %s', hook=calc_locale_deps, extra_depends='')
176 d.setVar('PACKAGES', d.getVar('PACKAGES', False) + ' ' + d.getVar('MLPREFIX', False) + bpn + '-gconv') 176 d.setVar('PACKAGES', d.getVar('PACKAGES', False) + ' ' + d.getVar('MLPREFIX', False) + bpn + '-gconv')
177 177
178 use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE") 178 use_bin = d.getVar("GLIBC_INTERNAL_USE_BINARY_LOCALE")
179 179
180 dot_re = re.compile("(.*)\.(.*)") 180 dot_re = re.compile(r"(.*)\.(.*)")
181 181
182 # Read in supported locales and associated encodings 182 # Read in supported locales and associated encodings
183 supported = {} 183 supported = {}
@@ -290,7 +290,7 @@ python package_do_split_gconvs () {
290 d.setVar('ALLOW_EMPTY_%s' % pkgname, '1') 290 d.setVar('ALLOW_EMPTY_%s' % pkgname, '1')
291 d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES'))) 291 d.setVar('PACKAGES', '%s %s' % (pkgname, d.getVar('PACKAGES')))
292 rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name)) 292 rprovides = ' %svirtual-locale-%s' % (mlprefix, legitimize_package_name(name))
293 m = re.match("(.*)_(.*)", name) 293 m = re.match(r"(.*)_(.*)", name)
294 if m: 294 if m:
295 rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1)) 295 rprovides += ' %svirtual-locale-%s' % (mlprefix, m.group(1))
296 d.setVar('RPROVIDES_%s' % pkgname, rprovides) 296 d.setVar('RPROVIDES_%s' % pkgname, rprovides)
@@ -356,12 +356,12 @@ python package_do_split_gconvs () {
356 if use_bin in ('compile', 'precompiled'): 356 if use_bin in ('compile', 'precompiled'):
357 lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES') 357 lcsplit = d.getVar('GLIBC_SPLIT_LC_PACKAGES')
358 if lcsplit and int(lcsplit): 358 if lcsplit and int(lcsplit):
359 do_split_packages(d, binary_locales_dir, file_regex='^(.*/LC_\w+)', \ 359 do_split_packages(d, binary_locales_dir, file_regex=r'^(.*/LC_\w+)', \
360 output_pattern=bpn+'-binary-localedata-%s', \ 360 output_pattern=bpn+'-binary-localedata-%s', \
361 description='binary locale definition for %s', recursive=True, 361 description='binary locale definition for %s', recursive=True,
362 hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True) 362 hook=metapkg_hook, extra_depends='', allow_dirs=True, match_path=True)
363 else: 363 else:
364 do_split_packages(d, binary_locales_dir, file_regex='(.*)', \ 364 do_split_packages(d, binary_locales_dir, file_regex=r'(.*)', \
365 output_pattern=bpn+'-binary-localedata-%s', \ 365 output_pattern=bpn+'-binary-localedata-%s', \
366 description='binary locale definition for %s', extra_depends='', allow_dirs=True) 366 description='binary locale definition for %s', extra_depends='', allow_dirs=True)
367 else: 367 else:
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 7a7bc9e2f0..853735f0c6 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -75,7 +75,7 @@ def legitimize_package_name(s):
75 return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape') 75 return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape')
76 76
77 # Handle unicode codepoints encoded as <U0123>, as in glibc locale files. 77 # Handle unicode codepoints encoded as <U0123>, as in glibc locale files.
78 s = re.sub('<U([0-9A-Fa-f]{1,4})>', fixutf, s) 78 s = re.sub(r'<U([0-9A-Fa-f]{1,4})>', fixutf, s)
79 79
80 # Remaining package name validity fixes 80 # Remaining package name validity fixes
81 return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') 81 return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-')
@@ -1590,8 +1590,8 @@ python package_do_shlibs() {
1590 bb.note("not generating shlibs") 1590 bb.note("not generating shlibs")
1591 return 1591 return
1592 1592
1593 lib_re = re.compile("^.*\.so") 1593 lib_re = re.compile(r"^.*\.so")
1594 libdir_re = re.compile(".*/%s$" % d.getVar('baselib')) 1594 libdir_re = re.compile(r".*/%s$" % d.getVar('baselib'))
1595 1595
1596 packages = d.getVar('PACKAGES') 1596 packages = d.getVar('PACKAGES')
1597 1597
@@ -1632,17 +1632,17 @@ python package_do_shlibs() {
1632 fd.close() 1632 fd.close()
1633 rpath = tuple() 1633 rpath = tuple()
1634 for l in lines: 1634 for l in lines:
1635 m = re.match("\s+RPATH\s+([^\s]*)", l) 1635 m = re.match(r"\s+RPATH\s+([^\s]*)", l)
1636 if m: 1636 if m:
1637 rpaths = m.group(1).replace("$ORIGIN", ldir).split(":") 1637 rpaths = m.group(1).replace("$ORIGIN", ldir).split(":")
1638 rpath = tuple(map(os.path.normpath, rpaths)) 1638 rpath = tuple(map(os.path.normpath, rpaths))
1639 for l in lines: 1639 for l in lines:
1640 m = re.match("\s+NEEDED\s+([^\s]*)", l) 1640 m = re.match(r"\s+NEEDED\s+([^\s]*)", l)
1641 if m: 1641 if m:
1642 dep = m.group(1) 1642 dep = m.group(1)
1643 if dep not in needed: 1643 if dep not in needed:
1644 needed.add((dep, file, rpath)) 1644 needed.add((dep, file, rpath))
1645 m = re.match("\s+SONAME\s+([^\s]*)", l) 1645 m = re.match(r"\s+SONAME\s+([^\s]*)", l)
1646 if m: 1646 if m:
1647 this_soname = m.group(1) 1647 this_soname = m.group(1)
1648 prov = (this_soname, ldir, pkgver) 1648 prov = (this_soname, ldir, pkgver)
@@ -1722,7 +1722,7 @@ python package_do_shlibs() {
1722 out, err = p.communicate() 1722 out, err = p.communicate()
1723 # process the output, grabbing all .dll names 1723 # process the output, grabbing all .dll names
1724 if p.returncode == 0: 1724 if p.returncode == 0:
1725 for m in re.finditer("DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE): 1725 for m in re.finditer(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE):
1726 dllname = m.group(1) 1726 dllname = m.group(1)
1727 if dllname: 1727 if dllname:
1728 needed[pkg].add((dllname, file, tuple())) 1728 needed[pkg].add((dllname, file, tuple()))
@@ -1883,9 +1883,9 @@ python package_do_pkgconfig () {
1883 shlibs_dirs = d.getVar('SHLIBSDIRS').split() 1883 shlibs_dirs = d.getVar('SHLIBSDIRS').split()
1884 shlibswork_dir = d.getVar('SHLIBSWORKDIR') 1884 shlibswork_dir = d.getVar('SHLIBSWORKDIR')
1885 1885
1886 pc_re = re.compile('(.*)\.pc$') 1886 pc_re = re.compile(r'(.*)\.pc$')
1887 var_re = re.compile('(.*)=(.*)') 1887 var_re = re.compile(r'(.*)=(.*)')
1888 field_re = re.compile('(.*): (.*)') 1888 field_re = re.compile(r'(.*): (.*)')
1889 1889
1890 pkgconfig_provided = {} 1890 pkgconfig_provided = {}
1891 pkgconfig_needed = {} 1891 pkgconfig_needed = {}
@@ -1933,7 +1933,7 @@ python package_do_pkgconfig () {
1933 if not os.path.exists(dir): 1933 if not os.path.exists(dir):
1934 continue 1934 continue
1935 for file in os.listdir(dir): 1935 for file in os.listdir(dir):
1936 m = re.match('^(.*)\.pclist$', file) 1936 m = re.match(r'^(.*)\.pclist$', file)
1937 if m: 1937 if m:
1938 pkg = m.group(1) 1938 pkg = m.group(1)
1939 fd = open(os.path.join(dir, file)) 1939 fd = open(os.path.join(dir, file))