mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
Rename command events, adjust compareRevisions
- Moved the logic for comparing revisions from cooker into command - Removed 'Cooker' from the event names - Renamed the 'ExitCode' event into CommandExit, and changed CommandFailed to be a subclass of CommandExit (Bitbake rev: c51ed5d7a9971fad6019dac6c35a71b8a54ab16a) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
committed by
Richard Purdie
parent
5a92e67b86
commit
098f63d672
+24
-34
@@ -35,12 +35,25 @@ import bb.data
|
|||||||
async_cmds = {}
|
async_cmds = {}
|
||||||
sync_cmds = {}
|
sync_cmds = {}
|
||||||
|
|
||||||
|
|
||||||
|
class CommandCompleted(bb.event.Event):
|
||||||
|
pass
|
||||||
|
|
||||||
|
class CommandExit(bb.event.Event):
|
||||||
|
def __init__(self, exitcode):
|
||||||
|
bb.event.Event.__init__(self)
|
||||||
|
self.exitcode = int(exitcode)
|
||||||
|
|
||||||
|
class CommandFailed(CommandExit):
|
||||||
|
def __init__(self, message):
|
||||||
|
self.error = message
|
||||||
|
CommandExit.__init__(self, 1)
|
||||||
|
|
||||||
class Command:
|
class Command:
|
||||||
"""
|
"""
|
||||||
A queue of asynchronous commands for bitbake
|
A queue of asynchronous commands for bitbake
|
||||||
"""
|
"""
|
||||||
def __init__(self, cooker):
|
def __init__(self, cooker):
|
||||||
|
|
||||||
self.cooker = cooker
|
self.cooker = cooker
|
||||||
self.cmds_sync = CommandsSync()
|
self.cmds_sync = CommandsSync()
|
||||||
self.cmds_async = CommandsAsync()
|
self.cmds_async = CommandsAsync()
|
||||||
@@ -105,11 +118,13 @@ class Command:
|
|||||||
self.finishAsyncCommand(traceback.format_exc())
|
self.finishAsyncCommand(traceback.format_exc())
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def finishAsyncCommand(self, error = None):
|
def finishAsyncCommand(self, msg=None, code=None):
|
||||||
if error:
|
if msg:
|
||||||
bb.event.fire(CookerCommandFailed(error), self.cooker.configuration.event_data)
|
bb.event.fire(CommandFailed(msg), self.cooker.configuration.event_data)
|
||||||
|
elif code:
|
||||||
|
bb.event.fire(CommandExit(code), self.cooker.configuration.event_data)
|
||||||
else:
|
else:
|
||||||
bb.event.fire(CookerCommandCompleted(), self.cooker.configuration.event_data)
|
bb.event.fire(CommandCompleted(), self.cooker.configuration.event_data)
|
||||||
self.currentAsyncCommand = None
|
self.currentAsyncCommand = None
|
||||||
|
|
||||||
|
|
||||||
@@ -249,33 +264,8 @@ class CommandsAsync:
|
|||||||
"""
|
"""
|
||||||
Parse the .bb files
|
Parse the .bb files
|
||||||
"""
|
"""
|
||||||
command.cooker.compareRevisions()
|
if bb.fetch.fetcher_compare_revisions(command.cooker.configuration.data):
|
||||||
command.finishAsyncCommand()
|
command.finishAsyncCommand(code=1)
|
||||||
|
else:
|
||||||
|
command.finishAsyncCommand()
|
||||||
compareRevisions.needcache = True
|
compareRevisions.needcache = True
|
||||||
|
|
||||||
#
|
|
||||||
# Events
|
|
||||||
#
|
|
||||||
class CookerCommandCompleted(bb.event.Event):
|
|
||||||
"""
|
|
||||||
Cooker command completed
|
|
||||||
"""
|
|
||||||
def __init__(self):
|
|
||||||
bb.event.Event.__init__(self)
|
|
||||||
|
|
||||||
|
|
||||||
class CookerCommandFailed(bb.event.Event):
|
|
||||||
"""
|
|
||||||
Cooker command completed
|
|
||||||
"""
|
|
||||||
def __init__(self, error):
|
|
||||||
bb.event.Event.__init__(self)
|
|
||||||
self.error = error
|
|
||||||
|
|
||||||
class CookerCommandSetExitCode(bb.event.Event):
|
|
||||||
"""
|
|
||||||
Set the exit code for a cooker command
|
|
||||||
"""
|
|
||||||
def __init__(self, exitcode):
|
|
||||||
bb.event.Event.__init__(self)
|
|
||||||
self.exitcode = int(exitcode)
|
|
||||||
|
|||||||
@@ -191,10 +191,6 @@ class BBCooker:
|
|||||||
|
|
||||||
logger.plain("%-35s %25s %25s", p, lateststr, prefstr)
|
logger.plain("%-35s %25s %25s", p, lateststr, prefstr)
|
||||||
|
|
||||||
def compareRevisions(self):
|
|
||||||
ret = bb.fetch.fetcher_compare_revisons(self.configuration.data)
|
|
||||||
bb.event.fire(bb.command.CookerCommandSetExitCode(ret), self.configuration.event_data)
|
|
||||||
|
|
||||||
def showEnvironment(self, buildfile = None, pkgs_to_build = []):
|
def showEnvironment(self, buildfile = None, pkgs_to_build = []):
|
||||||
"""
|
"""
|
||||||
Show the outer or per-package environment
|
Show the outer or per-package environment
|
||||||
|
|||||||
@@ -174,7 +174,7 @@ def fetcher_init(d):
|
|||||||
pd.addDomain("BB_URI_HEADREVS")
|
pd.addDomain("BB_URI_HEADREVS")
|
||||||
pd.addDomain("BB_URI_LOCALCOUNT")
|
pd.addDomain("BB_URI_LOCALCOUNT")
|
||||||
|
|
||||||
def fetcher_compare_revisons(d):
|
def fetcher_compare_revisions(d):
|
||||||
"""
|
"""
|
||||||
Compare the revisions in the persistant cache with current values and
|
Compare the revisions in the persistant cache with current values and
|
||||||
return true/false on whether they've changed.
|
return true/false on whether they've changed.
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import gobject
|
|||||||
import gtk
|
import gtk
|
||||||
import threading
|
import threading
|
||||||
import xmlrpclib
|
import xmlrpclib
|
||||||
|
import bb
|
||||||
|
import bb.event
|
||||||
from bb.ui.crumbs.progress import ProgressBar
|
from bb.ui.crumbs.progress import ProgressBar
|
||||||
|
|
||||||
# Package Model
|
# Package Model
|
||||||
@@ -236,11 +238,13 @@ def main(server, eventHandler):
|
|||||||
parse(event._depgraph, dep.pkg_model, dep.depends_model)
|
parse(event._depgraph, dep.pkg_model, dep.depends_model)
|
||||||
gtk.gdk.threads_leave()
|
gtk.gdk.threads_leave()
|
||||||
|
|
||||||
if isinstance(event, bb.command.CookerCommandCompleted):
|
if isinstance(event, bb.command.CommandCompleted):
|
||||||
continue
|
continue
|
||||||
if isinstance(event, bb.command.CookerCommandFailed):
|
if isinstance(event, bb.command.CommandFailed):
|
||||||
print("Command execution failed: %s" % event.error)
|
print("Command execution failed: %s" % event.error)
|
||||||
break
|
return event.exitcode
|
||||||
|
if isinstance(event, bb.command.CommandExit):
|
||||||
|
return event.exitcode
|
||||||
if isinstance(event, bb.cooker.CookerExit):
|
if isinstance(event, bb.cooker.CookerExit):
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|||||||
@@ -163,15 +163,15 @@ def main(server, eventHandler):
|
|||||||
% ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
|
% ( event.total, event.cached, event.parsed, event.virtuals, event.skipped, event.masked, event.errors)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if isinstance(event, bb.command.CookerCommandCompleted):
|
if isinstance(event, bb.command.CommandCompleted):
|
||||||
break
|
break
|
||||||
if isinstance(event, bb.command.CookerCommandSetExitCode):
|
if isinstance(event, bb.command.CommandFailed):
|
||||||
return_value = event.exitcode
|
return_value = event.exitcode
|
||||||
continue
|
|
||||||
if isinstance(event, bb.command.CookerCommandFailed):
|
|
||||||
return_value = 1
|
|
||||||
logger.error("Command execution failed: %s" % event.error)
|
logger.error("Command execution failed: %s" % event.error)
|
||||||
break
|
break
|
||||||
|
if isinstance(event, bb.command.CommandExit):
|
||||||
|
return_value = event.exitcode
|
||||||
|
continue
|
||||||
if isinstance(event, bb.cooker.CookerExit):
|
if isinstance(event, bb.cooker.CookerExit):
|
||||||
break
|
break
|
||||||
if isinstance(event, bb.event.MultipleProviders):
|
if isinstance(event, bb.event.MultipleProviders):
|
||||||
|
|||||||
@@ -288,12 +288,14 @@ class NCursesUI:
|
|||||||
# else:
|
# else:
|
||||||
# bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile)
|
# bb.msg.error(bb.msg.domain.Build, "see log in %s" % logfile)
|
||||||
|
|
||||||
if isinstance(event, bb.command.CookerCommandCompleted):
|
if isinstance(event, bb.command.CommandCompleted):
|
||||||
exitflag = True
|
exitflag = True
|
||||||
if isinstance(event, bb.command.CookerCommandFailed):
|
if isinstance(event, bb.command.CommandFailed):
|
||||||
mw.appendText("Command execution failed: %s" % event.error)
|
mw.appendText("Command execution failed: %s" % event.error)
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
exitflag = True
|
exitflag = True
|
||||||
|
if isinstance(event, bb.command.CommandExit):
|
||||||
|
exitflag = True
|
||||||
if isinstance(event, bb.cooker.CookerExit):
|
if isinstance(event, bb.cooker.CookerExit):
|
||||||
exitflag = True
|
exitflag = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user