summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-14 15:50:51 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-16 15:35:07 +0000
commite5455662a9762fc2cb8859134d855413d84fd265 (patch)
treead7c3c6b258415ab9b92ed4b04a1ce0c2f6c9eb7 /bitbake/lib/bb/fetch2
parentca4a8eea6284aad41ec67b375c2a7c7855b5fe11 (diff)
downloadpoky-e5455662a9762fc2cb8859134d855413d84fd265.tar.gz
bitbake: bitbake: 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. (Bitbake rev: c1fcc46e2498ddd41425d8756754f814d682aba3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2')
-rw-r--r--bitbake/lib/bb/fetch2/git.py4
-rw-r--r--bitbake/lib/bb/fetch2/wget.py24
2 files changed, 14 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 59a2ee8f80..c3c089233b 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -615,7 +615,7 @@ class Git(FetchMethod):
615 """ 615 """
616 pupver = ('', '') 616 pupver = ('', '')
617 617
618 tagregex = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or "(?P<pver>([0-9][\.|_]?)+)") 618 tagregex = re.compile(d.getVar('UPSTREAM_CHECK_GITTAGREGEX') or r"(?P<pver>([0-9][\.|_]?)+)")
619 try: 619 try:
620 output = self._lsremote(ud, d, "refs/tags/*") 620 output = self._lsremote(ud, d, "refs/tags/*")
621 except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e: 621 except (bb.fetch2.FetchError, bb.fetch2.NetworkAccess) as e:
@@ -630,7 +630,7 @@ class Git(FetchMethod):
630 630
631 tag_head = line.split("/")[-1] 631 tag_head = line.split("/")[-1]
632 # Ignore non-released branches 632 # Ignore non-released branches
633 m = re.search("(alpha|beta|rc|final)+", tag_head) 633 m = re.search(r"(alpha|beta|rc|final)+", tag_head)
634 if m: 634 if m:
635 continue 635 continue
636 636
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 1237e56098..e2037511da 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -481,7 +481,7 @@ class Wget(FetchMethod):
481 version_dir = ['', '', ''] 481 version_dir = ['', '', '']
482 version = ['', '', ''] 482 version = ['', '', '']
483 483
484 dirver_regex = re.compile("(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])+(\d+))") 484 dirver_regex = re.compile(r"(?P<pfx>\D*)(?P<ver>(\d+[\.\-_])+(\d+))")
485 s = dirver_regex.search(dirver) 485 s = dirver_regex.search(dirver)
486 if s: 486 if s:
487 version_dir[1] = s.group('ver') 487 version_dir[1] = s.group('ver')
@@ -541,26 +541,26 @@ class Wget(FetchMethod):
541 gst-fluendo-mp3 541 gst-fluendo-mp3
542 """ 542 """
543 # match most patterns which uses "-" as separator to version digits 543 # match most patterns which uses "-" as separator to version digits
544 pn_prefix1 = "[a-zA-Z][a-zA-Z0-9]*([-_][a-zA-Z]\w+)*\+?[-_]" 544 pn_prefix1 = r"[a-zA-Z][a-zA-Z0-9]*([-_][a-zA-Z]\w+)*\+?[-_]"
545 # a loose pattern such as for unzip552.tar.gz 545 # a loose pattern such as for unzip552.tar.gz
546 pn_prefix2 = "[a-zA-Z]+" 546 pn_prefix2 = r"[a-zA-Z]+"
547 # a loose pattern such as for 80325-quicky-0.4.tar.gz 547 # a loose pattern such as for 80325-quicky-0.4.tar.gz
548 pn_prefix3 = "[0-9]+[-]?[a-zA-Z]+" 548 pn_prefix3 = r"[0-9]+[-]?[a-zA-Z]+"
549 # Save the Package Name (pn) Regex for use later 549 # Save the Package Name (pn) Regex for use later
550 pn_regex = "(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3) 550 pn_regex = r"(%s|%s|%s)" % (pn_prefix1, pn_prefix2, pn_prefix3)
551 551
552 # match version 552 # match version
553 pver_regex = "(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)" 553 pver_regex = r"(([A-Z]*\d+[a-zA-Z]*[\.\-_]*)+)"
554 554
555 # match arch 555 # match arch
556 parch_regex = "-source|_all_" 556 parch_regex = "-source|_all_"
557 557
558 # src.rpm extension was added only for rpm package. Can be removed if the rpm 558 # src.rpm extension was added only for rpm package. Can be removed if the rpm
559 # packaged will always be considered as having to be manually upgraded 559 # packaged will always be considered as having to be manually upgraded
560 psuffix_regex = "(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)" 560 psuffix_regex = r"(tar\.gz|tgz|tar\.bz2|zip|xz|tar\.lz|rpm|bz2|orig\.tar\.gz|tar\.xz|src\.tar\.gz|src\.tgz|svnr\d+\.tar\.bz2|stable\.tar\.gz|src\.rpm)"
561 561
562 # match name, version and archive type of a package 562 # match name, version and archive type of a package
563 package_regex_comp = re.compile("(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)" 563 package_regex_comp = re.compile(r"(?P<name>%s?\.?v?)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s$)"
564 % (pn_regex, pver_regex, parch_regex, psuffix_regex)) 564 % (pn_regex, pver_regex, parch_regex, psuffix_regex))
565 self.suffix_regex_comp = re.compile(psuffix_regex) 565 self.suffix_regex_comp = re.compile(psuffix_regex)
566 566
@@ -572,7 +572,7 @@ class Wget(FetchMethod):
572 version = self._parse_path(package_regex_comp, package) 572 version = self._parse_path(package_regex_comp, package)
573 if version: 573 if version:
574 package_custom_regex_comp = re.compile( 574 package_custom_regex_comp = re.compile(
575 "(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s)" % 575 r"(?P<name>%s)(?P<pver>%s)(?P<arch>%s)?[\.-](?P<type>%s)" %
576 (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex)) 576 (re.escape(version[0]), pver_regex, parch_regex, psuffix_regex))
577 else: 577 else:
578 package_custom_regex_comp = None 578 package_custom_regex_comp = None
@@ -589,7 +589,7 @@ class Wget(FetchMethod):
589 current_version = ['', d.getVar('PV'), ''] 589 current_version = ['', d.getVar('PV'), '']
590 590
591 """possible to have no version in pkg name, such as spectrum-fw""" 591 """possible to have no version in pkg name, such as spectrum-fw"""
592 if not re.search("\d+", package): 592 if not re.search(r"\d+", package):
593 current_version[1] = re.sub('_', '.', current_version[1]) 593 current_version[1] = re.sub('_', '.', current_version[1])
594 current_version[1] = re.sub('-', '.', current_version[1]) 594 current_version[1] = re.sub('-', '.', current_version[1])
595 return (current_version[1], '') 595 return (current_version[1], '')
@@ -607,13 +607,13 @@ class Wget(FetchMethod):
607 607
608 # search for version matches on folders inside the path, like: 608 # search for version matches on folders inside the path, like:
609 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz 609 # "5.7" in http://download.gnome.org/sources/${PN}/5.7/${PN}-${PV}.tar.gz
610 dirver_regex = re.compile("(?P<dirver>[^/]*(\d+\.)*\d+([-_]r\d+)*)/") 610 dirver_regex = re.compile(r"(?P<dirver>[^/]*(\d+\.)*\d+([-_]r\d+)*)/")
611 m = dirver_regex.search(path) 611 m = dirver_regex.search(path)
612 if m: 612 if m:
613 pn = d.getVar('PN') 613 pn = d.getVar('PN')
614 dirver = m.group('dirver') 614 dirver = m.group('dirver')
615 615
616 dirver_pn_regex = re.compile("%s\d?" % (re.escape(pn))) 616 dirver_pn_regex = re.compile(r"%s\d?" % (re.escape(pn)))
617 if not dirver_pn_regex.search(dirver): 617 if not dirver_pn_regex.search(dirver):
618 return (self._check_latest_version_by_dir(dirver, 618 return (self._check_latest_version_by_dir(dirver,
619 package, package_regex, current_version, ud, d), '') 619 package, package_regex, current_version, ud, d), '')