summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2012-05-30 17:17:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-30 17:23:32 +0100
commit43551f513da4c6dc81043099f9e8aa0211eefd8e (patch)
tree649adaa70acadd48d8bada92f2c5d217b87006ed /bitbake
parentbb81db6f619b1b17661e0f0a637988a6225b40a6 (diff)
downloadpoky-43551f513da4c6dc81043099f9e8aa0211eefd8e.tar.gz
lib/bb/fetch2: ignore remote URIs when doing file checksums
Skip evaluating remote URIs when doing local file checksums, because we don't need to process them and doing so will trigger a parse failure if SRCREV is not fully specified. Whilst this is just delaying a check until runtime (when do_fetch runs for the recipe) we're only validating this here accidentally and if we did wish to check it during parsing it ought to be done explicitly. Fixes [YOCTO #2512] (Bitbake rev: 99feb77c2de707f2d825566cf48371c48f450e3e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 6ae69cd4ab..83050e4c1f 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -112,6 +112,9 @@ class NetworkAccess(BBFetchException):
112 BBFetchException.__init__(self, msg) 112 BBFetchException.__init__(self, msg)
113 self.args = (url, cmd) 113 self.args = (url, cmd)
114 114
115class NonLocalMethod(Exception):
116 def __init__(self):
117 Exception.__init__(self)
115 118
116def decodeurl(url): 119def decodeurl(url):
117 """Decodes an URL into the tokens (scheme, network location, path, 120 """Decodes an URL into the tokens (scheme, network location, path,
@@ -565,17 +568,17 @@ def srcrev_internal_helper(ud, d, name):
565def get_checksum_file_list(d): 568def get_checksum_file_list(d):
566 """ Get a list of files checksum in SRC_URI 569 """ Get a list of files checksum in SRC_URI
567 570
568 Returns the all resolved local path of all local file entries in 571 Returns the resolved local paths of all local file entries in
569 SRC_URI as a space-separated string 572 SRC_URI as a space-separated string
570 """ 573 """
571 fetch = Fetch([], d) 574 fetch = Fetch([], d, cache = False, localonly = True)
572 575
573 dl_dir = d.getVar('DL_DIR', True) 576 dl_dir = d.getVar('DL_DIR', True)
574 filelist = [] 577 filelist = []
575 for u in fetch.urls: 578 for u in fetch.urls:
576 ud = fetch.ud[u] 579 ud = fetch.ud[u]
577 580
578 if isinstance(ud.method, local.Local): 581 if ud and isinstance(ud.method, local.Local):
579 ud.setup_localpath(d) 582 ud.setup_localpath(d)
580 f = ud.localpath 583 f = ud.localpath
581 if f.startswith(dl_dir): 584 if f.startswith(dl_dir):
@@ -639,7 +642,7 @@ class FetchData(object):
639 """ 642 """
640 A class which represents the fetcher state for a given URI. 643 A class which represents the fetcher state for a given URI.
641 """ 644 """
642 def __init__(self, url, d): 645 def __init__(self, url, d, localonly = False):
643 # localpath is the location of a downloaded result. If not set, the file is local. 646 # localpath is the location of a downloaded result. If not set, the file is local.
644 self.donestamp = None 647 self.donestamp = None
645 self.localfile = "" 648 self.localfile = ""
@@ -686,6 +689,9 @@ class FetchData(object):
686 if not self.method: 689 if not self.method:
687 raise NoMethodError(url) 690 raise NoMethodError(url)
688 691
692 if localonly and not isinstance(self.method, local.Local):
693 raise NonLocalMethod()
694
689 if hasattr(self.method, "urldata_init"): 695 if hasattr(self.method, "urldata_init"):
690 self.method.urldata_init(self, d) 696 self.method.urldata_init(self, d)
691 697
@@ -1009,7 +1015,10 @@ class FetchMethod(object):
1009 return "%s-%s" % (key, d.getVar("PN", True) or "") 1015 return "%s-%s" % (key, d.getVar("PN", True) or "")
1010 1016
1011class Fetch(object): 1017class Fetch(object):
1012 def __init__(self, urls, d, cache = True): 1018 def __init__(self, urls, d, cache = True, localonly = False):
1019 if localonly and cache:
1020 raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time")
1021
1013 if len(urls) == 0: 1022 if len(urls) == 0:
1014 urls = d.getVar("SRC_URI", True).split() 1023 urls = d.getVar("SRC_URI", True).split()
1015 self.urls = urls 1024 self.urls = urls
@@ -1022,7 +1031,12 @@ class Fetch(object):
1022 1031
1023 for url in urls: 1032 for url in urls:
1024 if url not in self.ud: 1033 if url not in self.ud:
1025 self.ud[url] = FetchData(url, d) 1034 try:
1035 self.ud[url] = FetchData(url, d, localonly)
1036 except NonLocalMethod:
1037 if localonly:
1038 self.ud[url] = None
1039 pass
1026 1040
1027 if cache: 1041 if cache:
1028 urldata_cache[fn] = self.ud 1042 urldata_cache[fn] = self.ud