diff --git a/classes/base.bbclass b/classes/base.bbclass
index c8ee722..769cf2d 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -61,11 +61,15 @@ def base_chk_file_vars(parser, localpath, params, data):
name = params["name"]
except KeyError:
return False
- flagName = "%s.md5sum" % name
- want_md5sum = bb.data.getVarFlag("SRC_URI", flagName, data)
- flagName = "%s.sha256sum" % name
- want_sha256sum = bb.data.getVarFlag("SRC_URI", flagName, data)
-
+ if name:
+ md5flag = "%s.md5sum" % name
+ sha256flag = "%s.sha256sum" % name
+ else:
+ md5flag = "md5sum"
+ sha256flag = "sha256sum"
+ want_md5sum = bb.data.getVarFlag("SRC_URI", md5flag, data)
+ want_sha256sum = bb.data.getVarFlag("SRC_URI", sha256flag, data)
+ bb.note("sha=%s, md5=%s" % (want_md5sum, want_sha256sum))
if (want_sha256sum == None and want_md5sum == None):
# no checksums to check, nothing to do
return False
@@ -702,12 +706,21 @@ python base_do_fetch() {
pn = bb.data.getVar('PN', d, True)
# Check each URI
+ uri_num = 0
for url in src_uri.split():
localpath = bb.data.expand(bb.fetch.localpath(url, localdata), localdata)
(type,host,path,_,_,params) = bb.decodeurl(url)
uri = "%s://%s%s" % (type,host,path)
try:
if type in [ "http", "https", "ftp", "ftps" ]:
+ # We provide a default shortcut of plain [] for the first fetch uri
+ # and default to uri%d for subsequent fetch uris.
+ # Explicit names in any uri overrides this default.
+ if not "name" in params:
+ if uri_num:
+ params["name"] = "uri%d" % uri_num
+ else:
+ params["name"] = ""
if not (base_chk_file_vars(parser, localpath, params, d) or base_chk_file(parser, pn, pv,uri, localpath, d)):
if not bb.data.getVar("OE_ALLOW_INSECURE_DOWNLOADS", d, True):
bb.fatal("%s-%s: %s has no checksum defined, cannot check archive integrity" % (pn,pv,uri))
@@ -715,6 +728,7 @@ python base_do_fetch() {
bb.note("%s-%s: %s has no checksum defined, archive integrity not checked" % (pn,pv,uri))
except Exception:
raise bb.build.FuncFailed("Checksum of '%s' failed" % uri)
+ uri_num += 1
}
addtask fetchall after do_fetch
diff --git a/docs/usermanual/reference/var_src_uri.xml b/docs/usermanual/reference/var_src_uri.xml
index a35e1ee..132bce8 100644
--- a/docs/usermanual/reference/var_src_uri.xml
+++ b/docs/usermanual/reference/var_src_uri.xml
@@ -29,7 +29,16 @@
be used in preference to retrieving a new version . Any source that is
retrieved from a remote URI will be stored in the download source directory
and an appropriate md5 sum generated and stored alongside it.
-
+ Checksums for http/https/ftp/ftps uris are stored in each recipe in
+ the form ofSRC_URI[md5sum] = "9a7a11ffd52d9c4553ea8c0134a6fa86"
+SRC_URI[sha256sum] = "36bdb85c97b39ac604bc58cb7857ee08295242c78a12848ef8a31701921b9434"
+ for the first remote SRC_URI that has no explicit name=foo
+ associated with it. Following unnamed SRC_URIs default to
+SRC_URI[uri1.md5sum] =
+SRC_URI[uri1.sha256sum] =
+SRC_URI[uri2.md5sum] =
+SRC_URI[uri2.sha256sum] =
+ etc.
Each URI supports a set of additional options. These options are
tag/value pairs of the form "a=b" and are semi-colon
separated from each other and from the URI. The follow examples shows two
@@ -38,7 +47,7 @@
- http, https, ftps
+ http, https, ftp, ftps
Used to download files and source code via the specified URL.
@@ -164,6 +173,7 @@
md5sum
+ DEPRECATED
If an md5sum is provided then the downloaded files will only
be considered valid if the md5sum of the downloaded file matches the
md5sum option provided.