summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
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/lib/oe/package_manager.py
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/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 7ff76c61cd..1087144d47 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -29,7 +29,7 @@ def opkg_query(cmd_output):
29 a dictionary with the information of the packages. This is used 29 a dictionary with the information of the packages. This is used
30 when the packages are in deb or ipk format. 30 when the packages are in deb or ipk format.
31 """ 31 """
32 verregex = re.compile(' \([=<>]* [^ )]*\)') 32 verregex = re.compile(r' \([=<>]* [^ )]*\)')
33 output = dict() 33 output = dict()
34 pkg = "" 34 pkg = ""
35 arch = "" 35 arch = ""
@@ -252,8 +252,8 @@ class DpkgIndexer(Indexer):
252 with open(os.path.join(self.d.expand("${STAGING_ETCDIR_NATIVE}"), 252 with open(os.path.join(self.d.expand("${STAGING_ETCDIR_NATIVE}"),
253 "apt", "apt.conf.sample")) as apt_conf_sample: 253 "apt", "apt.conf.sample")) as apt_conf_sample:
254 for line in apt_conf_sample.read().split("\n"): 254 for line in apt_conf_sample.read().split("\n"):
255 line = re.sub("#ROOTFS#", "/dev/null", line) 255 line = re.sub(r"#ROOTFS#", "/dev/null", line)
256 line = re.sub("#APTCONF#", self.apt_conf_dir, line) 256 line = re.sub(r"#APTCONF#", self.apt_conf_dir, line)
257 apt_conf.write(line + "\n") 257 apt_conf.write(line + "\n")
258 258
259 def write_index(self): 259 def write_index(self):
@@ -408,7 +408,7 @@ class PackageManager(object, metaclass=ABCMeta):
408 with open(postinst_intercept_hook) as intercept: 408 with open(postinst_intercept_hook) as intercept:
409 registered_pkgs = None 409 registered_pkgs = None
410 for line in intercept.read().split("\n"): 410 for line in intercept.read().split("\n"):
411 m = re.match("^##PKGS:(.*)", line) 411 m = re.match(r"^##PKGS:(.*)", line)
412 if m is not None: 412 if m is not None:
413 registered_pkgs = m.group(1).strip() 413 registered_pkgs = m.group(1).strip()
414 break 414 break
@@ -1217,7 +1217,7 @@ class OpkgPM(OpkgDpkgPM):
1217 priority += 5 1217 priority += 5
1218 1218
1219 for line in (self.d.getVar('IPK_FEED_URIS') or "").split(): 1219 for line in (self.d.getVar('IPK_FEED_URIS') or "").split():
1220 feed_match = re.match("^[ \t]*(.*)##([^ \t]*)[ \t]*$", line) 1220 feed_match = re.match(r"^[ \t]*(.*)##([^ \t]*)[ \t]*$", line)
1221 1221
1222 if feed_match is not None: 1222 if feed_match is not None:
1223 feed_name = feed_match.group(1) 1223 feed_name = feed_match.group(1)
@@ -1597,7 +1597,7 @@ class DpkgPM(OpkgDpkgPM):
1597 1597
1598 with open(status_file, "r") as status: 1598 with open(status_file, "r") as status:
1599 for line in status.read().split('\n'): 1599 for line in status.read().split('\n'):
1600 m = re.match("^Package: (.*)", line) 1600 m = re.match(r"^Package: (.*)", line)
1601 if m is not None: 1601 if m is not None:
1602 installed_pkgs.append(m.group(1)) 1602 installed_pkgs.append(m.group(1))
1603 1603
@@ -1662,13 +1662,13 @@ class DpkgPM(OpkgDpkgPM):
1662 # rename *.dpkg-new files/dirs 1662 # rename *.dpkg-new files/dirs
1663 for root, dirs, files in os.walk(self.target_rootfs): 1663 for root, dirs, files in os.walk(self.target_rootfs):
1664 for dir in dirs: 1664 for dir in dirs:
1665 new_dir = re.sub("\.dpkg-new", "", dir) 1665 new_dir = re.sub(r"\.dpkg-new", "", dir)
1666 if dir != new_dir: 1666 if dir != new_dir:
1667 os.rename(os.path.join(root, dir), 1667 os.rename(os.path.join(root, dir),
1668 os.path.join(root, new_dir)) 1668 os.path.join(root, new_dir))
1669 1669
1670 for file in files: 1670 for file in files:
1671 new_file = re.sub("\.dpkg-new", "", file) 1671 new_file = re.sub(r"\.dpkg-new", "", file)
1672 if file != new_file: 1672 if file != new_file:
1673 os.rename(os.path.join(root, file), 1673 os.rename(os.path.join(root, file),
1674 os.path.join(root, new_file)) 1674 os.path.join(root, new_file))
@@ -1733,7 +1733,7 @@ class DpkgPM(OpkgDpkgPM):
1733 sources_file.write("deb %s ./\n" % uri) 1733 sources_file.write("deb %s ./\n" % uri)
1734 1734
1735 def _create_configs(self, archs, base_archs): 1735 def _create_configs(self, archs, base_archs):
1736 base_archs = re.sub("_", "-", base_archs) 1736 base_archs = re.sub(r"_", r"-", base_archs)
1737 1737
1738 if os.path.exists(self.apt_conf_dir): 1738 if os.path.exists(self.apt_conf_dir):
1739 bb.utils.remove(self.apt_conf_dir, True) 1739 bb.utils.remove(self.apt_conf_dir, True)
@@ -1787,7 +1787,7 @@ class DpkgPM(OpkgDpkgPM):
1787 with open(self.apt_conf_file, "w+") as apt_conf: 1787 with open(self.apt_conf_file, "w+") as apt_conf:
1788 with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample: 1788 with open(self.d.expand("${STAGING_ETCDIR_NATIVE}/apt/apt.conf.sample")) as apt_conf_sample:
1789 for line in apt_conf_sample.read().split("\n"): 1789 for line in apt_conf_sample.read().split("\n"):
1790 match_arch = re.match(" Architecture \".*\";$", line) 1790 match_arch = re.match(r" Architecture \".*\";$", line)
1791 architectures = "" 1791 architectures = ""
1792 if match_arch: 1792 if match_arch:
1793 for base_arch in base_arch_list: 1793 for base_arch in base_arch_list:
@@ -1795,8 +1795,8 @@ class DpkgPM(OpkgDpkgPM):
1795 apt_conf.write(" Architectures {%s};\n" % architectures); 1795 apt_conf.write(" Architectures {%s};\n" % architectures);
1796 apt_conf.write(" Architecture \"%s\";\n" % base_archs) 1796 apt_conf.write(" Architecture \"%s\";\n" % base_archs)
1797 else: 1797 else:
1798 line = re.sub("#ROOTFS#", self.target_rootfs, line) 1798 line = re.sub(r"#ROOTFS#", self.target_rootfs, line)
1799 line = re.sub("#APTCONF#", self.apt_conf_dir, line) 1799 line = re.sub(r"#APTCONF#", self.apt_conf_dir, line)
1800 apt_conf.write(line + "\n") 1800 apt_conf.write(line + "\n")
1801 1801
1802 target_dpkg_dir = "%s/var/lib/dpkg" % self.target_rootfs 1802 target_dpkg_dir = "%s/var/lib/dpkg" % self.target_rootfs