diff options
author | Richard Purdie <rpurdie@rpsys.net> | 2009-10-17 19:02:09 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2009-10-17 19:22:52 +0100 |
commit | 6252c7d5c1c7123d16fc3c7db2edc6751420f12c (patch) | |
tree | a906dd23c74dd626152ac097a0e18c184b7da69d /lib/bb/fetch/__init__.py | |
parent | c4b18ff5e26e4f52336fe1fc5a0e215e4d4d9aaa (diff) | |
download | bitbake-6252c7d5c1c7123d16fc3c7db2edc6751420f12c.tar.gz |
Add a compare-versions command which returns whether the SRCREV versions have changed since bitbake was last run (from Poky)
Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'lib/bb/fetch/__init__.py')
-rw-r--r-- | lib/bb/fetch/__init__.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py index df4eb961f..a9a47fcde 100644 --- a/lib/bb/fetch/__init__.py +++ b/lib/bb/fetch/__init__.py @@ -78,6 +78,7 @@ def uri_replace(uri, uri_find, uri_replace, d): methods = [] urldata_cache = {} +saved_headrevs = {} def fetcher_init(d): """ @@ -91,6 +92,10 @@ def fetcher_init(d): 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) + try: + bb.fetch.saved_headrevs = pd.getKeyValues("BB_URI_HEADREVS") + except: + pass pd.delDomain("BB_URI_HEADREVS") else: bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) @@ -98,6 +103,26 @@ def fetcher_init(d): pd.addDomain("BB_URI_HEADREVS") pd.addDomain("BB_URI_LOCALCOUNT") +def fetcher_compare_revisons(d): + """ + Compare the revisions in the persistant cache with current values and + return true/false on whether they've changed. + """ + + pd = persist_data.PersistData(d) + data = pd.getKeyValues("BB_URI_HEADREVS") + data2 = bb.fetch.saved_headrevs + + changed = False + for key in data: + if key not in data2 or data2[key] != data[key]: + bb.msg.debug(1, bb.msg.domain.Fetcher, "%s changed" % key) + changed = True + return True + else: + bb.msg.debug(2, bb.msg.domain.Fetcher, "%s did not change" % key) + return False + # Function call order is usually: # 1. init # 2. go |