summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py22
-rw-r--r--bitbake/lib/bb/fetch2/git.py3
-rw-r--r--bitbake/lib/bb/fetch2/ssh.py3
-rw-r--r--bitbake/lib/bb/fetch2/wget.py3
4 files changed, 30 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index f629c01cdb..98645956fb 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -271,10 +271,13 @@ def verify_checksum(u, ud, d):
271 matched 271 matched
272 """ 272 """
273 273
274 if not ud.method.supports_checksum(ud):
275 return
276
274 md5data = bb.utils.md5_file(ud.localpath) 277 md5data = bb.utils.md5_file(ud.localpath)
275 sha256data = bb.utils.sha256_file(ud.localpath) 278 sha256data = bb.utils.sha256_file(ud.localpath)
276 279
277 if ud.type in ["http", "https", "ftp", "ftps"]: 280 if ud.method.recommends_checksum(ud):
278 # If strict checking enabled and neither sum defined, raise error 281 # If strict checking enabled and neither sum defined, raise error
279 strict = d.getVar("BB_STRICT_CHECKSUM", True) or None 282 strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
280 if (strict and ud.md5_expected == None and ud.sha256_expected == None): 283 if (strict and ud.md5_expected == None and ud.sha256_expected == None):
@@ -578,10 +581,14 @@ class FetchData(object):
578 self.sha256_name = "sha256sum" 581 self.sha256_name = "sha256sum"
579 if self.md5_name in self.parm: 582 if self.md5_name in self.parm:
580 self.md5_expected = self.parm[self.md5_name] 583 self.md5_expected = self.parm[self.md5_name]
584 elif self.type not in ["http", "https", "ftp", "ftps"]:
585 self.md5_expected = None
581 else: 586 else:
582 self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name) 587 self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name)
583 if self.sha256_name in self.parm: 588 if self.sha256_name in self.parm:
584 self.sha256_expected = self.parm[self.sha256_name] 589 self.sha256_expected = self.parm[self.sha256_name]
590 elif self.type not in ["http", "https", "ftp", "ftps"]:
591 self.sha256_expected = None
585 else: 592 else:
586 self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name) 593 self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name)
587 594
@@ -660,6 +667,19 @@ class FetchMethod(object):
660 """ 667 """
661 return os.path.join(data.getVar("DL_DIR", d, True), urldata.localfile) 668 return os.path.join(data.getVar("DL_DIR", d, True), urldata.localfile)
662 669
670 def supports_checksum(self, urldata):
671 """
672 Is localpath something that can be represented by a checksum?
673 """
674 return True
675
676 def recommends_checksum(self, urldata):
677 """
678 Is the backend on where checksumming is recommended (should warnings
679 by displayed if there is no checksum)?
680 """
681 return False
682
663 def _strip_leading_slashes(self, relpath): 683 def _strip_leading_slashes(self, relpath):
664 """ 684 """
665 Remove leading slash as os.path.join can't cope 685 Remove leading slash as os.path.join can't cope
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 962cc0a484..ecc5e0ded8 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -82,6 +82,9 @@ class Git(FetchMethod):
82 """ 82 """
83 return ud.type in ['git'] 83 return ud.type in ['git']
84 84
85 def supports_checksum(self, urldata):
86 return False
87
85 def urldata_init(self, ud, d): 88 def urldata_init(self, ud, d):
86 """ 89 """
87 init git specific variable within url data 90 init git specific variable within url data
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py
index 91ac15faae..8d6434a7eb 100644
--- a/bitbake/lib/bb/fetch2/ssh.py
+++ b/bitbake/lib/bb/fetch2/ssh.py
@@ -69,6 +69,9 @@ class SSH(FetchMethod):
69 def supports(self, url, urldata, d): 69 def supports(self, url, urldata, d):
70 return __pattern__.match(url) != None 70 return __pattern__.match(url) != None
71 71
72 def supports_checksum(self, urldata):
73 return False
74
72 def localpath(self, url, urldata, d): 75 def localpath(self, url, urldata, d):
73 m = __pattern__.match(urldata.url) 76 m = __pattern__.match(urldata.url)
74 path = m.group('path') 77 path = m.group('path')
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 98900ac42c..e223b21b96 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -45,6 +45,9 @@ class Wget(FetchMethod):
45 """ 45 """
46 return ud.type in ['http', 'https', 'ftp'] 46 return ud.type in ['http', 'https', 'ftp']
47 47
48 def recommends_checksum(self, urldata):
49 return True
50
48 def urldata_init(self, ud, d): 51 def urldata_init(self, ud, d):
49 52
50 ud.basename = os.path.basename(ud.path) 53 ud.basename = os.path.basename(ud.path)