summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--geneticone/backend/portage_helper.py37
-rw-r--r--geneticone/gui/windows.py12
2 files changed, 37 insertions, 12 deletions
diff --git a/geneticone/backend/portage_helper.py b/geneticone/backend/portage_helper.py
index 58f0081..3346aaf 100644
--- a/geneticone/backend/portage_helper.py
+++ b/geneticone/backend/portage_helper.py
@@ -69,35 +69,58 @@ def find_world_packages ():
list = gentoolkit.find_world_packages()
return geneticize_list(list[0]),geneticize_list(list[1])
-def find_all_installed_packages (name=None):
+def find_all_installed_packages (name=None, withVersion=True):
"""Returns a list of all installed packages matching ".*name.*".
Returns ALL installed packages if name is None."""
- return geneticize_list(gentoolkit.find_all_installed_packages(find_lambda(name)))
+ if withVersion:
+ return geneticize_list(gentoolkit.find_all_installed_packages(find_lambda(name)))
+ else:
+ t = vartree.dbapi.cp_all()
+ if name:
+ t = filter(find_lambda(name),t)
+ return t
def find_all_uninstalled_packages (name=None):
"""Returns a list of all uninstalled packages matching ".*name.*".
Returns ALL uninstalled packages if name is None."""
return geneticize_list(gentoolkit.find_all_uninstalled_packages(find_lambda(name)))
-def find_all_packages (name=None):
+def find_all_packages (name=None, withVersion = True):
"""Returns a list of all packages matching ".*name.*".
Returns ALL packages if name is None."""
- return geneticize_list(gentoolkit.find_all_packages(find_lambda(name)))
-
-def find_all_world_files (name=None):
+ if (withVersion):
+ return geneticize_list(gentoolkit.find_all_packages(find_lambda(name)))
+ else:
+ t = porttree.dbapi.cp_all()
+ t += vartree.dbapi.cp_all()
+ t = unique_array(t)
+ if name:
+ t = filter(find_lambda(name),t)
+ return t
+
+def find_all_world_packages (name=None):
"""Returns a list of all world packages matching ".*name.*".
Returns ALL world packages if name is None."""
world = filter(find_lambda(name), [x.get_cpv() for x in find_world_packages()[0]])
world = unique_array(world)
return [package.Package(x) for x in world]
-def find_all_system_files (name=None):
+def find_all_system_packages (name=None):
"""Returns a list of all system packages matching ".*name.*".
Returns ALL system packages if name is None."""
sys = filter(find_lambda(name), [x.get_cpv() for x in find_system_packages()[0]])
sys = unique_array(sys)
return [package.Package(x) for x in sys]
+def get_all_versions (cp):
+ t = porttree.dbapi.cp_list(cp)
+ t += vartree.dbapi.cp_list(cp)
+ t = unique_array(t)
+ return geneticize_list(t)
+
+def get_all_installed_versions (cp):
+ return geneticize_list(vartree.dbapi.cp_list(cp))
+
def list_categories (name=None):
"""Returns a list of categories matching ".*name.*" or all categories."""
categories = gentoolkit.settings.categories
diff --git a/geneticone/gui/windows.py b/geneticone/gui/windows.py
index bfc279d..1cb39a1 100644
--- a/geneticone/gui/windows.py
+++ b/geneticone/gui/windows.py
@@ -90,8 +90,8 @@ class PackageWindow:
#self.window.connect("configure-event", self.cbSizeCheck)
# packages and installed packages
- self.packages = backend.sort_package_list(backend.find_packages(cp, masked=True))
- self.instPackages = backend.sort_package_list(backend.find_installed_packages(cp, masked=True))
+ self.packages = backend.sort_package_list(backend.get_all_versions(cp))
+ self.instPackages = backend.sort_package_list(backend.get_all_installed_versions(cp))
# main structure - the table
self.table = gtk.Table(rows=4,columns=2)
@@ -545,10 +545,12 @@ class MainWindow:
if name:
if name not in self.packages and not force: # only calc packages if not already done
self.packages[name] = []
- for p in unique_array([x.get_name() for x in backend.find_all_packages(name+"/")]):
- if backend.find_installed_packages(name+"/"+p, masked=True) != []:
+ list = backend.find_all_packages(name = name+"/", withVersion = False)
+ installed = backend.find_all_installed_packages(name = name+"/", withVersion=False)
+ for p in list:
+ if p in installed:
p += "*" # append a '*' if the package is installed
- self.packages[name].append(p)
+ self.packages[name].append(p.split("/")[1])
for p in self.packages[name]:
store.append([p])