summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py22
1 files changed, 21 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