[poky] [denzil][PATCH 1/9] bitbake/fetch: Spell out which fetcher backends support and recommend checksums
McClintock Matthew-B29882
B29882 at freescale.com
Mon Jul 30 15:52:15 PDT 2012
On Tue, Jul 3, 2012 at 5:32 PM, Khem Raj <raj.khem at gmail.com> wrote:
> From: Richard Purdie <richard.purdie at linuxfoundation.org>
>
> There were some hardcoded behaviours in the system for which backends
> support checksums verses which backends recommend them verses which
> don't recommend them.
>
> This moves the functionality into specific fetchers and then makes the
> general code generic. This cleans up the codebase and fixes some corner
> cases such as trying to checksum directories returned by the git fetcher.
>
> (Bitbake rev: ef6d268f7b8527541a7fb044cf95a973be4097f4)
>
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
This patch is causing the following issue in the denzil branch of poky:
NOTE: package libpam-1.1.5-r3: task do_fetch: Started
ERROR: Error executing a python function in
/local/home/mattsm/git/poky-upstream/meta/recipes-extended/pam/libpam_1.1.5.bb:
IOError: [Errno 2] No such file or directory:
'/local/home/mattsm/git/poky-upstream/meta/recipes-extended/pam/libpam/./pam.d/*'
ERROR: The stack trace of python calls that resulted in this
exception/failure was:
ERROR: File "base_do_fetch", line 18, in <module>
ERROR:
ERROR: File "base_do_fetch", line 13, in base_do_fetch
ERROR:
ERROR: File "/local/home/mattsm/git/poky-upstream/bitbake/lib/bb/fetch2/__init__.py",
line 1037, in download
ERROR: update_stamp(u, ud, self.d)
ERROR:
ERROR: File "/local/home/mattsm/git/poky-upstream/bitbake/lib/bb/fetch2/__init__.py",
line 335, in update_stamp
ERROR: verify_checksum(u, ud, d)
ERROR:
ERROR: File "/local/home/mattsm/git/poky-upstream/bitbake/lib/bb/fetch2/__init__.py",
line 277, in verify_checksum
ERROR: md5data = bb.utils.md5_file(ud.localpath)
ERROR:
ERROR: File "/local/home/mattsm/git/poky-upstream/bitbake/lib/bb/utils.py",
line 482, in md5_file
ERROR: for line in open(filename):
ERROR:
ERROR: The code that was being executed was:
ERROR: 0014: except bb.fetch2.BBFetchException, e:
ERROR: 0015: raise bb.build.FuncFailed(e)
ERROR: 0016:
ERROR: 0017:
ERROR: *** 0018:base_do_fetch(d)
ERROR: 0019:
ERROR: (file: 'base_do_fetch', lineno: 18, function: <module>)
ERROR: 0009: bb.data.update_data(localdata)
ERROR: 0010:
ERROR: 0011: try:
ERROR: 0012: fetcher = bb.fetch2.Fetch(src_uri, localdata)
ERROR: *** 0013: fetcher.download()
ERROR: 0014: except bb.fetch2.BBFetchException, e:
ERROR: 0015: raise bb.build.FuncFailed(e)
ERROR: 0016:
ERROR: 0017:
ERROR: (file: 'base_do_fetch', lineno: 13, function: base_do_fetch)
ERROR: Function failed: base_do_fetch
ERROR: Logfile of failure stored in:
/local/home/mattsm/git/poky-upstream/build-denzil/tmp/work/ppce5500-poky-linux/libpam-1.1.5-r3/temp/log.do_fetch.9368
NOTE: package libpam-1.1.5-r3: task do_fetch: Failed
ERROR: Task 0 (/local/home/mattsm/git/poky-upstream/meta/recipes-extended/pam/libpam_1.1.5.bb,
do_fetch) failed with exit code '1'
-M
>
> Conflicts:
>
> bitbake/lib/bb/fetch2/__init__.py
>
> Signed-off-by: Khem Raj <kraj at juniper.net>
> ---
> bitbake/lib/bb/fetch2/__init__.py | 56 ++++++++++++++++++++++++-------------
> bitbake/lib/bb/fetch2/git.py | 3 ++
> bitbake/lib/bb/fetch2/ssh.py | 3 ++
> bitbake/lib/bb/fetch2/wget.py | 3 ++
> 4 files changed, 46 insertions(+), 19 deletions(-)
>
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index 414cc2b..ec043a8 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -268,30 +268,31 @@ def verify_checksum(u, ud, d):
> matched
> """
>
> - if not ud.type in ["http", "https", "ftp", "ftps"]:
> + if not ud.method.supports_checksum(ud):
> return
>
> md5data = bb.utils.md5_file(ud.localpath)
> sha256data = bb.utils.sha256_file(ud.localpath)
>
> - # If strict checking enabled and neither sum defined, raise error
> - strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
> - if (strict and ud.md5_expected == None and ud.sha256_expected == None):
> - raise FetchError('No checksum specified for %s, please add at least one to the recipe:\n'
> - 'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
> - (ud.localpath, ud.md5_name, md5data,
> - ud.sha256_name, sha256data), u)
> -
> - # Log missing sums so user can more easily add them
> - if ud.md5_expected == None:
> - logger.warn('Missing md5 SRC_URI checksum for %s, consider adding to the recipe:\n'
> - 'SRC_URI[%s] = "%s"',
> - ud.localpath, ud.md5_name, md5data)
> -
> - if ud.sha256_expected == None:
> - logger.warn('Missing sha256 SRC_URI checksum for %s, consider adding to the recipe:\n'
> - 'SRC_URI[%s] = "%s"',
> - ud.localpath, ud.sha256_name, sha256data)
> + if ud.method.recommends_checksum(ud):
> + # If strict checking enabled and neither sum defined, raise error
> + strict = d.getVar("BB_STRICT_CHECKSUM", True) or None
> + if (strict and ud.md5_expected == None and ud.sha256_expected == None):
> + raise FetchError('No checksum specified for %s, please add at least one to the recipe:\n'
> + 'SRC_URI[%s] = "%s"\nSRC_URI[%s] = "%s"' %
> + (ud.localpath, ud.md5_name, md5data,
> + ud.sha256_name, sha256data), u)
> +
> + # Log missing sums so user can more easily add them
> + if ud.md5_expected == None:
> + logger.warn('Missing md5 SRC_URI checksum for %s, consider adding to the recipe:\n'
> + 'SRC_URI[%s] = "%s"',
> + ud.localpath, ud.md5_name, md5data)
> +
> + if ud.sha256_expected == None:
> + logger.warn('Missing sha256 SRC_URI checksum for %s, consider adding to the recipe:\n'
> + 'SRC_URI[%s] = "%s"',
> + ud.localpath, ud.sha256_name, sha256data)
>
> md5mismatch = False
> sha256mismatch = False
> @@ -574,10 +575,14 @@ class FetchData(object):
> self.sha256_name = "sha256sum"
> if self.md5_name in self.parm:
> self.md5_expected = self.parm[self.md5_name]
> + elif self.type not in ["http", "https", "ftp", "ftps"]:
> + self.md5_expected = None
> else:
> self.md5_expected = d.getVarFlag("SRC_URI", self.md5_name)
> if self.sha256_name in self.parm:
> self.sha256_expected = self.parm[self.sha256_name]
> + elif self.type not in ["http", "https", "ftp", "ftps"]:
> + self.sha256_expected = None
> else:
> self.sha256_expected = d.getVarFlag("SRC_URI", self.sha256_name)
>
> @@ -656,6 +661,19 @@ class FetchMethod(object):
> """
> return os.path.join(data.getVar("DL_DIR", d, True), urldata.localfile)
>
> + def supports_checksum(self, urldata):
> + """
> + Is localpath something that can be represented by a checksum?
> + """
> + return True
> +
> + def recommends_checksum(self, urldata):
> + """
> + Is the backend on where checksumming is recommended (should warnings
> + by displayed if there is no checksum)?
> + """
> + return False
> +
> def _strip_leading_slashes(self, relpath):
> """
> 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 61fdc4b..8cea7dd 100644
> --- a/bitbake/lib/bb/fetch2/git.py
> +++ b/bitbake/lib/bb/fetch2/git.py
> @@ -82,6 +82,9 @@ class Git(FetchMethod):
> """
> return ud.type in ['git']
>
> + def supports_checksum(self, urldata):
> + return False
> +
> def urldata_init(self, ud, d):
> """
> init git specific variable within url data
> diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py
> index 91ac15f..8d6434a 100644
> --- a/bitbake/lib/bb/fetch2/ssh.py
> +++ b/bitbake/lib/bb/fetch2/ssh.py
> @@ -69,6 +69,9 @@ class SSH(FetchMethod):
> def supports(self, url, urldata, d):
> return __pattern__.match(url) != None
>
> + def supports_checksum(self, urldata):
> + return False
> +
> def localpath(self, url, urldata, d):
> m = __pattern__.match(urldata.url)
> path = m.group('path')
> diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
> index d3be069..30a52fa 100644
> --- a/bitbake/lib/bb/fetch2/wget.py
> +++ b/bitbake/lib/bb/fetch2/wget.py
> @@ -45,6 +45,9 @@ class Wget(FetchMethod):
> """
> return ud.type in ['http', 'https', 'ftp']
>
> + def recommends_checksum(self, urldata):
> + return True
> +
> def urldata_init(self, ud, d):
>
> ud.basename = os.path.basename(ud.path)
> --
> 1.7.9.5
>
> _______________________________________________
> poky mailing list
> poky at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/poky
More information about the poky
mailing list