summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2006-10-16 13:45:47 +0000
committernecoro <>2006-10-16 13:45:47 +0000
commite721b6e30776a75fe80a297572054cccc7962c07 (patch)
tree4e8286e6588233f71f266ed56f83452449fb7d8a
parent2d63bdab212624625f36026f8028b1105bd8edf7 (diff)
downloadportato-e721b6e30776a75fe80a297572054cccc7962c07.tar.gz
portato-e721b6e30776a75fe80a297572054cccc7962c07.tar.bz2
portato-e721b6e30776a75fe80a297572054cccc7962c07.zip
Speedup for "--deep"; loading sign for update world; handling packages not in portage system (anymore)
-rw-r--r--doc/Changelog5
-rw-r--r--geneticone/backend/package.py19
-rw-r--r--geneticone/backend/portage_helper.py13
-rw-r--r--geneticone/gui/gui_helper.py1
-rw-r--r--geneticone/gui/windows.py47
5 files changed, 67 insertions, 18 deletions
diff --git a/doc/Changelog b/doc/Changelog
index c74a83e..c63b429 100644
--- a/doc/Changelog
+++ b/doc/Changelog
@@ -1,7 +1,10 @@
-0.4.1:
+0.4.5:
- bug fixing (again ;D)
- added "oneshot"
- redesign
+- added "update world" - ability
+- handled installed packages which are not in portage anymore
+- allowed to reload portage
0.4.0:
- smashed bugs
diff --git a/geneticone/backend/package.py b/geneticone/backend/package.py
index 8991117..0f53e3c 100644
--- a/geneticone/backend/package.py
+++ b/geneticone/backend/package.py
@@ -31,15 +31,26 @@ class Package (gentoolkit.Package):
if isinstance(cpv, gentoolkit.Package):
cpv = cpv.get_cpv()
gentoolkit.Package.__init__(self, cpv)
- self._status = portage.getmaskingstatus(self.get_cpv(), settings = gentoolkit.settings)
+ try:
+ self._status = portage.getmaskingstatus(self.get_cpv(), settings = gentoolkit.settings)
+ except KeyError: # package is not located in the system
+ self._status = None
+ def is_in_system (self):
+ """Returns False if the package could not be found in the portage system.
+
+ @return: True if in portage system; else False
+ @rtype: boolean"""
+
+ return (self._status != None)
+
def is_missing_keyword(self):
"""Returns True if the package is missing the needed keyword.
@return: True if keyword is missing; else False
@rtype: boolean"""
- if "missing keyword" in self._status:
+ if self._status and "missing keyword" in self._status:
return True
return False
@@ -60,7 +71,7 @@ class Package (gentoolkit.Package):
else: # keywords are taken into account
status = flags.new_testing_status(self.get_cpv())
if status == None: # we haven't changed it in any way
- if testArch+" keyword" in self._status:
+ if self._status and testArch+" keyword" in self._status:
return True
return False
else:
@@ -92,7 +103,7 @@ class Package (gentoolkit.Package):
else:
debug("BUG in flags.new_masking_status. It returns",status)
else: # we have not touched the status
- if "profile" in self._status or "package.mask" in self._status:
+ if self._status and ("profile" in self._status or "package.mask" in self._status):
return True
return False
diff --git a/geneticone/backend/portage_helper.py b/geneticone/backend/portage_helper.py
index 9faf953..3a6eab7 100644
--- a/geneticone/backend/portage_helper.py
+++ b/geneticone/backend/portage_helper.py
@@ -260,6 +260,7 @@ def update_world (newuse = False, deep = False):
checked = []
updating = []
+ raw_checked = []
def check (p, deep = False):
"""Checks whether a package is updated or not."""
if p.get_cp() in checked: return
@@ -277,11 +278,13 @@ def update_world (newuse = False, deep = False):
if deep:
for i in p.get_matched_dep_packages():
- bm = find_best_match(i)
- if not bm:
- debug("Bug? No best match could be found:",i)
- else:
- check(bm, deep)
+ if i not in raw_checked:
+ raw_checked.append(i)
+ bm = find_best_match(i)
+ if not bm:
+ debug("Bug? No best match could be found:",i)
+ else:
+ check(bm, deep)
for p in packages:
if not p: continue # if a masked package is installed we have "None" here
diff --git a/geneticone/gui/gui_helper.py b/geneticone/gui/gui_helper.py
index 5d93822..5540570 100644
--- a/geneticone/gui/gui_helper.py
+++ b/geneticone/gui/gui_helper.py
@@ -412,6 +412,7 @@ class EmergeQueue:
if process: process.wait()
for p in packages:
+ if p in ["world", "system"]: continue
cat = backend.split_package_name(p)[0] # get category
while cat[0] in ["=",">","<","!"]:
cat = cat[1:]
diff --git a/geneticone/gui/windows.py b/geneticone/gui/windows.py
index 9af3e01..9d4db62 100644
--- a/geneticone/gui/windows.py
+++ b/geneticone/gui/windows.py
@@ -9,7 +9,7 @@
#
# Written by Necoro d.M. <necoro@necoro.net>
-VERSION = "0.4.1-svn"
+VERSION = "0.4.5-svn"
CONFIG_LOCATION = "/etc/geneticone/geneticone.cfg"
# gtk stuff
@@ -355,6 +355,11 @@ class PackageWindow (AbstractDialog):
self.missing_label.set_no_show_all(True)
self.table.attach(self.missing_label, 1, 2, 1, 2, yoptions = gtk.FILL)
+ self.not_in_sys_label = gtk.Label("<b>Installed, but not in portage anymore</b>")
+ self.not_in_sys_label.set_use_markup(True)
+ self.not_in_sys_label.set_no_show_all(True)
+ self.table.attach(self.not_in_sys_label, 1, 2, 1, 2, yoptions = gtk.FILL)
+
# use list
self.useList = self.build_use_list()
self.useListScroll = gtk.ScrolledWindow()
@@ -469,14 +474,21 @@ class PackageWindow (AbstractDialog):
self.useListScroll.add(self.useList)
pkg = self.actual_package()
- if pkg.is_missing_keyword():
- self.missing_label.show()
+ if (not pkg.is_in_system()) or pkg.is_missing_keyword():
+ if not pkg.is_in_system():
+ self.missing_label.hide()
+ self.not_in_sys_label.show()
+ else: # missing keyword
+ self.missing_label.show()
+ self.not_in_sys_label.hide()
+
self.installedCheck.hide()
self.maskedCheck.hide()
self.testingCheck.hide()
self.emergeBtn.set_sensitive(False)
else:
self.missing_label.hide()
+ self.not_in_sys_label.hide()
self.installedCheck.show()
self.maskedCheck.show()
self.testingCheck.show()
@@ -747,6 +759,7 @@ class MainWindow:
<menubar name="bar">
<menu action="File">
<menuitem action="Prefs" />
+ <menuitem action="Reload" />
<separator />
<menuitem action="Close" />
</menu>
@@ -773,6 +786,7 @@ class MainWindow:
("Help", None, "_?"),
("Sync", None, "_Sync", None, None, self.cb_sync_clicked),
("Prefs", None, "_Preferences", None, None, lambda x: PreferenceWindow(self.window, self.cfg)),
+ ("Reload", None, "_Reload Portage", None, None, self.cb_reload_clicked),
("Close", None, "_Close", None, None, self.cb_destroy),
("About", None, "_About", None, None, lambda x: AboutWindow(self.window))])
group.add_action(self.emergeAction)
@@ -917,13 +931,24 @@ class MainWindow:
not_root_dialog()
else:
- updating = backend.update_world(newuse = self.cfg.get_boolean(self.cfg.const["newuse_opt"]), deep = self.cfg.get_boolean(self.cfg.const["deep_opt"]))
+
+ def cb_idle():
+ try:
+ updating = backend.update_world(newuse = self.cfg.get_boolean(self.cfg.const["newuse_opt"]), deep = self.cfg.get_boolean(self.cfg.const["deep_opt"]))
+
+ debug("updating list:", [(x.get_cpv(), y.get_cpv()) for x,y in updating])
+ for pkg, old_pkg in updating:
+ self.queue.append(pkg.get_cpv(), options=["update from "+old_pkg.get_version()])
- debug("updating list:", updating)
- for pkg, old_pkg in updating:
- self.queue.append(pkg.get_cpv(), options=["update from "+old_pkg.get_version()])
+ if len(updating): self.doUpdate = True
+ finally:
+ self.window.window.set_cursor(None)
+ return False
- if len(updating): self.doUpdate = True
+ watch = gtk.gdk.Cursor(gtk.gdk.WATCH)
+ self.window.window.set_cursor(watch)
+
+ gobject.idle_add(cb_idle)
return True
@@ -931,6 +956,12 @@ class MainWindow:
self.notebook.set_current_page(1)
self.queue.sync()
+ def cb_reload_clicked (self, action):
+ backend.reload_settings()
+ del self.db
+ self.db = Database()
+ self.db.populate()
+
def cb_search_clicked (self, button, data = None):
"""Do a search."""
if self.searchEntry.get_text() != "":