Excerpts from Maciej Bliziński's message of Sun Mar 27 09:59:50 -0400 2011:
Ok, here's the version I think is ready for commit... Thanks -Ben Index: package.py =================================================================== --- package.py (revision 13944) +++ package.py (working copy) @@ -358,6 +358,38 @@ fd.close() return depends + def GetObsoletedBy(self): + """Collects obsolescence information from the package if it exists + + Documentation: + http://wiki.opencsw.org/obsoleting-packages + + Returns: + a tuple (bool, list) of (syntax_ok, obsoleted_by) + + If the package has not been obsoleted or the package predates the + implementation of this mechanism, the list is empty. If the + package provides obsolescence information but the format of the + information is invalid, syntax_ok will be False and the list will + be empty. + """ + + obsoleted_syntax_ok = True + obsoleted_by = [] + obsoleted_by_path = os.path.join(self.directory, "install", "obsolete") + if not os.path.exists(obsoleted_by_path): + return obsoleted_by + + with open(obsoleted_by_path, "r") as fd: + for line in fd: + fields = re.split(c.WS_RE, line) + if len(fields) < 2: + obsoleted_syntax_ok = False + continue + pkgname, catalogname = fields[0:2] + obsoleted_by.append((pkgname, catalogname)) + return { "syntax_ok": obsoleted_syntax_ok, "by": obsoleted_by } + def CheckPkgpathExists(self): if not os.path.isdir(self.directory): raise PackageError("%s does not exist or is not a directory" -- Ben Walton Systems Programmer - CHASS University of Toronto C:416.407.5610 | W:416.978.4302 _______________________________________________ devel mailing list devel@lists.opencsw.org https://lists.opencsw.org/mailman/listinfo/devel