fetch/__init__.py: Add BB_SRCREV_POLICY variable (clear or cache) to control SRCREV...
authorRichard Purdie <rpurdie@linux.intel.com>
Sat, 11 Aug 2007 23:11:24 +0000 (23:11 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Sat, 11 Aug 2007 23:11:24 +0000 (23:11 +0000)
ChangeLog
lib/bb/fetch/__init__.py

index c564183..cdf25b2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,7 +12,8 @@ Changes in Bitbake 1.8.x:
        - Add pn-PN to overrides when evaluating PREFERRED_VERSION
        - Improve the progress indicator by skipping tasks that have 
          already run before starting the build rather than during it
-       - Add profiling option (-P)             
+       - Add profiling option (-P)
+       - Add BB_SRCREV_POLICY variable (clear or cache) to control SRCREV cache
 
 Changes in Bitbake 1.8.6:
        - Correctly redirect stdin when forking
index fbd0ba5..f739245 100644 (file)
@@ -88,8 +88,15 @@ def fetcher_init(d):
     Calls before this must not hit the cache.
     """
     pd = persist_data.PersistData(d)
-    # When to drop SCM head revisions should be controled by user policy
-    pd.delDomain("BB_URI_HEADREVS")
+    # When to drop SCM head revisions controled by user policy
+    srcrev_policy = bb.data.getVar('BB_SRCREV_POLICY', d, 1) or "clear"
+    if srcrev_policy == "cache":
+        bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy)
+    elif srcrev_policy == "clear":
+        bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy)
+        pd.delDomain("BB_URI_HEADREVS")
+    else:
+        bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy)
     # Make sure our domains exist
     pd.addDomain("BB_URI_HEADREVS")
     pd.addDomain("BB_URI_LOCALCOUNT")