diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-29 14:33:14 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2009-07-29 14:33:14 +0100 |
commit | 64b04685b6fd029f2f70f7017bfd51d26ccb0d11 (patch) | |
tree | 5d525e2b58e5a9b27ea3096a0047770446baaf29 /bitbake-dev/lib | |
parent | 231b5f67844da39949e04ae53557cea04aacffdd (diff) | |
download | poky-64b04685b6fd029f2f70f7017bfd51d26ccb0d11.tar.gz |
bitbake: Add a --revisions-changed commandline option to indicate when floating srcrevs have changed
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake-dev/lib')
-rw-r--r-- | bitbake-dev/lib/bb/command.py | 19 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/cooker.py | 6 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/fetch/__init__.py | 23 | ||||
-rw-r--r-- | bitbake-dev/lib/bb/ui/knotty.py | 3 |
4 files changed, 50 insertions, 1 deletions
diff --git a/bitbake-dev/lib/bb/command.py b/bitbake-dev/lib/bb/command.py index 9226a2772f..e7c3770ffc 100644 --- a/bitbake-dev/lib/bb/command.py +++ b/bitbake-dev/lib/bb/command.py | |||
@@ -233,6 +233,14 @@ class CommandsAsync: | |||
233 | command.finishAsyncCommand() | 233 | command.finishAsyncCommand() |
234 | parseFiles.needcache = True | 234 | parseFiles.needcache = True |
235 | 235 | ||
236 | def compareRevisions(self, command, params): | ||
237 | """ | ||
238 | Parse the .bb files | ||
239 | """ | ||
240 | command.cooker.compareRevisions() | ||
241 | command.finishAsyncCommand() | ||
242 | compareRevisions.needcache = True | ||
243 | |||
236 | # | 244 | # |
237 | # Events | 245 | # Events |
238 | # | 246 | # |
@@ -251,3 +259,14 @@ class CookerCommandFailed(bb.event.Event): | |||
251 | def __init__(self, data, error): | 259 | def __init__(self, data, error): |
252 | bb.event.Event.__init__(self, data) | 260 | bb.event.Event.__init__(self, data) |
253 | self.error = error | 261 | self.error = error |
262 | |||
263 | class CookerCommandSetExitCode(bb.event.Event): | ||
264 | """ | ||
265 | Set the exit code for a cooker command | ||
266 | """ | ||
267 | def __init__(self, data, exitcode): | ||
268 | bb.event.Event.__init__(self, data) | ||
269 | self.exitcode = int(exitcode) | ||
270 | |||
271 | |||
272 | |||
diff --git a/bitbake-dev/lib/bb/cooker.py b/bitbake-dev/lib/bb/cooker.py index bec6c3535c..b2b237b4c7 100644 --- a/bitbake-dev/lib/bb/cooker.py +++ b/bitbake-dev/lib/bb/cooker.py | |||
@@ -147,6 +147,8 @@ class BBCooker: | |||
147 | self.commandlineAction = ["showEnvironment", self.configuration.buildfile] | 147 | self.commandlineAction = ["showEnvironment", self.configuration.buildfile] |
148 | elif self.configuration.buildfile is not None: | 148 | elif self.configuration.buildfile is not None: |
149 | self.commandlineAction = ["buildFile", self.configuration.buildfile, self.configuration.cmd] | 149 | self.commandlineAction = ["buildFile", self.configuration.buildfile, self.configuration.cmd] |
150 | elif self.configuration.revisions_changed: | ||
151 | self.commandlineAction = ["compareRevisions"] | ||
150 | elif self.configuration.show_versions: | 152 | elif self.configuration.show_versions: |
151 | self.commandlineAction = ["showVersions"] | 153 | self.commandlineAction = ["showVersions"] |
152 | elif self.configuration.parse_only: | 154 | elif self.configuration.parse_only: |
@@ -241,6 +243,10 @@ class BBCooker: | |||
241 | 243 | ||
242 | bb.msg.plain("%-35s %25s %25s" % (p, lateststr, prefstr)) | 244 | bb.msg.plain("%-35s %25s %25s" % (p, lateststr, prefstr)) |
243 | 245 | ||
246 | def compareRevisions(self): | ||
247 | ret = bb.fetch.fetcher_compare_revisons(self.configuration.data) | ||
248 | bb.event.fire(bb.command.CookerCommandSetExitCode(self.configuration.event_data, ret)) | ||
249 | |||
244 | def showEnvironment(self, buildfile = None, pkgs_to_build = []): | 250 | def showEnvironment(self, buildfile = None, pkgs_to_build = []): |
245 | """ | 251 | """ |
246 | Show the outer or per-package environment | 252 | Show the outer or per-package environment |
diff --git a/bitbake-dev/lib/bb/fetch/__init__.py b/bitbake-dev/lib/bb/fetch/__init__.py index 39a577b2eb..8ddcd38706 100644 --- a/bitbake-dev/lib/bb/fetch/__init__.py +++ b/bitbake-dev/lib/bb/fetch/__init__.py | |||
@@ -91,13 +91,34 @@ def fetcher_init(d): | |||
91 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy) | 91 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy) |
92 | elif srcrev_policy == "clear": | 92 | elif srcrev_policy == "clear": |
93 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy) | 93 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy) |
94 | pd.delDomain("BB_URI_HEADREVS") | 94 | pd.renameDomain("BB_URI_HEADREVS", "BB_URI_HEADREVS_PREVIOUS") |
95 | else: | 95 | else: |
96 | bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) | 96 | bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) |
97 | # Make sure our domains exist | 97 | # Make sure our domains exist |
98 | pd.addDomain("BB_URI_HEADREVS") | 98 | pd.addDomain("BB_URI_HEADREVS") |
99 | pd.addDomain("BB_URI_HEADREVS_PREVIOUS") | ||
99 | pd.addDomain("BB_URI_LOCALCOUNT") | 100 | pd.addDomain("BB_URI_LOCALCOUNT") |
100 | 101 | ||
102 | def fetcher_compare_revisons(d): | ||
103 | """ | ||
104 | Compare the revisions in the persistant cache with current values and | ||
105 | return true/false on whether they've changed. | ||
106 | """ | ||
107 | |||
108 | pd = persist_data.PersistData(d) | ||
109 | data = pd.getKeyValues("BB_URI_HEADREVS") | ||
110 | data2 = pd.getKeyValues("BB_URI_HEADREVS_PREVIOUS") | ||
111 | |||
112 | changed = False | ||
113 | for key in data: | ||
114 | if key not in data2 or data2[key] != data[key]: | ||
115 | bb.msg.debug(1, bb.msg.domain.Fetcher, "%s changed" % key) | ||
116 | changed = True | ||
117 | return True | ||
118 | else: | ||
119 | bb.msg.debug(2, bb.msg.domain.Fetcher, "%s did not change" % key) | ||
120 | return False | ||
121 | |||
101 | # Function call order is usually: | 122 | # Function call order is usually: |
102 | # 1. init | 123 | # 1. init |
103 | # 2. go | 124 | # 2. go |
diff --git a/bitbake-dev/lib/bb/ui/knotty.py b/bitbake-dev/lib/bb/ui/knotty.py index a334c2977e..031fa71578 100644 --- a/bitbake-dev/lib/bb/ui/knotty.py +++ b/bitbake-dev/lib/bb/ui/knotty.py | |||
@@ -120,6 +120,9 @@ def init(server, eventHandler): | |||
120 | 120 | ||
121 | if event[0] == 'bb.command.CookerCommandCompleted': | 121 | if event[0] == 'bb.command.CookerCommandCompleted': |
122 | break | 122 | break |
123 | if event[0] == 'bb.command.CookerCommandSetExitCode': | ||
124 | return_value = event[1]['exitcode'] | ||
125 | continue | ||
123 | if event[0] == 'bb.command.CookerCommandFailed': | 126 | if event[0] == 'bb.command.CookerCommandFailed': |
124 | return_value = 1 | 127 | return_value = 1 |
125 | print "Command execution failed: %s" % event[1]['error'] | 128 | print "Command execution failed: %s" % event[1]['error'] |