--- gentoolkit-0.2.2_pre4/src/equery/equery 2006-04-03 00:18:29.000000000 +0200 +++ gentoolkit-0.2.2_pre4/src/equery/equery 2006-06-19 17:59:04.038091000 +0200 @@ -19,7 +19,7 @@ import time import string import types - +from time import localtime, strftime # portage (output module) and gentoolkit need special path modifications sys.path.insert(0, "/usr/lib/portage/pym") sys.path.insert(0, "/usr/lib/gentoolkit/pym") @@ -933,7 +933,10 @@ (query, opts) = self.parseArgs(args) matches = gentoolkit.find_packages(query, opts["includeMasked"]) - matches = gentoolkit.sort_package_list(matches) + if Config[time_sort]: + matches = gentoolkit.sort_package_list_by_time(matches) + else: + matches = gentoolkit.sort_package_list(matches) if matches: print_info(0, os.path.normpath(matches[-1].get_ebuild_path())) @@ -1249,9 +1252,10 @@ newmatches += dups[mykey] matches = newmatches - - matches = gentoolkit.sort_package_list(matches) - + if Config.has_key("time_sort") and Config["time_sort"]: + matches = gentoolkit.sort_package_list_by_time(matches) + else: + matches = gentoolkit.sort_package_list(matches) # If no version supplied, fix regular expression if ver == ".*": ver = "[0-9]+[^-]*" @@ -1302,7 +1306,7 @@ if Config["piping"]: print_info(0, pkg.get_cpv()) else: - print_info(0, "[" + pp.installedflag(pfxmodes[status]) + "] [" + pp.maskflag(maskmodes[pkgmask]) + "] " + pp.cpv(pkg.get_cpv()) + " (" + pp.slot(slot) + ")") + print_info(0, "[" + pp.installedflag(pfxmodes[status]) + "] [" + pp.maskflag(maskmodes[pkgmask]) + "] [ "+strftime("%c",localtime(os.stat("/var/db/pkg/"+ pkg.get_cpv() + "/" + pkg.get_cpv().split('/',1)[1] + ".ebuild").st_mtime)) + " ]" + pp.cpv(pkg.get_cpv()) + " (" + pp.slot(slot) + ")") def _print_overlay(self, matches, rx): self._generic_print( @@ -1561,6 +1565,7 @@ print_info(0, pp.globaloption(" -h, --help") + " - this help screen") print_info(0, pp.globaloption(" -V, --version") + " - display version info") print_info(0, pp.globaloption(" -N, --no-pipe") + " - turn off pipe detection") + print_info(0, pp.globaloption(" -t, --time-sort") + " - sort by time") print_info(0, "where " + pp.command("command") + "(" + pp.command("short") + ") is one of") keys = Known_commands.keys() @@ -1618,6 +1623,8 @@ Config["piping"] = False elif x in ["-q","--quiet"]: Config["verbosityLevel"] = 0 + elif x in ["-t","--time-sort"]: + Config["time_sort"] = 1 elif expand(x) in Known_commands.keys(): command = Known_commands[expand(x)] local_opts = args[i+1:] --- gentoolkit-0.2.2_pre4/src/gentoolkit/__init__.py 2006-04-03 00:18:30.000000000 +0200 +++ gentoolkit-0.2.2_pre4/src/gentoolkit/__init__.py 2006-06-19 17:59:33.779949750 +0200 @@ -33,7 +33,8 @@ virtuals = portage.db[portage.root]["virtuals"] Config = { - "verbosityLevel": 3 + "verbosityLevel": 3, + "time_sort": 0 } from helpers import * --- gentoolkit-0.2.2_pre4/src/gentoolkit/helpers.py 2006-04-03 00:18:30.000000000 +0200 +++ gentoolkit-0.2.2_pre4/src/gentoolkit/helpers.py 2006-06-19 17:59:40.356360750 +0200 @@ -149,6 +149,11 @@ pkglist.sort(Package.compare_version) return pkglist +def sort_package_list_by_time(pkglist): + """Returns the list ordered by time of compilation""" + pkglist.sort(Package.compare_old) + return pkglist + if __name__ == "__main__": print "This module is for import only" --- gentoolkit-0.2.2_pre4/src/gentoolkit/package.py 2006-04-03 00:18:30.000000000 +0200 +++ gentoolkit-0.2.2_pre4/src/gentoolkit/package.py 2006-06-19 17:59:46.216727000 +0200 @@ -29,7 +29,8 @@ def get_name(self): """Returns base name of package, no category nor version""" return self._scpv[1] - + def get_old(self): + return (os.stat("/var/db/pkg/"+ self._cpv+ "/" + self._cpv.split('/',1)[1] + ".ebuild").st_mtime) def get_version(self): """Returns version of package, with revision number""" v = self._scpv[2] @@ -200,7 +201,10 @@ # Compaare versions else: return portage.pkgcmp(v1[1:],v2[1:]) - + def compare_old(self,other): + """ Compares this package's data old to another's CPV; returns -1, 0 ,1""" + return cmp(self.get_old(),other.get_old()) + def size(self): """Estimates the installed size of the contents of this package, if possible. Returns [size, number of files in total, number of uncounted files]"""