From 7fc020aa15d918b215575576d91160afae7f4d70 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Mon, 4 Apr 2011 09:36:10 -0700 Subject: persist_data: raise KeyError on missing elements (Bitbake rev: a4f62433845c29f98c6a9746d5d2847bf9506ea5) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bitbake/lib/bb/fetch2') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index ca0197e220..a31e26bf75 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -806,12 +806,11 @@ class FetchMethod(object): pd = persist_data.persist(d) revs = pd['BB_URI_HEADREVS'] key = self.generate_revision_key(url, ud, d, name) - rev = revs[key] - if rev != None: - return str(rev) - - revs[key] = rev = self._latest_revision(url, ud, d, name) - return rev + try: + return revs[key] + except KeyError: + revs[key] = rev = self._latest_revision(url, ud, d, name) + return rev def sortable_revision(self, url, ud, d, name): """ @@ -825,13 +824,13 @@ class FetchMethod(object): key = self.generate_revision_key(url, ud, d, name) latest_rev = self._build_revision(url, ud, d, name) - last_rev = localcounts[key + '_rev'] + last_rev = localcounts.get(key + '_rev') uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False count = None if uselocalcount: count = FetchMethod.localcount_internal_helper(ud, d, name) if count is None: - count = localcounts[key + '_count'] or "0" + count = localcounts.get(key + '_count') or "0" if last_rev == latest_rev: return str(count + "+" + latest_rev) -- cgit v1.2.3-54-g00ecf