[jhbuild: 53/60] Merge branch 'master' into new-gui
- From: Frederic Peters <fpeters src gnome org>
- To: svn-commits-list gnome org
- Subject: [jhbuild: 53/60] Merge branch 'master' into new-gui
- Date: Sat, 6 Jun 2009 09:52:05 -0400 (EDT)
commit b91854505bc8fed24cc1353a9cbd9a4a07bad9ae
Merge: 04dd0cd... 16bb6ae...
Author: Frédéric Péters <fpeters 0d be>
Date: Thu Jun 4 21:41:47 2009 +0200
Merge branch 'master' into new-gui
Conflicts:
jhbuild/frontends/gtkui.py
jhbuild/frontends/terminal.py
Makefile.am | 2 +-
Makefile.plain | 39 +-
NEWS | 64 ++
buildbot/Makefile | 19 -
buildbot/Makefile.am | 52 ++
configure.ac | 4 +-
doc/C/jhbuild.xml | 57 ++-
doc/es/es.po | 891 ++++++++++---------
doc/fr/fr.po | 1256 +++++++++++---------------
jhbuild/commands/Makefile.am | 4 +-
jhbuild/commands/__init__.py | 6 +-
jhbuild/commands/autobuild.py | 2 +-
jhbuild/commands/base.py | 135 +---
jhbuild/commands/bootstrap.py | 2 +-
jhbuild/commands/bot.py | 56 +-
jhbuild/commands/checkbranches.py | 2 +-
jhbuild/commands/checkmodulesets.py | 2 +-
jhbuild/commands/clean.py | 68 ++
jhbuild/commands/gui.py | 2 +-
jhbuild/commands/info.py | 4 +-
jhbuild/commands/rdepends.py | 4 +-
jhbuild/commands/sanitycheck.py | 5 +-
jhbuild/commands/snapshot.py | 2 +-
jhbuild/commands/tinderbox.py | 21 +-
jhbuild/commands/uninstall.py | 74 ++
jhbuild/config.py | 160 ++++-
jhbuild/defaults.jhbuildrc | 31 +-
jhbuild/errors.py | 9 +
jhbuild/frontends/autobuild.py | 16 +-
jhbuild/frontends/buildscript.py | 146 +++-
jhbuild/frontends/gtkui.py | 23 +-
jhbuild/frontends/terminal.py | 36 +-
jhbuild/frontends/tinderbox.py | 14 +-
jhbuild/main.py | 7 +-
jhbuild/modtypes/__init__.py | 83 +--
jhbuild/modtypes/ant.py | 38 +-
jhbuild/modtypes/autotools.py | 159 ++--
jhbuild/modtypes/cmake.py | 52 +-
jhbuild/modtypes/distutils.py | 35 +-
jhbuild/modtypes/linux.py | 94 +--
jhbuild/modtypes/perl.py | 35 +-
jhbuild/modtypes/tarball.py | 4 +-
jhbuild/modtypes/testmodule.py | 19 +-
jhbuild/modtypes/waf.py | 95 +--
jhbuild/moduleset.py | 6 +-
jhbuild/monkeypatch.py | 5 +
jhbuild/utils/cmds.py | 10 +-
jhbuild/utils/httpcache.py | 4 +
jhbuild/utils/packagedb.py | 2 +-
jhbuild/utils/subprocess_win32.py | 136 +++
jhbuild/utils/trayicon.py | 4 +-
jhbuild/versioncontrol/git.py | 27 +-
jhbuild/versioncontrol/hg.py | 7 +-
jhbuild/versioncontrol/tarball.py | 28 +-
modulesets/bootstrap.modules | 64 +-
modulesets/freedesktop-2.28.modules | 2 +-
modulesets/gnome-2.16.modules | 2 +-
modulesets/gnome-2.18.modules | 2 +-
modulesets/gnome-2.26.modules | 15 +-
modulesets/gnome-2.28.modules | 57 ++-
modulesets/gnome-devel.modules | 30 +-
modulesets/gnome-external-deps-2.26.modules | 25 +-
modulesets/gnome-external-deps-2.28.modules | 55 +-
modulesets/gnome-external-deps-devel.modules | 57 +-
modulesets/gnome-suites-2.20.modules | 2 +-
modulesets/gnome-suites-2.22.modules | 2 +-
modulesets/gnome-suites-2.24.modules | 2 +-
modulesets/gnome-suites-2.26.modules | 22 +-
modulesets/gnome-suites-2.28.modules | 35 +-
modulesets/gnome-suites-devel.modules | 13 +
patches/guile-1.8.5-libtool2.patch | 55 ++
po/POTFILES.in | 2 +
po/es.po | 734 ++++++++-------
po/fr.po | 788 ++++++++++-------
scripts/Makefile.am | 2 +
scripts/jhbuild.in | 3 +-
tests/mock.py | 13 +-
tests/tests.py | 71 ++-
78 files changed, 3391 insertions(+), 2720 deletions(-)
diff --cc jhbuild/frontends/buildscript.py
index da3b2fc,00937ea..1283a42
--- a/jhbuild/frontends/buildscript.py
+++ b/jhbuild/frontends/buildscript.py
@@@ -21,10 -21,10 +21,10 @@@
import os
from jhbuild.utils import packagedb
- from jhbuild.errors import FatalError, CommandError
+ from jhbuild.errors import FatalError, CommandError, SkipToPhase, SkipToEnd
class BuildScript:
- def __init__(self, config, module_list):
+ def __init__(self, config, module_list=None):
if self.__class__ is BuildScript:
raise NotImplementedError('BuildScript is an abstract base class')
diff --cc jhbuild/frontends/gtkui.py
index bc9320c,672f500..5b5528a
--- a/jhbuild/frontends/gtkui.py
+++ b/jhbuild/frontends/gtkui.py
@@@ -40,626 -42,427 +40,631 @@@ import buildscrip
import jhbuild.moduleset
from jhbuild.modtypes import MetaModule
from jhbuild.errors import CommandError
+from jhbuild.utils import notify
+
+from terminal import t_bold, t_reset
+
-def get_glade_filename():
- return os.path.join(os.path.dirname(__file__), 'jhbuild.glade')
+class ExitRequestedException(Exception):
+ pass
-class Configuration:
- def __init__(self, config, args):
+
+class AppWindow(gtk.Window, buildscript.BuildScript):
+ default_module_iter = None
+ active_iter = None
+ child_pid = None
+ error_resolution = None
+ preference_dialog = None
+
+ def __init__(self, config, module_list=None):
+ self.orig_modulelist = module_list
+ buildscript.BuildScript.__init__(self, config)
self.config = config
- self.args = args
-
- localedir = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../mo'))
- gtk.glade.bindtextdomain('messages', localedir)
-
- glade_filename = get_glade_filename()
-
- # Fetch widgets out of the Glade
- self.glade = gtk.glade.XML(glade_filename)
- self.window = self.glade.get_widget("ConfigWindow")
- self.meta_modules_list = self.glade.get_widget("ConfigMetaModules")
- self.start_module_menu = self.glade.get_widget("ConfigStartModule")
- self.run_autogen_checkbox = self.glade.get_widget("ConfigRunAutogen")
- self.cvs_update_checkbox = self.glade.get_widget("ConfigCVSUpdate")
- self.no_build_checkbox = self.glade.get_widget("ConfigNoBuild")
- self.start_build_button = self.glade.get_widget("ConfigBuildButton")
- self.cancel_button = self.glade.get_widget("ConfigCancelButton")
-
- # Get settings for the checkboxes, etc
- self._get_default_settings()
-
- # Hook up the buttons / checkboxes
- self.start_build_button.connect('clicked', lambda button: gtk.main_quit())
- self.cancel_button.connect('clicked', lambda button: sys.exit(-1))
- self.run_autogen_checkbox.connect('toggled', self._autogen_checkbox_toggled)
- self.cvs_update_checkbox.connect('toggled', self._cvs_update_checkbox_toggled)
- self.no_build_checkbox.connect('toggled', self._no_build_checkbox_toggled)
- #self.start_module_menu.connect('clicked', self._start_module_menu_clicked)
-
- # Get the list of meta modules
+ gtk.Window.__init__(self)
+ self.set_resizable(False)
+ theme = gtk.icon_theme_get_default()
+ gtk.window_set_default_icon_list(
+ theme.load_icon('applications-development', 16, ()),
+ theme.load_icon('applications-development', 24, ()),
+ theme.load_icon('applications-development', 32, ()),
+ theme.load_icon('applications-development', 48, ()),
+ theme.load_icon('applications-development', 64, ()),
+ theme.load_icon('applications-development', 128, ())
+ )
+ self.set_title('JHBuild')
+
self.module_set = jhbuild.moduleset.load(config)
+
+ self.create_modules_list_model()
+ self.create_ui()
+ self.notify = notify.Notify(config)
+
+ if self.default_module_iter:
+ self.module_combo.set_active_iter(self.default_module_iter)
+
+ self.connect('delete-event', self.on_delete_event)
+
+ def create_modules_list_model(self):
+ # name, separator, startat
+ self.modules_list_model = gtk.ListStore(str, bool, str)
full_module_list = self.module_set.get_full_module_list()
- self.meta_modules = []
- self.name_to_meta_module = {}
- for possible_meta_module in full_module_list:
- if isinstance(possible_meta_module, MetaModule):
- print _("Found meta module %s") % possible_meta_module.name
- self.meta_modules.append(possible_meta_module)
- self.name_to_meta_module[possible_meta_module.name] = possible_meta_module
-
- self.meta_modules.sort(lambda a, b: cmp(a.name.lower(), b.name.lower()))
- self._create_meta_modules_list_view(self.meta_modules)
-
- self._build_start_module_menu()
-
- def run(self):
- self.window.show_all()
- gtk.main()
- self.window.hide()
- self._set_default_settings()
- return (self.module_list, self.start_at_module, self.run_autogen, self.cvs_update,
- self.no_build)
-
- def _get_default_settings(self):
- if have_gconf:
- client = gconf.client_get_default()
- self.run_autogen = client.get_bool("/apps/jhbuild/always_run_autogen")
- self.cvs_update = client.get_bool("/apps/jhbuild/update_from_cvs")
- self.no_build = client.get_bool("/apps/jhbuild/no_build")
- self.selected_modules = client.get_list("/apps/jhbuild/modules_to_build", gconf.VALUE_STRING)
- self.start_at_module = client.get_string("/apps/jhbuild/start_at_module")
- else:
- self.run_autogen = False
- self.cvs_update = True
- self.no_build = False
-
- self.run_autogen_checkbox.set_active(self.run_autogen)
- self.cvs_update_checkbox.set_active(self.cvs_update)
- self.no_build_checkbox.set_active(self.no_build)
-
- def _set_default_settings(self):
- if have_gconf:
- client = gconf.client_get_default()
- client.set_bool("/apps/jhbuild/always_run_autogen", self.run_autogen)
- client.set_bool("/apps/jhbuild/update_from_cvs", self.cvs_update)
- client.set_bool("/apps/jhbuild/no_build", self.no_build)
- client.set_list("/apps/jhbuild/modules_to_build", gconf.VALUE_STRING, self.selected_modules)
- if self.start_at_module:
- client.set_string("/apps/jhbuild/start_at_module", self.start_at_module)
- else:
- client.set_string("/apps/jhbuild/start_at_module", "")
-
- print ("Gconf setting for update from CVS is %d" % self.cvs_update)
-
-
- def _meta_module_toggled(self, cell, path, model):
- iter = model.get_iter((int(path),))
- build = model.get_value(iter, 0)
- build = not build
- model.set(iter, 0, build)
- self.selected_modules = self._get_selected_meta_modules()
- self._build_start_module_menu()
-
- def _create_meta_modules_list_view(self, meta_modules):
- self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING)
- self.meta_modules_list.set_model(self.model)
-
- for module in meta_modules:
- iter = self.model.append()
- if self.selected_modules:
- selected = (module.name in self.selected_modules)
- else:
- selected = False
- self.model.set(iter, 0, selected, 1, module.name)
-
- renderer = gtk.CellRendererToggle()
- renderer.connect('toggled', self._meta_module_toggled, self.model)
- column = gtk.TreeViewColumn(_('Build'), renderer, active=0)
- column.set_clickable(True)
- self.meta_modules_list.append_column(column)
-
- column = gtk.TreeViewColumn(_('Module Group'), gtk.CellRendererText(), text=1)
- self.meta_modules_list.append_column(column)
-
- def _get_selected_meta_modules(self):
- modules = []
- iter = self.model.get_iter_first()
-
- while iter:
- build = self.model.get_value(iter, 0)
- if build:
- name = self.model.get_value(iter, 1)
- module = self.name_to_meta_module[name]
- if module:
- modules.append(module.name)
- iter = self.model.iter_next(iter)
-
- return modules
-
-
- def _build_start_module_menu(self):
- if not self.selected_modules:
+ for module in full_module_list:
+ if isinstance(module, MetaModule):
+ if module.name.endswith('-deprecations'):
+ # skip the deprecation meta modules, nobody want them
+ continue
+ iter = self.modules_list_model.append((module.name, False, ''))
+ self.modules_list_model.append(('', True, ''))
+ self.modules_list_model.append((_('Others...'), False, ''))
+
+ for module in self.config.modules:
+ iter = self.add_extra_module_to_model(module)
+ if not self.default_module_iter:
+ self.default_module_iter = iter
+
+ def add_extra_module_to_model(self, module, startat=''):
+ # lookup selected module in current modules list
+ for row in self.modules_list_model:
+ row_value = self.modules_list_model.get(row.iter, 0)[0]
+ if row_value == module:
+ self.modules_list_model.set_value(row.iter, 2, startat)
+ return row.iter
+
+ # add selected module in the list
+ if self.modules_list_model.get(self.modules_list_model[-3].iter, 1)[0] is False:
+ # there is no user-added modules at the moment, add a separator row
+ self.modules_list_model.insert_before(
+ self.modules_list_model[-2].iter, ('', True, ''))
+ iter = self.modules_list_model.insert_before(
+ self.modules_list_model[-2].iter, (module, False, startat))
+ return iter
+
+ quit = False
+ def on_delete_event(self, *args):
+ self.quit = True
+ self.hide()
+ if self.child_pid:
+ os.kill(self.child_pid, signal.SIGKILL)
+ if gtk.main_level():
+ gtk.main_quit()
+
+ def create_ui(self):
+ self.set_border_width(5)
+ app_vbox = gtk.VBox(spacing=5)
+
+ self.module_hbox = gtk.HBox(spacing=5)
+ app_vbox.pack_start(self.module_hbox, fill=False, expand=False)
+
+ label = gtk.Label()
+ label.set_markup('<b>%s</b>' % _('Choose Module:'))
+ self.module_hbox.pack_start(label, fill=False, expand=False)
+
+ self.module_combo = gtk.ComboBox(self.modules_list_model)
+ cell = gtk.CellRendererText()
+ self.module_combo.pack_start(cell, True)
+ self.module_combo.add_attribute(cell, 'text', 0)
+ self.module_combo.changed_signal_id = self.module_combo.connect(
+ 'changed', self.on_module_selection_changed_cb)
+
+ self.module_combo.set_row_separator_func(lambda x,y: x.get(y, 1)[0])
+ self.module_hbox.pack_start(self.module_combo, fill=True)
+
+ separator = gtk.VSeparator()
+ self.module_hbox.pack_start(separator, fill=False, expand=False)
+ preferences = gtk.Button(stock=gtk.STOCK_PREFERENCES)
+ preferences.connect('clicked', self.on_preferences_cb)
+ self.module_hbox.pack_start(preferences, fill=False, expand=False)
+
+ self.progressbar = gtk.ProgressBar()
+ self.progressbar.set_text(_('Build Progess'))
+ app_vbox.pack_start(self.progressbar, fill=False, expand=False)
+
+ if vte:
+ expander = gtk.Expander(_('Terminal'))
+ expander.set_expanded(False)
+ app_vbox.pack_start(expander, fill=False, expand=False)
+ sclwin = gtk.ScrolledWindow()
+ sclwin.set_size_request(-1, 300)
+ sclwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
+ expander.add(sclwin)
+ self.terminal = vte.Terminal()
+ self.terminal.connect('child-exited', self.on_vte_child_exit_cb)
+ sclwin.add(self.terminal)
+
+ self.error_hbox = self.create_error_hbox()
+ app_vbox.pack_start(self.error_hbox, fill=False, expand=False)
+
+ buttonbox = gtk.HButtonBox()
+ buttonbox.set_layout(gtk.BUTTONBOX_END)
+ app_vbox.pack_start(buttonbox, fill=False, expand=False)
+
+ self.build_button = gtk.Button(_('Start'))
+ self.build_button.connect('clicked', self.on_build_cb)
+ buttonbox.add(self.build_button)
+
+ button = gtk.Button(stock=gtk.STOCK_HELP)
+ button.connect('clicked', self.on_help_cb)
+ buttonbox.add(button)
+ buttonbox.set_child_secondary(button, True)
+
+ app_vbox.show_all()
+ self.error_hbox.hide()
+ self.add(app_vbox)
+
+
+ def create_error_hbox(self):
+ error_hbox = gtk.HBox(False, 8)
+ image = gtk.Image()
+ image.set_from_stock(gtk.STOCK_DIALOG_ERROR, gtk.ICON_SIZE_BUTTON)
+ error_hbox.pack_start(image, fill=False, expand=False)
+ image.set_alignment(0.5, 0.5)
+
+ vbox = gtk.VBox(False, 6)
+ error_hbox.pack_start (vbox, True, True, 0)
+
+ self.error_label = gtk.Label()
+ vbox.pack_start(self.error_label, fill=True, expand=True)
+ self.error_label.set_use_markup(True)
+ self.error_label.set_line_wrap(True)
+ self.error_label.set_alignment(0, 0.5)
+
+ # label, code
+ second_hbox = gtk.HBox()
+ vbox.pack_start(second_hbox)
+
+ self.error_resolution_model = gtk.ListStore(str, str)
+ self.error_combo = gtk.ComboBox(self.error_resolution_model)
+ self.error_combo.connect('changed', self.on_error_resolution_changed_cb)
+ self.error_combo.set_row_separator_func(lambda x,y: (x.get(y, 0)[0] == ''))
+ cell = gtk.CellRendererText()
+ self.error_combo.pack_start(cell, True)
+ self.error_combo.add_attribute(cell, 'markup', 0)
+ second_hbox.pack_start(self.error_combo)
+
+ self.error_apply_button = gtk.Button(stock = gtk.STOCK_APPLY)
+ self.error_apply_button.set_sensitive(False)
+ self.error_apply_button.connect('clicked', self.on_resolution_apply_clicked)
+ second_hbox.pack_start(self.error_apply_button, fill=False, expand=False)
+
+ return error_hbox
+
+ def on_error_resolution_changed_cb(self, *args):
+ iter = self.error_combo.get_active_iter()
+ if not iter:
return
-
- self.module_list = self.module_set.get_module_list(self.selected_modules, self.config.skip)
-
- menu = gtk.Menu()
- menu.connect('selection-done', self._start_module_menu_clicked)
-
- selected_item_number = None
- i = 0
- for module in self.module_list:
- menu_item = gtk.MenuItem(module.name)
- menu.append(menu_item)
- if module.name == self.start_at_module:
- selected_item_number = i
- i = i + 1
-
- self.start_module_menu.set_menu (menu)
-
- if selected_item_number:
- self.start_module_menu.set_history(selected_item_number)
- else:
- if self.module_list:
- self.start_at_module = self.module_list[0].name
- else:
- self.start_at_module = None
-
- menu.show_all()
-
- def _start_module_menu_clicked(self, option_menu):
- number = self.start_module_menu.get_history()
- if self.module_list:
- item = self.module_list[number]
- self.start_at_module = item.name
+ if not self.error_resolution_model.get(iter, 1)[0]:
+ return
+ self.error_apply_button.set_sensitive(True)
+
+ def on_resolution_apply_clicked(self, *args):
+ self.error_apply_button.set_sensitive(False)
+ iter = self.error_combo.get_active_iter()
+ if not iter:
+ return
+ self.error_resolution = self.error_resolution_model.get(iter, 1)[0]
+
+ def on_help_cb(self, *args):
+ gtk.show_uri(gtk.gdk.screen_get_default(),
+ 'ghelp:jhbuild', gtk.get_current_event_time())
+
+ def on_preferences_cb(self, *args):
+ if not self.preference_dialog:
+ self.preference_dialog = PreferencesDialog(self)
+ self.preference_dialog.show()
+ self.preference_dialog.present()
+
+ def on_build_cb(self, *args):
+ if self.preference_dialog:
+ self.preference_dialog.hide()
+ if not self.orig_modulelist:
+ modules = [self.modules_list_model.get(
+ self.module_combo.get_active_iter(), 0)[0]]
+
+ self.modulelist = self.module_set.get_module_list(modules,
+ self.config.skip, tags = self.config.tags,
+ ignore_suggests=self.config.ignore_suggests)
else:
- self.start_at_module = None
+ self.orig_modulelist = None
+
+ startat = self.modules_list_model.get(self.module_combo.get_active_iter(), 2)[0]
+ if startat:
+ while self.modulelist and self.modulelist[0].name != startat:
+ del self.modulelist[0]
+ self.build()
+
+ def on_module_selection_changed_cb(self, *args):
+ old_selected_iter = self.active_iter
+ last_iter = self.modules_list_model[-1].iter
+ self.active_iter = self.module_combo.get_active_iter()
+ if self.modules_list_model.get_path(
+ self.active_iter) != self.modules_list_model.get_path(last_iter):
+ return
+ # "Others..." got clicked, modal dialog to let the user select a
+ # specific module
+ current_module = self.modules_list_model.get(old_selected_iter, 0)[0]
+ dlg = SelectModulesDialog(self, current_module)
+ response = dlg.run()
+ if response != gtk.RESPONSE_OK:
+ dlg.destroy()
+ self.module_combo.set_active_iter(old_selected_iter)
+ return
+ selected_module = dlg.selected_module
+ startat = dlg.startat
+ dlg.destroy()
+
+ iter = self.add_extra_module_to_model(selected_module, startat)
+ self.module_combo.set_active_iter(iter)
+
+ def is_build_paused(self):
+ return False
+
+ def build(self):
+ if gtk.main_level() == 0 and self.orig_modulelist:
+ # gtkui called from a "normal" command, not from jhbuild gui
+ self.modulelist = self.orig_modulelist
+ self.show()
+ self.build_button.emit('clicked')
+ while gtk.events_pending():
+ gtk.main_iteration()
+ try:
+ return self.rc
+ except AttributeError:
+ return 1
+ try:
+ self.rc = buildscript.BuildScript.build(self)
+ except ExitRequestedException:
+ self.rc = 1
+ return self.rc
- def _autogen_checkbox_toggled(self, checkbox):
- self.run_autogen = not self.run_autogen
+ def start_build(self):
+ self.build_button.set_sensitive(False)
+ self.module_hbox.set_sensitive(False)
- def _cvs_update_checkbox_toggled(self, checkbox):
- self.cvs_update = not self.cvs_update
+ def end_build(self, failures):
+ self.progressbar.set_fraction(1)
+ self.progressbar.set_text(_('Build Completed'))
+ self.build_button.set_sensitive(True)
+ self.module_hbox.set_sensitive(True)
- def _no_build_checkbox_toggled(self, checkbox):
- self.no_build = not self.no_build
+ def start_module(self, module):
+ idx = [x.name for x in self.modulelist].index(module)
+ self.progressbar.set_fraction((1.0*idx) / len(self.modulelist))
+ if vte:
+ self.terminal.feed('%s*** %s ***%s\n\r' % (t_bold, module, t_reset))
-def optionmenu_get_history(self):
- menu = self.get_menu()
- children = menu.children()
- item = menu.get_active()
+ def end_module(self, module, failed):
+ self.error_hbox.hide()
- for i in range(len(children)):
- if children[i] == item:
- break
+ def set_action(self, action, module, module_num=-1, action_target=None):
+ self.progressbar.set_text('%s %s' % (action, action_target or module.name))
- return i
+ def message(self, msg, module_num=-1):
+ pass
- def handle_error(self, module, state, nextstate, error, altstates):
- summary = _('Error during stage %(stage)s of %(module)s') % {
- 'stage':state, 'module':module.name}
-class GtkBuildScript(buildscript.BuildScript):
- def __init__(self, config, module_list):
- buildscript.BuildScript.__init__(self, config, module_list)
- self.current_module = None
- self._createWindow()
- if have_gconf:
- self.terminal_command = self._getTerminalCommand()
++ def handle_error(self, module, phase, nextphase, error, altphases):
++ summary = _('Error during phase %(phase)s of %(module)s') % {
++ 'phase': phase, 'module':module.name}
+ try:
+ error_message = error.args[0]
+ self.message('%s: %s' % (summary, error_message))
+ except:
+ error_message = None
+ self.message(summary)
+
+ if not self.is_active():
+ self.set_urgency_hint(True)
+ self.notify.notify(summary=summary, body=error_message,
+ icon=gtk.STOCK_DIALOG_ERROR, expire=5)
+
+ self.error_label.set_markup('<b>%s</b>' % _(summary))
+ self.error_resolution_model.clear()
+ iter = self.error_resolution_model.append(
+ ('<i>%s</i>' % _('Pick an Action'), ''))
+ self.error_resolution_model.append(('', ''))
+ self.error_resolution_model.append(
- (_('Rerun stage %s') % state, state))
- self.error_resolution_model.append(
- (_('Ignore error and continue to %s') % nextstate, nextstate))
++ (_('Rerun phase %s') % phase, phase))
++ if nextphase:
++ self.error_resolution_model.append(
++ (_('Ignore error and continue to %s') % nextphase, nextphase))
+ else:
- self.terminal_command = "gnome-terminal"
-
- def _getTerminalCommand(self):
- client = gconf.client_get_default()
- command = client.get_string("/desktop/gnome/applications/terminal/exec")
- return command
-
- def message(self, msg, module_num = -1):
- '''shows a message to the screen'''
-
- if module_num == -1:
- module_num = self.module_num
- dialog = gtk.MessageDialog(buttons=gtk.BUTTONS_OK, message_format=msg)
- dialog.run()
- dialog.hide()
- return
++ self.error_resolution_model.append(
++ (_('Ignore error and continue to next module'), '_done'))
+ self.error_resolution_model.append(
+ (_('Give up on module'), 'fail'))
- for altstate in altstates:
++ for altphase in altphases:
+ self.error_resolution_model.append(
- (_('Go to stage %s') % altstate, altstate))
++ (_('Go to stage %s') % altphase, altphase))
+ self.error_resolution_model.append(('', ''))
+ self.error_resolution_model.append(
+ (_('Open Terminal'), 'shell'))
+
+ self.error_combo.set_active_iter(iter)
+ self.error_hbox.set_sensitive(True)
+ self.error_hbox.show_all()
+ self.error_resolution = None
- def set_action(self, action, module, module_num=-1, action_target=None):
- if module_num == -1:
- module_num = self.module_num
- if not action_target:
- action_target = module.name
- if self.current_module != module and self.current_module != None:
- self.current_module._build_text_buffer = self.build_text
- self.build_text = gtk.TextBuffer(self.tag_table)
- self.build_text_view.set_buffer(self.build_text)
- self.iter = self.build_text.get_end_iter()
- self.current_module = module
-
- num_modules = len(self.modulelist)
- if module_num > 0:
- self.build_progress.set_fraction(module_num / float(num_modules))
- self.build_progress.set_text(_('%d of %d modules')
- % (module_num, num_modules))
-
- self.window.set_title(_('[%(num)d/%(total)d] %(action)s %(module)s')
- % { 'num':module_num, 'total':num_modules, 'action':action, 'module':module.name} )
- self.current_status_label.set_text('%s %s' % (action, module.name))
-
- def _runEventLoop(self):
- while gtk.events_pending():
- gtk.main_iteration()
-
- def _printToBuildOutput(self, output):
- self.iter = self.build_text.get_end_iter()
- self.build_text.insert(self.iter, output)
- self.build_text.move_mark (self.ins_mark, self.iter)
- self.build_text_view.scroll_to_mark (self.ins_mark, 0.0, True, 0.5, 0.5)
-
- def _printToWarningOutput(self, output):
- self.build_text.insert_with_tags_by_name(self.iter, output, "warning")
-
- def _pauseBuild(self):
- return self.pause_button.get_active()
-
- def _makeNonBlocking(self, fd):
- fl = fcntl.fcntl(fd, fcntl.F_GETFL)
- fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NDELAY)
-
+ while True:
+ self.error_resolution = None
+ while gtk.events_pending():
+ gtk.main_iteration()
+ if self.quit:
+ return 'fail'
+ if not self.error_resolution:
+ continue
+ self.set_urgency_hint(False)
+ if self.error_resolution == 'shell':
+ # set back combobox to "Pick an action"
+ self.error_combo.set_active_iter(iter)
+ if os.fork() == 0:
+ cmd = ['gnome-terminal', '--working-directory', module.get_builddir(self)]
+ os.execvp('gnome-terminal', cmd)
+ sys.exit(0)
+ continue
++ if self.error_resolution == '_done':
++ self.error_resolution = None
+ # keep the error hox visible during all of this module duration
+ self.error_hbox.set_sensitive(False)
+ return self.error_resolution
def execute(self, command, hint=None, cwd=None, extra_env=None):
- return_code = -1
-
- kws = {
- 'close_fds': True,
- 'shell': isinstance(command, (str,unicode)),
- 'stdin': subprocess.PIPE,
- 'stdout': subprocess.PIPE,
- 'stderr': subprocess.PIPE,
- }
-
- if cwd is not None:
- kws['cwd'] = cwd
+ if not command:
+ raise CommandError(_('No command given'))
- if extra_env is not None:
- kws['env'] = os.environ.copy()
- kws['env'].update(extra_env)
+ if isinstance(command, (str, unicode)):
+ short_command = command.split()[0]
+ else:
+ short_command = command[0]
+
+ if vte is None:
+ # no vte widget, will just print to the parent terminal
+ kws = {
+ 'close_fds': True,
+ 'shell': isinstance(command, (str,unicode)),
+ 'stdin': subprocess.PIPE,
+ 'stdout': subprocess.PIPE,
+ 'stderr': subprocess.PIPE,
+ }
+
+ if cwd is not None:
+ kws['cwd'] = cwd
+
+ if extra_env is not None:
+ kws['env'] = os.environ.copy()
+ kws['env'].update(extra_env)
+
+ try:
+ p = subprocess.Popen(command, **kws)
+ except OSError, e:
+ raise CommandError(str(e))
+ self.child_pid = p.pid
+
+ p.stdin.close()
+
+ def make_non_blocking(fd):
+ fl = fcntl.fcntl(fd, fcntl.F_GETFL)
+ fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NDELAY)
+
+ make_non_blocking(p.stdout)
+ make_non_blocking(p.stderr)
+
+ build_paused = False
+ read_set = [p.stdout, p.stderr]
+
+ while read_set:
+ # Allow the frontend to get a little time
+ while gtk.events_pending():
+ gtk.main_iteration()
+ if self.quit:
+ raise ExitRequestedException()
+
+ rlist, wlist, xlist = select.select(read_set, [], [], 0)
+
+ if p.stdout in rlist:
+ chunk = p.stdout.read()
+ if chunk == '':
+ p.stdout.close()
+ read_set.remove(p.stdout)
+ sys.stdout.write(chunk)
+
+ if p.stderr in rlist:
+ chunk = p.stderr.read()
+ if chunk == '':
+ p.stderr.close()
+ read_set.remove(p.stderr)
+ sys.stderr.write(chunk)
+
+ # See if we should pause the current command
+ if not build_paused and self.is_build_paused():
+ os.kill(p.pid, signal.SIGSTOP)
+ build_paused = True
+ elif build_paused and not self.is_build_paused():
+ os.kill(p.pid, signal.SIGCONT)
+ build_paused = False
+
+ time.sleep(0.05)
+
+ rc = p.wait()
+ self.child_pid = None
+ else:
+ # use the vte widget
+ if isinstance(command, (str, unicode)):
+ self.terminal.feed(' $ ' + command + '\n\r')
+ command = [os.environ.get('SHELL', '/bin/sh'), '-c', command]
+ else:
+ self.terminal.feed(' $ ' + ' '.join(command) + '\n\r')
+
+ kws = {}
+ if extra_env is not None:
+ env = os.environ.copy()
+ env.update(extra_env)
+ kws['envv'] = ['%s=%s' % x for x in env.items()]
+
+ if cwd:
+ kws['directory'] = cwd
+
+ self.vte_fork_running = True
+ self.vte_child_exit_status = None
+ # In earlier python-vte versions,
+ # - the environment had to be passed as a sequence of strings
+ # ("FOO=1", "BAR=2") (GNOME bug 583078)
+ # - directory keyword could not be set to None (GNOME bug 583129)
+ # The bugs have been fixed, but for compatibility reasons the old
+ # compatibility code is still in place.
+ self.child_pid = self.terminal.fork_command(
+ command=command[0], argv=command, **kws)
+ while self.vte_fork_running:
+ gtk.main_iteration()
+ if self.quit:
+ raise ExitRequestedException()
+ self.child_pid = None
+ if os.WIFEXITED(self.vte_child_exit_status):
+ rc = os.WEXITSTATUS(self.vte_child_exit_status)
+ elif os.WIFSIGNALED(self.vte_child_exit_status):
+ raise CommandError(_('%(command)s died with signal %(rc)s') % {
+ 'command': short_command, 'rc': os.WTERMSIG(rc)})
+
+ if rc:
+ raise CommandError(_('%(command)s returned with an error code (%(rc)s)') % {
+ 'command': short_command, 'rc': rc})
+
+ def on_vte_child_exit_cb(self, terminal):
+ self.vte_fork_running = False
+ self.vte_child_exit_status = self.terminal.get_child_exit_status()
+
+
+class SelectModulesDialog(gtk.Dialog):
+ def __init__(self, parent, default_module=None):
+ gtk.Dialog.__init__(self, '', parent)
+ self.app = parent
+ self.create_model()
+ self.create_ui()
+
+ if default_module:
+ for module_row in self.modules_model:
+ if self.modules_model.get(module_row.iter, 0)[0] == default_module:
+ self.treeview.get_selection().select_iter(module_row.iter)
+ self.treeview.scroll_to_cell(
+ self.modules_model.get_path(module_row.iter))
+ break
+ self.connect('response', self.on_response_cb)
+
+ def create_model(self):
+ self.modules_model = gtk.ListStore(str)
+ modules = [x.name for x in self.app.module_set.get_full_module_list()]
+ for module in sorted(modules, lambda x,y: cmp(x.lower(), y.lower())):
+ self.modules_model.append((module,))
+
+ def create_frame(self, label, child):
+ frame = gtk.Frame('')
+ frame.set_border_width(3)
+ frame.set_shadow_type(gtk.SHADOW_NONE)
+ frame.get_label_widget().set_markup('<b>%s</b>' % label)
+
+ alignment = gtk.Alignment()
+ alignment.set_padding(0, 0, 12, 0)
+ frame.add(alignment)
+ alignment.add(child)
+
+ return frame
+
+ def create_ui(self):
+ vbox = gtk.VBox()
+ self.vbox.add(vbox)
+
+ sclwin = gtk.ScrolledWindow()
+ sclwin.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
+ sclwin.set_size_request(-1, 200)
+ vbox.pack_start(self.create_frame(_('Module'), sclwin))
+
+ self.treeview = gtk.TreeView(self.modules_model)
+ self.treeview.set_headers_visible(False)
+ sclwin.add(self.treeview)
+ selection = self.treeview.get_selection()
+ selection.connect('changed', self.on_selection_changed_cb)
+
+ renderer = gtk.CellRendererText()
+ tv_col = gtk.TreeViewColumn('', renderer, text=0)
+ tv_col.set_expand(True)
+ tv_col.set_min_width(200)
+ self.treeview.append_column(tv_col)
+
+ self.startat_model = gtk.ListStore(str)
+ self.combo_startat = gtk.ComboBox(self.startat_model)
+ cell = gtk.CellRendererText()
+ self.combo_startat.pack_start(cell, True)
+ self.combo_startat.add_attribute(cell, 'text', 0)
+ vbox.pack_start(self.create_frame(_('Start At'), self.combo_startat))
+
+ self.vbox.show_all()
+
+ self.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+ self.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
+
+ def on_selection_changed_cb(self, selection, *args):
+ iter = selection.get_selected()[1]
+ self.selected_module = self.modules_model.get(iter, 0)[0]
+
+ old_start_at = None
+ old_start_at_iter = self.combo_startat.get_active_iter()
+ new_active_iter = None
+ if old_start_at_iter:
+ old_start_at = self.startat_model.get(old_start_at_iter, 0)[0]
+
+ self.startat_model.clear()
+ modulelist = self.app.module_set.get_module_list([self.selected_module],
+ ignore_suggests=self.app.config.ignore_suggests)
+ for module in modulelist:
+ iter = self.startat_model.append((module.name,))
+ if module.name == old_start_at:
+ new_active_iter = iter
+
+ if new_active_iter:
+ self.combo_startat.set_active_iter(new_active_iter)
+ else:
+ self.combo_startat.set_active_iter(self.startat_model[0].iter)
- try:
- p = subprocess.Popen(command, **kws)
- except OSError, e:
- raise CommandError(str(e))
-
- p.stdin.close()
- self._makeNonBlocking(p.stdout)
- self._makeNonBlocking(p.stderr)
-
- build_paused = False
- read_set = [p.stdout, p.stderr]
-
- while read_set:
- # Allow the frontend to get a little time
- self._runEventLoop()
-
- rlist, wlist, xlist = select.select(read_set, [], [], 0)
-
- if p.stdout in rlist:
- chunk = p.stdout.read()
- if chunk == '':
- p.stdout.close()
- read_set.remove(p.stdout)
- self._printToBuildOutput(chunk)
-
- if p.stderr in rlist:
- chunk = p.stderr.read()
- if chunk == '':
- p.stderr.close()
- read_set.remove(p.stderr)
- self._printToWarningOutput(chunk)
-
- # See if we should pause the current command
- if not build_paused and self._pauseBuild():
- print ("Pausing this guy, sending os.kill to %d", p.pid)
- os.kill(p.pid, signal.SIGSTOP)
- build_paused = True
- elif build_paused and not self._pauseBuild():
- print ("Continuing him")
- os.kill(p.pid, signal.SIGCONT)
- build_paused = False
-
- time.sleep(0.05)
-
- return p.wait()
+ def on_response_cb(self, dlg, response_id, *args):
+ if response_id != gtk.RESPONSE_OK:
+ return
- def start_build(self):
- self.window.show_all()
- def end_build(self, failures):
- if len(failures) == 0:
- self.message(_('success'))
- else:
- self.message(_('the following modules were not built:\n%s')
- % ', '.join(failures))
- def start_module(self, module):
- # Remember where we are in case something fails
- if have_gconf:
- client = gconf.client_get_default()
- client.set_string("/apps/jhbuild/start_at_module", module)
+ old_start_at_iter = self.combo_startat.get_active_iter()
+ self.startat = None
+ if old_start_at_iter:
+ self.startat = self.startat_model.get(old_start_at_iter, 0)[0]
- def handle_error(self, module, phase, nextphase, error, altphases):
- '''Ask the user what to do about an error.
+ return gtk.RESPONSE_OK
-
- Returns one of ERR_RERUN, ERR_CONT or ERR_GIVEUP.''' #"
+class PreferencesDialog(gtk.Dialog):
+ def __init__(self, parent, default_module=None):
+ gtk.Dialog.__init__(self, _('Preferences'), parent)
+ self.app = parent
+ self.create_ui()
+ self.connect('response', self.on_response_cb)
+ self.connect('delete-event', self.on_response_cb)
- if not self.config.interact:
- return 'fail'
+ def create_ui(self):
+ vbox = gtk.VBox(spacing=5)
+ vbox.set_border_width(5)
+ self.vbox.add(vbox)
- dialog = gtk.Dialog(_('Error during %(phase)s for module %(module)s')
- % {'phase':phase, 'module':module.name})
- dialog.add_button(_('_Try %s Again') % phase, 1)
- dialog.add_button(_('_Ignore Error'), 2)
- dialog.add_button(_('_Skip Module'), 3)
- dialog.add_button(_('_Terminal'), 4)
+ for key, label in (
+ ('nonetwork', _('Disable network access')),
+ ('alwaysautogen', _('Always run autogen.sh')),
+ ('nopoison', _('Don\'t poison modules on failure'))):
+ checkbutton = gtk.CheckButton(label)
+ checkbutton.set_active(getattr(self.app.config, key))
+ checkbutton.connect('toggled', self.on_toggled_key, key)
+ vbox.pack_start(checkbutton)
- for i, altphase in enumerate(altphases):
- dialog.add_button(_('Go to %s') % altphase, i + 5)
+ self.vbox.show_all()
+ self.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)
- text_view = gtk.TextView()
- text_view.set_buffer(self.build_text)
- text_view.set_wrap_mode(gtk.WRAP_WORD_CHAR)
+ def on_toggled_key(self, checkbutton, key):
+ setattr(self.app.config, key, checkbutton.get_active())
- scroller = gtk.ScrolledWindow()
- scroller.add(text_view)
- dialog.vbox.pack_start(scroller)
+ def on_response_cb(self, *args):
+ self.destroy()
+ self.app.preference_dialog = None
- scroller.set_size_request(-1, 250)
- scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
- scroller.set_shadow_type(gtk.SHADOW_IN)
- scroller.set_border_width(12)
-
- while True:
- #self.message('error during %s for module %s' % (phase, module.name))
-
- text_view.scroll_to_iter(self.build_text.get_end_iter(), 0.0, True, 0.5, 0.5)
- dialog.show_all()
-
- val = dialog.run()
-
- if val != 4:
- dialog.hide()
- # If the dialog was destroyed, interpret that as try again.
- if val in (1, gtk.RESPONSE_NONE, gtk.RESPONSE_DELETE_EVENT):
- return phase
- elif val == 2:
- return nextphase
- elif val == 3:
- return 'fail'
- elif val == 4:
- command = 'cd %s; %s' % (module.get_builddir(self),
- self.terminal_command)
- os.system(command)
- else:
- return altphases[val - 5]
-
- def _createWindow(self):
- glade_filename = get_glade_filename()
- self.glade = gtk.glade.XML(glade_filename)
-
- self.window = self.glade.get_widget("BuildWindow")
- self.build_progress = self.glade.get_widget("BuildProgressBar")
- self.build_text_view = self.glade.get_widget("BuildText")
- self.current_status_label = self.glade.get_widget("CurrentStatusLabel")
- self.pause_button = self.glade.get_widget("BuildPauseButton")
- self.cancel_button = self.glade.get_widget("BuildCancelButton")
- #self.expander_button = self.glade.get_widget("ExpanderButton")
- #self.expander_arrow = self.glade.get_widget("ExpanderArrow")
-
- self.window.connect('destroy', lambda win: sys.exit())
- self.cancel_button.connect('clicked', lambda button: sys.exit())
- #self.expander_button.connect('activate',
-
- self.tag_table = gtk.TextTagTable()
- self.build_text = gtk.TextBuffer(self.tag_table)
- self.warning_tag = self.build_text.create_tag("warning")
- self.warning_tag.set_property("foreground", "red")
- self.build_text_view.set_buffer(self.build_text)
- self.build_text_view.set_wrap_mode(gtk.WRAP_WORD)
- self.iter = self.build_text.get_end_iter()
- self.ins_mark = self.build_text.create_mark ("jhbuild-mark", self.iter, True);
-
-BUILD_SCRIPT = GtkBuildScript
+BUILD_SCRIPT = AppWindow
diff --cc jhbuild/frontends/terminal.py
index 582305a,c6e62e4..77a11b8
--- a/jhbuild/frontends/terminal.py
+++ b/jhbuild/frontends/terminal.py
@@@ -249,10 -249,10 +249,10 @@@ class TerminalBuildScript(buildscript.B
print module,
print
- def handle_error(self, module, state, nextstate, error, altstates):
+ def handle_error(self, module, phase, nextphase, error, altphases):
'''handle error during build'''
- summary = _('Error during stage %(stage)s of %(module)s') % {
- 'stage':state, 'module':module.name}
- summary = _('error during phase %(phase)s of %(module)s') % {
++ summary = _('Error during phase %(phase)s of %(module)s') % {
+ 'phase': phase, 'module':module.name}
try:
error_message = error.args[0]
self.message('%s: %s' % (summary, error_message))
@@@ -279,15 -278,18 +278,18 @@@
return 'fail'
while True:
print
- uprint(' [1] %s' % _('Rerun stage %s') % state)
- uprint(' [2] %s' % _('Ignore error and continue to %s') % nextstate)
- uprint(_(' [1] rerun phase %s') % phase)
++ uprint(' [1] %s' % _('Rerun phase %s') % phase)
+ if nextphase:
- uprint(_(' [2] ignore error and continue to %s') % nextphase)
++ uprint(' [2] %s' % _('Ignore error and continue to %s') % nextphase)
+ else:
- uprint(_(' [2] ignore error and continue to next module'))
- uprint(_(' [3] give up on module'))
- uprint(_(' [4] start shell'))
- uprint(_(' [5] reload configuration'))
++ uprint(' [2] %s' % _('Ignore error and continue to next module'))
+ uprint(' [3] %s' % _('Give up on module'))
+ uprint(' [4] %s' % _('Start shell'))
+ uprint(' [5] %s' % _('Reload configuration'))
nb_options = i = 6
- for altstate in altstates:
- uprint(' [%d] %s' % (i, _('Go to stage %s') % altstate))
- i = i + 1
- for altphase in (altphases or []):
- uprint(_(' [%d] go to phase %s') % (i, altphase))
- i = i + 1
++ for altphase in altphases:
++ uprint(' [%d] %s' % (i, _('Go to phase %s') % altphase))
++ i += 1
val = raw_input(uencode(_('choice: ')))
val = val.strip()
if val == '1':
diff --cc jhbuild/modtypes/__init__.py
index 664545d,cd67654..b8e4637
--- a/jhbuild/modtypes/__init__.py
+++ b/jhbuild/modtypes/__init__.py
@@@ -181,18 -155,21 +155,21 @@@ class Package
"""run a particular part of the build for this package.
Returns a tuple of the following form:
- (next-state, error-flag, [other-states])
+ (error-flag, [other-phases])
"""
- method = getattr(self, 'do_' + state)
+ method = getattr(self, 'do_' + phase)
try:
method(buildscript)
- except SkipToState, e:
- return (e.state, None, None)
except (CommandError, BuildStateError), e:
- return (self._next_state(buildscript, state),
- e, method.error_states)
- error_phases = None
++ error_phases = []
+ if hasattr(method, 'error_phases'):
+ error_phases = method.error_phases
+ return (e, error_phases)
else:
- return (self._next_state(buildscript, state), None, None)
+ return (None, None)
+
+ def has_phase(self, phase):
+ return hasattr(self, 'do_' + phase)
def check_build_policy(self, buildscript):
if not buildscript.config.build_policy in ('updated', 'updated-deps'):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]