summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/gnome_module.py15
-rw-r--r--modules/package_module.py1
-rw-r--r--modules/portage_module.py13
3 files changed, 18 insertions, 11 deletions
diff --git a/modules/gnome_module.py b/modules/gnome_module.py
index ef091ed..ac6d045 100644
--- a/modules/gnome_module.py
+++ b/modules/gnome_module.py
@@ -118,7 +118,7 @@ class GNOME:
# cache the results
cache = simple_cache_module.SimpleCache()
for release_package in release_packages:
- latest_package = self.findpackage(release_package.name, latest_packages)
+ latest_package = portage_module.findpackage(release_package.name, latest_packages)
if latest_package != None:
cache.write_to_queue(release_package.name_plus_version_plus_revision, latest_package.name_plus_version_plus_revision)
else:
@@ -154,13 +154,6 @@ class GNOME:
return return_latest
- def findpackage(self, name, packages):
- for package in packages:
- if package.name == name:
- return package
-
- return None
-
import portage_module
def compare_packages(release_packages, latest_packages, packages_in_portage):
# we care about 5 cases
@@ -177,15 +170,15 @@ def compare_packages(release_packages, latest_packages, packages_in_portage):
for package in release_packages:
color = None
release_package = package
- latest_package = GNOME().findpackage(package.name, latest_packages)
- portage_package = GNOME().findpackage(package.name, packages_in_portage)
+ latest_package = portage_module.findpackage(package.name, latest_packages)
+ portage_package = portage_module.findpackage(package.name, packages_in_portage)
if portage_package == None:
status = package_module.Status.NotFound
# we need to create a phony package since findpackage
# returns None
portage_package = package_module.Package(package.name)
-
+
elif portage_module.best_version_test(portage_package.name_plus_version, \
release_package.name_plus_version) == 2:
status = package_module.Status.NeedUpdate
diff --git a/modules/package_module.py b/modules/package_module.py
index 0b20726..f4a5dbb 100644
--- a/modules/package_module.py
+++ b/modules/package_module.py
@@ -16,6 +16,7 @@ class Package:
"gtk2":"gtk2-perl",
"gnome2-vfs":"gnome2-vfs-perl",
"pkg-config":"pkgconfig",
+ "glade3":"dev-util/glade",
}
def __init__(self, raw_data):
diff --git a/modules/portage_module.py b/modules/portage_module.py
index f3e37c6..ebc91f7 100644
--- a/modules/portage_module.py
+++ b/modules/portage_module.py
@@ -29,6 +29,10 @@ def find_category(package_name):
package = portage.catsplit(package)
return package[0]
+# return 'pkg' for a package name of form 'pkg' or 'cat/pkg'
+def get_pkgname(package):
+ return portage.catsplit(package)[-1]
+
# given category/packagename-version-revision, find whether it is masked or not
def isMasked():
pass
@@ -37,6 +41,15 @@ def isMasked():
def best_version(package_list):
return portage.best(package_list)
+# find a given package in a list of packages (assuming package may be of the
+# form 'pkg' or 'cat/pkg')
+def findpackage(name, packages):
+ for package in packages:
+ if package.name == name or package.name == get_pkgname(name):
+ return package
+
+ return None
+
# which package is the higher version?
# returns 0 for equal
# 1 for package1