From 483f85802a97cb9ad4d958c29458db91acc7809f Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 3 Nov 2009 23:20:15 +0000 Subject: bitbake: Sync various functions with those from bitbake-dev and bitbake upstream Signed-off-by: Richard Purdie --- bitbake/lib/bb/cache.py | 2 +- bitbake/lib/bb/cooker.py | 2 +- bitbake/lib/bb/event.py | 7 +++++++ bitbake/lib/bb/fetch/__init__.py | 31 +++++++++++++++++------------- bitbake/lib/bb/parse/parse_py/BBHandler.py | 4 +++- bitbake/lib/bb/taskdata.py | 12 ++---------- 6 files changed, 32 insertions(+), 26 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index e91967c032..d30d57d33b 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py @@ -273,7 +273,7 @@ class Cache: for f,old_mtime in depends: fmtime = bb.parse.cached_mtime_noerror(f) # Check if file still exists - if fmtime == 0: + if old_mtime != 0 and fmtime == 0: self.remove(fn) return False diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b0692431bb..230afcb4bc 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -71,7 +71,7 @@ class BBCooker: self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK", self.configuration.data) or "build" bbpkgs = bb.data.getVar('BBPKGS', self.configuration.data, True) - if bbpkgs: + if bbpkgs and len(self.configuration.pkgs_to_build) == 0: self.configuration.pkgs_to_build.extend(bbpkgs.split()) # diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index c0a59e6120..9d7341f878 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -127,6 +127,13 @@ def getName(e): class ConfigParsed(Event): """Configuration Parsing Complete""" +class RecipeParsed(Event): + """ Recipe Parsing Complete """ + + def __init__(self, fn, d): + self.fn = fn + Event.__init__(self, d) + class StampUpdate(Event): """Trigger for any adjustment of the stamp files to happen""" diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 2191c284e3..429822bfa9 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py @@ -485,21 +485,26 @@ class Fetch(object): if pn: src_tarball_stash = (data.getVar('SRC_TARBALL_STASH_%s' % pn, d, True) or data.getVar('CVS_TARBALL_STASH_%s' % pn, d, True) or data.getVar('SRC_TARBALL_STASH', d, True) or data.getVar('CVS_TARBALL_STASH', d, True) or "").split() + ld = d.createCopy() for stash in src_tarball_stash: - fetchcmd = data.getVar("FETCHCOMMAND_mirror", d, True) or data.getVar("FETCHCOMMAND_wget", d, True) - uri = stash + tarfn - bb.msg.note(1, bb.msg.domain.Fetcher, "fetch " + uri) - fetchcmd = fetchcmd.replace("${URI}", uri) - httpproxy = data.getVar("http_proxy", d, True) - ftpproxy = data.getVar("ftp_proxy", d, True) - if httpproxy: - fetchcmd = "http_proxy=" + httpproxy + " " + fetchcmd - if ftpproxy: - fetchcmd = "ftp_proxy=" + ftpproxy + " " + fetchcmd - ret = os.system(fetchcmd) - if ret == 0: - bb.msg.note(1, bb.msg.domain.Fetcher, "Fetched %s from tarball stash, skipping checkout" % tarfn) + url = stash + tarfn + try: + ud = FetchData(url, ld) + except bb.fetch.NoMethodError: + bb.msg.debug(1, bb.msg.domain.Fetcher, "No method for %s" % url) + continue + + ud.setup_localpath(ld) + + try: + ud.method.go(url, ud, ld) return True + except (bb.fetch.MissingParameterError, + bb.fetch.FetchError, + bb.fetch.MD5SumError): + import sys + (type, value, traceback) = sys.exc_info() + bb.msg.debug(2, bb.msg.domain.Fetcher, "Tarball stash fetch failure: %s" % value) return False try_mirror = staticmethod(try_mirror) diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 03976d4d8c..76b917ca5d 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -88,7 +88,7 @@ def finalise(fn, d): from bb import build try: t = data.getVar('T', d) - data.setVar('T', '${TMPDIR}/', d) + data.setVar('T', '${TMPDIR}/anonfunc/', d) anonfuncs = data.getVar('__BBANONFUNCS', d) or [] code = "" for f in anonfuncs: @@ -114,6 +114,8 @@ def finalise(fn, d): tasklist = data.getVar('__BBTASKS', d) or [] bb.build.add_tasks(tasklist, d) + bb.event.fire(bb.event.RecipeParsed(fn, d)) + def handle(fn, d, include = 0): global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ diff --git a/bitbake/lib/bb/taskdata.py b/bitbake/lib/bb/taskdata.py index 64ab032c3c..45f6902ddd 100644 --- a/bitbake/lib/bb/taskdata.py +++ b/bitbake/lib/bb/taskdata.py @@ -374,11 +374,7 @@ class TaskData: all_p = dataCache.providers[item] eligible, foundUnique = bb.providers.filterProviders(all_p, item, cfgData, dataCache) - - for p in eligible: - fnid = self.getfn_id(p) - if fnid in self.failed_fnids: - eligible.remove(p) + eligible = [p for p in eligible if not self.getfn_id(p) in self.failed_fnids] if not eligible: bb.msg.note(2, bb.msg.domain.Provider, "No buildable provider PROVIDES '%s' but '%s' DEPENDS on or otherwise requires it. Enable debugging and see earlier logs to find unbuildable providers." % (item, self.get_dependees_str(item))) @@ -426,11 +422,7 @@ class TaskData: raise bb.providers.NoRProvider(item) eligible, numberPreferred = bb.providers.filterProvidersRunTime(all_p, item, cfgData, dataCache) - - for p in eligible: - fnid = self.getfn_id(p) - if fnid in self.failed_fnids: - eligible.remove(p) + eligible = [p for p in eligible if not self.getfn_id(p) in self.failed_fnids] if not eligible: bb.msg.error(bb.msg.domain.Provider, "'%s' RDEPENDS/RRECOMMENDS or otherwise requires the runtime entity '%s' but it wasn't found in any PACKAGE or RPROVIDES variables of any buildable targets.\nEnable debugging and see earlier logs to find unbuildable targets." % (self.get_rdependees_str(item), item)) -- cgit v1.2.3-54-g00ecf