diff options
| -rwxr-xr-x | bitbake-dev/bin/bitbake | 3 | ||||
| -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 | ||||
| -rwxr-xr-x | bitbake/bin/bitbake | 3 | ||||
| -rw-r--r-- | bitbake/lib/bb/cooker.py | 3 | ||||
| -rw-r--r-- | bitbake/lib/bb/fetch/__init__.py | 23 |
8 files changed, 81 insertions, 2 deletions
diff --git a/bitbake-dev/bin/bitbake b/bitbake-dev/bin/bitbake index f4cd0cb69a..d9aa910422 100755 --- a/bitbake-dev/bin/bitbake +++ b/bitbake-dev/bin/bitbake | |||
| @@ -124,6 +124,9 @@ Default BBFILES are the .bb files in the current directory.""" ) | |||
| 124 | parser.add_option( "-u", "--ui", help = "userinterface to use", | 124 | parser.add_option( "-u", "--ui", help = "userinterface to use", |
| 125 | action = "store", dest = "ui") | 125 | action = "store", dest = "ui") |
| 126 | 126 | ||
| 127 | parser.add_option( "", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not", | ||
| 128 | action = "store_true", dest = "revisions_changed", default = False ) | ||
| 129 | |||
| 127 | options, args = parser.parse_args(sys.argv) | 130 | options, args = parser.parse_args(sys.argv) |
| 128 | 131 | ||
| 129 | configuration = BBConfiguration(options) | 132 | configuration = BBConfiguration(options) |
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'] |
diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake index f3294106ef..842ba0441e 100755 --- a/bitbake/bin/bitbake +++ b/bitbake/bin/bitbake | |||
| @@ -108,6 +108,9 @@ Default BBFILES are the .bb files in the current directory.""" ) | |||
| 108 | parser.add_option( "-P", "--profile", help = "profile the command and print a report", | 108 | parser.add_option( "-P", "--profile", help = "profile the command and print a report", |
| 109 | action = "store_true", dest = "profile", default = False ) | 109 | action = "store_true", dest = "profile", default = False ) |
| 110 | 110 | ||
| 111 | parser.add_option( "", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not", | ||
| 112 | action = "store_true", dest = "revisions_changed", default = False ) | ||
| 113 | |||
| 111 | options, args = parser.parse_args(sys.argv) | 114 | options, args = parser.parse_args(sys.argv) |
| 112 | 115 | ||
| 113 | configuration = BBConfiguration(options) | 116 | configuration = BBConfiguration(options) |
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 1f31d1203a..b0692431bb 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
| @@ -612,6 +612,9 @@ class BBCooker: | |||
| 612 | # initialise the parsing status now we know we will need deps | 612 | # initialise the parsing status now we know we will need deps |
| 613 | self.updateCache() | 613 | self.updateCache() |
| 614 | 614 | ||
| 615 | if self.configuration.revisions_changed: | ||
| 616 | sys.exit(bb.fetch.fetcher_compare_revisons(self.configuration.data)) | ||
| 617 | |||
| 615 | if self.configuration.parse_only: | 618 | if self.configuration.parse_only: |
| 616 | bb.msg.note(1, bb.msg.domain.Collection, "Requested parsing .bb files only. Exiting.") | 619 | bb.msg.note(1, bb.msg.domain.Collection, "Requested parsing .bb files only. Exiting.") |
| 617 | return 0 | 620 | return 0 |
diff --git a/bitbake/lib/bb/fetch/__init__.py b/bitbake/lib/bb/fetch/__init__.py index 39a8180a89..a97138d271 100644 --- a/bitbake/lib/bb/fetch/__init__.py +++ b/bitbake/lib/bb/fetch/__init__.py | |||
| @@ -97,13 +97,34 @@ def fetcher_init(d): | |||
| 97 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy) | 97 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Keeping SRCREV cache due to cache policy of: %s" % srcrev_policy) |
| 98 | elif srcrev_policy == "clear": | 98 | elif srcrev_policy == "clear": |
| 99 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy) | 99 | bb.msg.debug(1, bb.msg.domain.Fetcher, "Clearing SRCREV cache due to cache policy of: %s" % srcrev_policy) |
| 100 | pd.delDomain("BB_URI_HEADREVS") | 100 | pd.renameDomain("BB_URI_HEADREVS", "BB_URI_HEADREVS_PREVIOUS") |
| 101 | else: | 101 | else: |
| 102 | bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) | 102 | bb.msg.fatal(bb.msg.domain.Fetcher, "Invalid SRCREV cache policy of: %s" % srcrev_policy) |
| 103 | # Make sure our domains exist | 103 | # Make sure our domains exist |
| 104 | pd.addDomain("BB_URI_HEADREVS") | 104 | pd.addDomain("BB_URI_HEADREVS") |
| 105 | pd.addDomain("BB_URI_HEADREVS_PREVIOUS") | ||
| 105 | pd.addDomain("BB_URI_LOCALCOUNT") | 106 | pd.addDomain("BB_URI_LOCALCOUNT") |
| 106 | 107 | ||
| 108 | def fetcher_compare_revisons(d): | ||
| 109 | """ | ||
| 110 | Compare the revisions in the persistant cache with current values and | ||
| 111 | return true/false on whether they've changed. | ||
| 112 | """ | ||
| 113 | |||
| 114 | pd = persist_data.PersistData(d) | ||
| 115 | data = pd.getKeyValues("BB_URI_HEADREVS") | ||
| 116 | data2 = pd.getKeyValues("BB_URI_HEADREVS_PREVIOUS") | ||
| 117 | |||
| 118 | changed = False | ||
| 119 | for key in data: | ||
| 120 | if key not in data2 or data2[key] != data[key]: | ||
| 121 | bb.msg.debug(1, bb.msg.domain.Fetcher, "%s changed" % key) | ||
| 122 | changed = True | ||
| 123 | return True | ||
| 124 | else: | ||
| 125 | bb.msg.debug(2, bb.msg.domain.Fetcher, "%s did not change" % key) | ||
| 126 | return False | ||
| 127 | |||
| 107 | # Function call order is usually: | 128 | # Function call order is usually: |
| 108 | # 1. init | 129 | # 1. init |
| 109 | # 2. go | 130 | # 2. go |
