[bitbake-devel] [PATCH 1/1] fetch2/__init__.py: add an "auto" policy for BB_SRCREV_POLICY
Robert Yang
liezhi.yang at windriver.com
Thu Aug 9 08:56:26 UTC 2012
The newly added "auto" policy is used for the SRCREV="${AUTOREV}" recipe,
the current BB_SRCREV_POLICY are: "clear" (default) and "cache":
* When "clear", the "AUTOREV" recipe will not be cached in bb_cache.dat
* When "cache", the "AUTOREV" would be cached in bb_cache.dat, but it
doesn't try to get the latest revision.
The "auto" policy is much like the "cache" except that it will try to
get the latest revision.
[YOCTO #2920]
Signed-off-by: Jason Wessel <jason.wessel at windriver.com>
Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
bitbake/lib/bb/fetch2/__init__.py | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index 12ebce2..27b73c0 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -249,8 +249,8 @@ def fetcher_init(d):
Calls before this must not hit the cache.
"""
# When to drop SCM head revisions controlled by user policy
- srcrev_policy = d.getVar('BB_SRCREV_POLICY', True) or "clear"
- if srcrev_policy == "cache":
+ srcrev_policy = get_srcrev_policy(d)
+ if srcrev_policy == "cache" or srcrev_policy == "auto":
logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy)
elif srcrev_policy == "clear":
logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy)
@@ -384,9 +384,13 @@ def subprocess_setup():
# SIGPIPE errors are known issues with gzip/bash
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
+def get_srcrev_policy(d):
+ return d.getVar('BB_SRCREV_POLICY', True) or "auto"
+
def get_autorev(d):
# only not cache src rev in autorev case
- if d.getVar('BB_SRCREV_POLICY', True) != "cache":
+ srcrev_policy = get_srcrev_policy(d)
+ if srcrev_policy != "cache" and srcrev_policy != "auto":
d.setVar('__BB_DONT_CACHE', '1')
return "AUTOINC"
@@ -1048,6 +1052,8 @@ class FetchMethod(object):
revs = bb.persist_data.persist('BB_URI_HEADREVS', d)
key = self.generate_revision_key(url, ud, d, name)
+ if get_srcrev_policy(d) == "auto":
+ revs[key] = self._latest_revision(url, ud, d, name)
try:
return revs[key]
except KeyError:
--
1.7.1
More information about the bitbake-devel
mailing list