mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 12:49:34 +02:00
Update persist_data usage to the new API
(Bitbake rev: 9723a1c474b72b096c5a3136bf446ed69f3a749e) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
478677fb62
commit
e9f4ed0173
@@ -150,7 +150,7 @@ def fetcher_init(d):
|
|||||||
Called to initialize the fetchers once the configuration data is known.
|
Called to initialize the fetchers once the configuration data is known.
|
||||||
Calls before this must not hit the cache.
|
Calls before this must not hit the cache.
|
||||||
"""
|
"""
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.persist(d)
|
||||||
# When to drop SCM head revisions controlled by user policy
|
# When to drop SCM head revisions controlled by user policy
|
||||||
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
|
srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
|
||||||
if srcrev_policy == "cache":
|
if srcrev_policy == "cache":
|
||||||
@@ -158,10 +158,10 @@ def fetcher_init(d):
|
|||||||
elif srcrev_policy == "clear":
|
elif srcrev_policy == "clear":
|
||||||
logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
|
logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
|
||||||
try:
|
try:
|
||||||
bb.fetch.saved_headrevs = pd.getKeyValues("BB_URI_HEADREVS")
|
bb.fetch.saved_headrevs = pd['BB_URI_HEADREVS'].items()
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
pd.delDomain("BB_URI_HEADREVS")
|
del pd['BB_URI_HEADREVS']
|
||||||
else:
|
else:
|
||||||
raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy)
|
raise FetchError("Invalid SRCREV cache policy of: %s" % srcrev_policy)
|
||||||
|
|
||||||
@@ -169,18 +169,14 @@ def fetcher_init(d):
|
|||||||
if hasattr(m, "init"):
|
if hasattr(m, "init"):
|
||||||
m.init(d)
|
m.init(d)
|
||||||
|
|
||||||
# Make sure our domains exist
|
|
||||||
pd.addDomain("BB_URI_HEADREVS")
|
|
||||||
pd.addDomain("BB_URI_LOCALCOUNT")
|
|
||||||
|
|
||||||
def fetcher_compare_revisions(d):
|
def fetcher_compare_revisions(d):
|
||||||
"""
|
"""
|
||||||
Compare the revisions in the persistant cache with current values and
|
Compare the revisions in the persistant cache with current values and
|
||||||
return true/false on whether they've changed.
|
return true/false on whether they've changed.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.persist(d)
|
||||||
data = pd.getKeyValues("BB_URI_HEADREVS")
|
data = pd['BB_URI_HEADREVS'].items()
|
||||||
data2 = bb.fetch.saved_headrevs
|
data2 = bb.fetch.saved_headrevs
|
||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
@@ -757,14 +753,14 @@ class Fetch(object):
|
|||||||
if not hasattr(self, "_latest_revision"):
|
if not hasattr(self, "_latest_revision"):
|
||||||
raise ParameterError
|
raise ParameterError
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.persist(d)
|
||||||
|
revs = pd['BB_URI_HEADREVS']
|
||||||
key = self.generate_revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
rev = pd.getValue("BB_URI_HEADREVS", key)
|
rev = revs[key]
|
||||||
if rev != None:
|
if rev != None:
|
||||||
return str(rev)
|
return str(rev)
|
||||||
|
|
||||||
rev = self._latest_revision(url, ud, d)
|
revs[key] = rev = self._latest_revision(url, ud, d)
|
||||||
pd.setValue("BB_URI_HEADREVS", key, rev)
|
|
||||||
return rev
|
return rev
|
||||||
|
|
||||||
def sortable_revision(self, url, ud, d):
|
def sortable_revision(self, url, ud, d):
|
||||||
@@ -774,17 +770,18 @@ class Fetch(object):
|
|||||||
if hasattr(self, "_sortable_revision"):
|
if hasattr(self, "_sortable_revision"):
|
||||||
return self._sortable_revision(url, ud, d)
|
return self._sortable_revision(url, ud, d)
|
||||||
|
|
||||||
pd = persist_data.PersistData(d)
|
pd = persist_data.persist(d)
|
||||||
|
localcounts = pd['BB_URI_LOCALCOUNT']
|
||||||
key = self.generate_revision_key(url, ud, d)
|
key = self.generate_revision_key(url, ud, d)
|
||||||
|
|
||||||
latest_rev = self._build_revision(url, ud, d)
|
latest_rev = self._build_revision(url, ud, d)
|
||||||
last_rev = pd.getValue("BB_URI_LOCALCOUNT", key + "_rev")
|
last_rev = localcounts[key + '_rev']
|
||||||
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
|
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
|
||||||
count = None
|
count = None
|
||||||
if uselocalcount:
|
if uselocalcount:
|
||||||
count = Fetch.localcount_internal_helper(ud, d)
|
count = Fetch.localcount_internal_helper(ud, d)
|
||||||
if count is None:
|
if count is None:
|
||||||
count = pd.getValue("BB_URI_LOCALCOUNT", key + "_count")
|
count = localcounts[key + '_count']
|
||||||
|
|
||||||
if last_rev == latest_rev:
|
if last_rev == latest_rev:
|
||||||
return str(count + "+" + latest_rev)
|
return str(count + "+" + latest_rev)
|
||||||
@@ -800,8 +797,8 @@ class Fetch(object):
|
|||||||
else:
|
else:
|
||||||
count = str(int(count) + 1)
|
count = str(int(count) + 1)
|
||||||
|
|
||||||
pd.setValue("BB_URI_LOCALCOUNT", key + "_rev", latest_rev)
|
localcounts[key + '_rev'] = latest_rev
|
||||||
pd.setValue("BB_URI_LOCALCOUNT", key + "_count", count)
|
localcounts[key + '_count'] = count
|
||||||
|
|
||||||
return str(count + "+" + latest_rev)
|
return str(count + "+" + latest_rev)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user