summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMart Raudsepp <leio@gentoo.org>2008-09-22 08:30:43 +0300
committerMart Raudsepp <leio@gentoo.org>2008-09-22 08:30:43 +0300
commit545930b557f3a10f7f58062a5612f9966787abad (patch)
tree4fc3828c477e6c840dd77380d655e10b90ecc83b
parentDie with a more helpful error if the versions file is not available (diff)
downloadgentoo-bumpchecker-545930b557f3a10f7f58062a5612f9966787abad.tar.gz
gentoo-bumpchecker-545930b557f3a10f7f58062a5612f9966787abad.tar.bz2
gentoo-bumpchecker-545930b557f3a10f7f58062a5612f9966787abad.zip
Fix packages with name mapping to report correct status
Packages such as gconf, glade and libxmlpp almost always reported compliance with dark green color, even though latest available and/or official release version were newer than portage version. The version comparison is done via the portage module best() function, which takes a list of package strings (package name including version number) and returns the newest of it. best_version_test() takes Package.name_plus_version strings, but those weren't fixed up according to the special_cases name mapping in Package.handle_special_cases(), and portage gets package strings such as "gconf-2.22.0" and "GConf-2.23.2" for picking the best version of it, and it considers lower case gconf-2.22.0 newer than GConf-2.23.2, probably due to some specific logic or non-handling of different string package names. To fix it, instead of uglifying handle_special_cases() with setting of name_plus_version and name_plus_version_plus_revision, convert them into read-only attributes that get constructed on the fly -- properties with only a getter. For readability decorators are used, making >=python-2.4 a requirement, with which I see no problem in a developer tool.
-rw-r--r--modules/package_module.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/package_module.py b/modules/package_module.py
index f4a5dbb..c86e44f 100644
--- a/modules/package_module.py
+++ b/modules/package_module.py
@@ -25,8 +25,6 @@ class Package:
self.name = None
self.version = None
self.revision = None
- self.name_plus_version = None
- self.name_plus_version_plus_revision = None
self.major_minor = None
self.raw_name = None
@@ -35,7 +33,15 @@ class Package:
self.parse_raw_string(raw_data)
self.handle_special_cases()
-
+
+ @property
+ def name_plus_version(self):
+ return self.name + "-" + self.version
+
+ @property
+ def name_plus_version_plus_revision(self):
+ return self.name_plus_version + "-" + self.revision
+
def handle_special_cases(self):
if self.name in self.special_cases:
self.name = self.special_cases[self.name]
@@ -46,9 +52,6 @@ class Package:
#[cat, pkgname, version, rev ]
self.category,self.name,self.version,self.revision = split_string
self.raw_name = self.name
- self.name_plus_version = self.name + "-" + self.version
- self.name_plus_version_plus_revision = self.name + "-" + self.version + "-" + \
- self.revision
self.major_minor = self.parse_mm(self.version)
else:
print "Error, " + raw_string + " is not a valid package!"