Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 136999 | Differences between
and this patch

Collapse All | Expand All

(-)gentoolkit-0.2.2_pre4/src/equery/equery (-6 / +13 lines)
Lines 19-25 Link Here
19
import time
19
import time
20
import string
20
import string
21
import types
21
import types
22
22
from time import localtime, strftime
23
# portage (output module) and gentoolkit need special path modifications
23
# portage (output module) and gentoolkit need special path modifications
24
sys.path.insert(0, "/usr/lib/portage/pym")
24
sys.path.insert(0, "/usr/lib/portage/pym")
25
sys.path.insert(0, "/usr/lib/gentoolkit/pym")
25
sys.path.insert(0, "/usr/lib/gentoolkit/pym")
Lines 933-939 Link Here
933
		(query, opts) = self.parseArgs(args)
933
		(query, opts) = self.parseArgs(args)
934
934
935
		matches = gentoolkit.find_packages(query, opts["includeMasked"])
935
		matches = gentoolkit.find_packages(query, opts["includeMasked"])
936
		matches = gentoolkit.sort_package_list(matches)
936
		if Config[time_sort]:
937
			matches = gentoolkit.sort_package_list_by_time(matches)
938
		else: 
939
			matches = gentoolkit.sort_package_list(matches)
937
940
938
		if matches:
941
		if matches:
939
			print_info(0, os.path.normpath(matches[-1].get_ebuild_path()))
942
			print_info(0, os.path.normpath(matches[-1].get_ebuild_path()))
Lines 1249-1257 Link Here
1249
					newmatches += dups[mykey]
1252
					newmatches += dups[mykey]
1250
1253
1251
			matches = newmatches
1254
			matches = newmatches
1252
1255
		if Config.has_key("time_sort") and Config["time_sort"]:
1253
		matches = gentoolkit.sort_package_list(matches)
1256
			matches = gentoolkit.sort_package_list_by_time(matches)
1254
1257
		else:
1258
			matches = gentoolkit.sort_package_list(matches)
1255
		# If no version supplied, fix regular expression
1259
		# If no version supplied, fix regular expression
1256
		if ver == ".*": ver = "[0-9]+[^-]*"
1260
		if ver == ".*": ver = "[0-9]+[^-]*"
1257
1261
Lines 1302-1308 Link Here
1302
				if Config["piping"]:
1306
				if Config["piping"]:
1303
					print_info(0, pkg.get_cpv())
1307
					print_info(0, pkg.get_cpv())
1304
				else:
1308
				else:
1305
					print_info(0, "[" + pp.installedflag(pfxmodes[status]) + "] [" + pp.maskflag(maskmodes[pkgmask]) + "] " + pp.cpv(pkg.get_cpv()) + " (" + pp.slot(slot) + ")")
1309
					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) + ")")
1306
1310
1307
	def _print_overlay(self, matches, rx):
1311
	def _print_overlay(self, matches, rx):
1308
		self._generic_print(
1312
		self._generic_print(
Lines 1561-1566 Link Here
1561
	print_info(0, pp.globaloption(" -h, --help") + "    - this help screen")
1565
	print_info(0, pp.globaloption(" -h, --help") + "    - this help screen")
1562
	print_info(0, pp.globaloption(" -V, --version") + " - display version info")
1566
	print_info(0, pp.globaloption(" -V, --version") + " - display version info")
1563
	print_info(0, pp.globaloption(" -N, --no-pipe") + " - turn off pipe detection")
1567
	print_info(0, pp.globaloption(" -N, --no-pipe") + " - turn off pipe detection")
1568
	print_info(0, pp.globaloption(" -t, --time-sort") + " - sort by time")
1564
	
1569
	
1565
	print_info(0, "where " + pp.command("command") + "(" + pp.command("short") + ") is one of")
1570
	print_info(0, "where " + pp.command("command") + "(" + pp.command("short") + ") is one of")
1566
	keys = Known_commands.keys()
1571
	keys = Known_commands.keys()
Lines 1618-1623 Link Here
1618
			Config["piping"] = False
1623
			Config["piping"] = False
1619
		elif x in ["-q","--quiet"]:
1624
		elif x in ["-q","--quiet"]:
1620
			Config["verbosityLevel"] = 0
1625
			Config["verbosityLevel"] = 0
1626
		elif x in ["-t","--time-sort"]:
1627
			Config["time_sort"] = 1
1621
		elif expand(x) in Known_commands.keys():
1628
		elif expand(x) in Known_commands.keys():
1622
			command = Known_commands[expand(x)]
1629
			command = Known_commands[expand(x)]
1623
			local_opts = args[i+1:]
1630
			local_opts = args[i+1:]
(-)gentoolkit-0.2.2_pre4/src/gentoolkit/__init__.py (-1 / +2 lines)
Lines 33-39 Link Here
33
virtuals = portage.db[portage.root]["virtuals"]
33
virtuals = portage.db[portage.root]["virtuals"]
34
34
35
Config = {
35
Config = {
36
	"verbosityLevel": 3
36
	"verbosityLevel": 3,
37
	"time_sort": 0
37
}
38
}
38
39
39
from helpers import *
40
from helpers import *
(-)gentoolkit-0.2.2_pre4/src/gentoolkit/helpers.py (+5 lines)
Lines 149-154 Link Here
149
	pkglist.sort(Package.compare_version)
149
	pkglist.sort(Package.compare_version)
150
	return pkglist
150
	return pkglist
151
151
152
def sort_package_list_by_time(pkglist):
153
	"""Returns the list ordered by time of compilation"""
154
	pkglist.sort(Package.compare_old)
155
        return pkglist
156
152
if __name__ == "__main__":
157
if __name__ == "__main__":
153
	print "This module is for import only"
158
	print "This module is for import only"
154
159
(-)gentoolkit-0.2.2_pre4/src/gentoolkit/package.py (-2 / +6 lines)
Lines 29-35 Link Here
29
	def get_name(self):
29
	def get_name(self):
30
		"""Returns base name of package, no category nor version"""
30
		"""Returns base name of package, no category nor version"""
31
		return self._scpv[1]
31
		return self._scpv[1]
32
32
	def get_old(self):
33
		return (os.stat("/var/db/pkg/"+ self._cpv+ "/" +  self._cpv.split('/',1)[1] + ".ebuild").st_mtime)
33
	def get_version(self):
34
	def get_version(self):
34
		"""Returns version of package, with revision number"""
35
		"""Returns version of package, with revision number"""
35
		v = self._scpv[2]
36
		v = self._scpv[2]
Lines 200-206 Link Here
200
		# Compaare versions
201
		# Compaare versions
201
		else:
202
		else:
202
			return portage.pkgcmp(v1[1:],v2[1:])
203
			return portage.pkgcmp(v1[1:],v2[1:])
203
204
	def compare_old(self,other):
205
		""" Compares this package's data old to another's CPV; returns -1, 0 ,1"""
206
		return cmp(self.get_old(),other.get_old())
207
		
204
	def size(self):
208
	def size(self):
205
		"""Estimates the installed size of the contents of this package, if possible.
209
		"""Estimates the installed size of the contents of this package, if possible.
206
		Returns [size, number of files in total, number of uncounted files]"""
210
		Returns [size, number of files in total, number of uncounted files]"""

Return to bug 136999