diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2012-05-30 17:17:17 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-05-30 17:23:32 +0100 |
commit | 97b227a7a53b8fcb8bfa963debb9482c15d3d908 (patch) | |
tree | 886af4a9060cea32cdb9a9663f4705e01412d3d9 | |
parent | 220269113c39b5fae228eceb1044cdbc6a1102c8 (diff) | |
download | tizen-distro-97b227a7a53b8fcb8bfa963debb9482c15d3d908.tar.gz tizen-distro-97b227a7a53b8fcb8bfa963debb9482c15d3d908.tar.bz2 tizen-distro-97b227a7a53b8fcb8bfa963debb9482c15d3d908.zip |
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>
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 26 |
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): BBFetchException.__init__(self, msg) self.args = (url, cmd) +class NonLocalMethod(Exception): + def __init__(self): + Exception.__init__(self) def decodeurl(url): """Decodes an URL into the tokens (scheme, network location, path, @@ -565,17 +568,17 @@ def srcrev_internal_helper(ud, d, name): def get_checksum_file_list(d): """ Get a list of files checksum in SRC_URI - Returns the all resolved local path of all local file entries in + Returns the resolved local paths of all local file entries in SRC_URI as a space-separated string """ - fetch = Fetch([], d) + fetch = Fetch([], d, cache = False, localonly = True) dl_dir = d.getVar('DL_DIR', True) filelist = [] for u in fetch.urls: ud = fetch.ud[u] - if isinstance(ud.method, local.Local): + if ud and isinstance(ud.method, local.Local): ud.setup_localpath(d) f = ud.localpath if f.startswith(dl_dir): @@ -639,7 +642,7 @@ class FetchData(object): """ A class which represents the fetcher state for a given URI. """ - def __init__(self, url, d): + def __init__(self, url, d, localonly = False): # localpath is the location of a downloaded result. If not set, the file is local. self.donestamp = None self.localfile = "" @@ -686,6 +689,9 @@ class FetchData(object): if not self.method: raise NoMethodError(url) + if localonly and not isinstance(self.method, local.Local): + raise NonLocalMethod() + if hasattr(self.method, "urldata_init"): self.method.urldata_init(self, d) @@ -1009,7 +1015,10 @@ class FetchMethod(object): return "%s-%s" % (key, d.getVar("PN", True) or "") class Fetch(object): - def __init__(self, urls, d, cache = True): + def __init__(self, urls, d, cache = True, localonly = False): + if localonly and cache: + raise Exception("bb.fetch2.Fetch.__init__: cannot set cache and localonly at same time") + if len(urls) == 0: urls = d.getVar("SRC_URI", True).split() self.urls = urls @@ -1022,7 +1031,12 @@ class Fetch(object): for url in urls: if url not in self.ud: - self.ud[url] = FetchData(url, d) + try: + self.ud[url] = FetchData(url, d, localonly) + except NonLocalMethod: + if localonly: + self.ud[url] = None + pass if cache: urldata_cache[fn] = self.ud |