From ccee291737673926730f8573c22bb348b10438eb Mon Sep 17 00:00:00 2001 From: necoro <> Date: Sun, 12 Nov 2006 17:41:03 +0000 Subject: added control field for specifying the sync command --- doc/Changelog | 1 + etc/geneticone.cfg | 3 + geneticone/gui/gtk/glade/geneticone.glade | 437 +++++++++++++++++------------- geneticone/gui/gtk/windows.py | 19 +- geneticone/gui/gui_helper.py | 24 +- 5 files changed, 278 insertions(+), 206 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 87595b3..21752a8 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,5 +1,6 @@ 0.5.1: - new config parser and new config-layout +- added sync-command option 0.5.0: - rewritten GTK-Frontend using Glade diff --git a/etc/geneticone.cfg b/etc/geneticone.cfg index 2177cd7..c7d1ea5 100644 --- a/etc/geneticone.cfg +++ b/etc/geneticone.cfg @@ -21,6 +21,9 @@ ; controls debug output - boolean value debug = True +; the command used for syncing portage - string value +synccommand = emerge --sync + ; control the same-named "emerge --update" options - boolean values newuse = False deep = False diff --git a/geneticone/gui/gtk/glade/geneticone.glade b/geneticone/gui/gtk/glade/geneticone.glade index 58caa7c..fa060df 100644 --- a/geneticone/gui/gtk/glade/geneticone.glade +++ b/geneticone/gui/gtk/glade/geneticone.glade @@ -223,49 +223,73 @@ 4 2 - + True - 1 - True - - - True - True - Installed - True - - - - False - - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Masked - True - - - False - 1 - + + + 2 + 2 + 3 + 5 + 5 + + + + + True - - True - True - Testing - True - - - - False - 2 - + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <b>Installed, but not in portage anymore</b> + True + 1 2 @@ -318,79 +342,55 @@ - - True - True - <b>Installed, but not in portage anymore</b> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - + True + 1 + True - + + True + True + Installed + True + + + + False + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - + True + True + Masked + True + + + False + 1 + + + + + True + True + Testing + True + + + + False + 2 + + 1 2 - 2 - 3 - 5 - 5 + 1 + 2 + GTK_FILL @@ -649,6 +649,55 @@ + + + True + 0 + + + True + 5 + 12 + 5 + + + True + + + True + Sync command: + + + False + + + + + True + + + 1 + + + + + + + + + True + <b>Sync Options</b> + True + + + label_item + + + + + 1 + + True @@ -697,7 +746,7 @@ - 1 + 2 @@ -725,186 +774,186 @@ - + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True - 1 - 2 - 3 - 4 + 7 + 8 + 5 - + True 0 - File name to use, if package.use is a directory: + 5 + <u><i>Testing Keywords</i></u> + True True - 3 - 4 + 4 + 5 + 5 - + True - Add only exact version to package.use - True + 0 + 5 + <u><i>Use-Flags</i></u> + True + True + + + 1 + 2 + 6 + + + + + True + + + True + 0 + GTK_SHADOW_OUT + + + True + 0 + <u>You may use the following placeholders:</u> + +<i>$(cat)</i>: category +<i>$(pkg)</i>: package name +<i>$(cat-1)/$(cat-2)</i>: first/second part of the category + True + + + + + + label_item + + + + 2 - 2 - 3 - + True - Add only exact version to package.keywords + Add only exact version to package.mask/package.unmask True 2 - 5 - 6 + 8 + 9 - + True 0 - File name to use, if package.keywords is a directory: + File name to use, if package.mask/package.unmask is a directory: True - 6 - 7 + 9 + 10 - + True 1 2 - 6 - 7 + 9 + 10 - + True 1 2 - 9 - 10 + 6 + 7 - + True 0 - File name to use, if package.mask/package.unmask is a directory: + File name to use, if package.keywords is a directory: True - 9 - 10 + 6 + 7 - + True - Add only exact version to package.mask/package.unmask + Add only exact version to package.keywords True 2 - 8 - 9 + 5 + 6 - + True - - - True - 0 - GTK_SHADOW_OUT - - - True - 0 - <u>You may use the following placeholders:</u> - -<i>$(cat)</i>: category -<i>$(pkg)</i>: package name -<i>$(cat-1)/$(cat-2)</i>: first/second part of the category - True - - - - - - label_item - - - - + Add only exact version to package.use + True 2 + 2 + 3 - - True - 0 - 5 - <u><i>Use-Flags</i></u> - True - True - - - 1 - 2 - 6 - - - - + True 0 - 5 - <u><i>Testing Keywords</i></u> - True + File name to use, if package.use is a directory: True - 4 - 5 - 5 + 3 + 4 - + True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - 7 - 8 - 5 + 1 + 2 + 3 + 4 @@ -923,7 +972,7 @@ - 2 + 3 @@ -952,7 +1001,7 @@ - 3 + 4 diff --git a/geneticone/gui/gtk/windows.py b/geneticone/gui/gtk/windows.py index 659c35f..8c6febb 100644 --- a/geneticone/gui/gtk/windows.py +++ b/geneticone/gui/gtk/windows.py @@ -170,9 +170,10 @@ class PreferenceWindow (AbstractDialog): # all edits in the window # widget name -> option name edits = { - "maskFileEdit" : "maskFile_opt", - "testFileEdit" : "testingFile_opt", - "useFileEdit" : "useFile_opt" + "maskFileEdit" : "maskFile_opt", + "testFileEdit" : "testingFile_opt", + "useFileEdit" : "useFile_opt", + "syncCommandEdit" : "syncCmd_opt" } def __init__ (self, parent, cfg): @@ -192,7 +193,6 @@ class PreferenceWindow (AbstractDialog): hintEB = self.tree.get_widget("hintEB") hintEB.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("#f3f785")) - for box in self.checkboxes: self.tree.get_widget(box).\ set_active(self.cfg.get_boolean(\ @@ -735,6 +735,9 @@ class MainWindow (Window): flags.write_use_flags() if len(flags.new_masked)>0 or len(flags.new_unmasked)>0 or len(flags.newTesting)>0: + debug("new masked:",flags.new_masked) + debug("new unmasked:", flags.new_unmasked) + debug("new testing:", flags.newTesting) changed_flags_dialog("masking keywords") flags.write_masked() flags.write_testing() @@ -799,7 +802,13 @@ class MainWindow (Window): not_root_dialog() else: self.notebook.set_current_page(self.CONSOLE_PAGE) - self.queue.sync() + cmd = self.cfg.get(self.cfg.const["syncCmd_opt"]) + + if cmd != "emerge --sync": + cmd = cmd.split() + self.queue.sync(cmd) + else: + self.queue.sync() @Window.watch_cursor def cb_reload_clicked (self, action): diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py index d116877..edddc53 100644 --- a/geneticone/gui/gui_helper.py +++ b/geneticone/gui/gui_helper.py @@ -39,7 +39,8 @@ class Config: "debug_opt" : "debug", "oneshot_opt" : "oneshot", "deep_opt" : "deep", - "newuse_opt" : "newuse" + "newuse_opt" : "newuse", + "syncCmd_opt" : "synccommand" } def __init__ (self, cfgFile): @@ -421,7 +422,7 @@ class EmergeQueue: self.db.reload(cat) debug("Category %s refreshed" % cat) - def _emerge (self, options, packages, it): + def _emerge (self, options, packages, it, command = ["/usr/bin/python","/usr/bin/emerge"]): """Calls emerge and updates the terminal. @param options: options to send to emerge @@ -429,14 +430,16 @@ class EmergeQueue: @param packages: packages to emerge @type packages: list @param it: Iterators which point to these entries whose children will be removed after completion. - @type it: Iterator[]""" + @type it: Iterator[] + @param command: the command to execute - default is "/usr/bin/python /usr/bin/emerge" + @type command: string[]""" # open tty (master, slave) = pty.openpty() self.console.set_pty(master) # start emerge - process = Popen(["/usr/bin/python","/usr/bin/emerge"]+options+packages, stdout = slave, stderr = STDOUT, shell = False) + process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False) # start thread waiting for the stop of emerge Thread(target=self._update_packages, args=(packages+self.deps.keys(), process)).start() @@ -511,9 +514,16 @@ class EmergeQueue: self._emerge(options, ["world"], [self.emergeIt]) - def sync (self): - """Calls "emerge --sync".""" - self._emerge(["--sync"], [], []) + def sync (self, command = None): + """Calls "emerge --sync". + + @param command: command to execute to sync. If None "emerge --sync" is taken. + @type command: string[]""" + + if command == None: + self._emerge(["--sync"], [], []) + else: + self._emerge([],[],[], command = command) def remove_with_children (self, it, removeNewFlags = True): """Convenience function which removes all children of an iterator and than the iterator itself. -- cgit v1.2.3