mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00

Building up a set of actions for the server is tricky since we depend upon the commandline but fall back to values from the datastore. We should be able to build a datastore without a commandline and vice versa. Ultimately the UI should send the commands to the server. This patch amounts to code rearranging, moving the heavy lifting to the UI, though a helper in the configuration option. This will need further cleanup/tweaking but this should be the only update needed to the UIs. The code now queries the server for any missing data should it need to. This code allows various knowledge of configuration variables to move to the UI side only, partcularly pkgs_to_build but also all the command specifiers. It should also be possible to move cmd eventually, I'm just unsure if any callers call the commands expecting this to default to something sane right now. (Bitbake rev: 2dbbb1d51dafd4451fef8fe16f095bcd4b8f1177) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
95 lines
3.1 KiB
Python
Executable File
95 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
#
|
|
# BitBake Graphical GTK User Interface
|
|
#
|
|
# Copyright (C) 2011 Intel Corporation
|
|
#
|
|
# Authored by Joshua Lock <josh@linux.intel.com>
|
|
# Authored by Dongxiao Xu <dongxiao.xu@intel.com>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License version 2 as
|
|
# published by the Free Software Foundation.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
import sys
|
|
import os
|
|
requirements = "FATAL: Hob requires Gtk+ 2.20.0 or higher, PyGtk 2.21.0 or higher"
|
|
try:
|
|
import gobject
|
|
import gtk
|
|
import pygtk
|
|
pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
|
|
gtkver = gtk.gtk_version
|
|
pygtkver = gtk.pygtk_version
|
|
if gtkver < (2, 20, 0) or pygtkver < (2, 21, 0):
|
|
sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." % (requirements,
|
|
".".join(map(str, gtkver)),
|
|
".".join(map(str, pygtkver))))
|
|
except ImportError as exc:
|
|
sys.exit("%s (%s)." % (requirements, str(exc)))
|
|
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
|
try:
|
|
import bb
|
|
except RuntimeError as exc:
|
|
sys.exit(str(exc))
|
|
from bb.ui import uihelper
|
|
from bb.ui.crumbs.hoblistmodel import RecipeListModel, PackageListModel
|
|
from bb.ui.crumbs.hobeventhandler import HobHandler
|
|
from bb.ui.crumbs.builder import Builder
|
|
|
|
extraCaches = ['bb.cache_extra:HobRecipeInfo']
|
|
|
|
def event_handle_idle_func(eventHandler, hobHandler):
|
|
# Consume as many messages as we can in the time available to us
|
|
if not eventHandler:
|
|
return False
|
|
event = eventHandler.getEvent()
|
|
while event:
|
|
hobHandler.handle_event(event)
|
|
event = eventHandler.getEvent()
|
|
return True
|
|
|
|
def main (server, eventHandler, params):
|
|
params.updateFromServer(server)
|
|
gobject.threads_init()
|
|
|
|
# That indicates whether the Hob and the bitbake server are
|
|
# running on different machines
|
|
# recipe model and package model
|
|
recipe_model = RecipeListModel()
|
|
package_model = PackageListModel()
|
|
|
|
hobHandler = HobHandler(server, recipe_model, package_model)
|
|
builder = Builder(hobHandler, recipe_model, package_model)
|
|
|
|
# This timeout function regularly probes the event queue to find out if we
|
|
# have any messages waiting for us.
|
|
gobject.timeout_add(10, event_handle_idle_func, eventHandler, hobHandler)
|
|
|
|
try:
|
|
gtk.main()
|
|
except EnvironmentError as ioerror:
|
|
# ignore interrupted io
|
|
if ioerror.args[0] == 4:
|
|
pass
|
|
finally:
|
|
hobHandler.cancel_build(force = True)
|
|
|
|
if __name__ == "__main__":
|
|
try:
|
|
ret = main()
|
|
except Exception:
|
|
ret = 1
|
|
import traceback
|
|
traceback.print_exc(15)
|
|
sys.exit(ret)
|