summaryrefslogtreecommitdiff
path: root/trunk/src/gentool
diff options
context:
space:
mode:
authorkarltk <karltk@gentoo.org>2004-01-07 13:21:01 +0000
committerkarltk <karltk@gentoo.org>2004-01-07 13:21:01 +0000
commit883c1c08db619de8b631735aa6e4f42d85d9a0be (patch)
tree738a44e8449026722e31c3d27b75861283e21103 /trunk/src/gentool
parentd7bc579a0e0fac22c074a345065e1193f61740f9 (diff)
downloadgentoolkit-883c1c08db619de8b631735aa6e4f42d85d9a0be.tar.gz
More build system updates; renamed gentool to equery
svn path=/; revision=49
Diffstat (limited to 'trunk/src/gentool')
-rw-r--r--trunk/src/gentool/AUTHORS3
-rw-r--r--trunk/src/gentool/ChangeLog17
-rw-r--r--trunk/src/gentool/Makefile20
-rw-r--r--trunk/src/gentool/README0
-rw-r--r--trunk/src/gentool/TODO0
-rwxr-xr-xtrunk/src/gentool/gentool897
-rwxr-xr-xtrunk/src/gentool/gentool-bump-revision72
-rw-r--r--trunk/src/gentool/gentool-bump-revision.120
-rwxr-xr-xtrunk/src/gentool/gentool-package-count9
-rw-r--r--trunk/src/gentool/gentool-package-count.117
-rwxr-xr-xtrunk/src/gentool/gentool-package-size138
-rw-r--r--trunk/src/gentool/gentool-package-size.144
-rw-r--r--trunk/src/gentool/gentool.112
13 files changed, 0 insertions, 1249 deletions
diff --git a/trunk/src/gentool/AUTHORS b/trunk/src/gentool/AUTHORS
deleted file mode 100644
index 9935ef7..0000000
--- a/trunk/src/gentool/AUTHORS
+++ /dev/null
@@ -1,3 +0,0 @@
-Karl Trygve Kalleberg <karltk@gentoo.org>
- * Initial version
-
diff --git a/trunk/src/gentool/ChangeLog b/trunk/src/gentool/ChangeLog
deleted file mode 100644
index 94dfaaf..0000000
--- a/trunk/src/gentool/ChangeLog
+++ /dev/null
@@ -1,17 +0,0 @@
-2003-12-31 Karl Trygve Kalleberg <karltk@gentoo.org>
- * Added which command
- * Added check command (not finished)
-
-2003-12-12 Karl Trygve Kalleberg <karltk@gentoo.org>
- * Added size command
- * Added depgraph command
-
-2003-12-11 Karl Trygve Kalleberg <karltk@gentoo.org>
- * Added list command
- * Added uses command
-
-2003-10-05 Karl Trygve Kalleberg <karltk@gentoo.org>
- * Added files command
- * Added belongs command
-
-
diff --git a/trunk/src/gentool/Makefile b/trunk/src/gentool/Makefile
deleted file mode 100644
index 77798c6..0000000
--- a/trunk/src/gentool/Makefile
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2003 Karl Trygve Kalleberg <karltk@gentoo.org>
-# Copyright 2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-#
-# $Header$
-
-include ../../makedefs.mak
-
-all:
- echo "YADDLETHORPE (vb.) (Of offended pooves.) To exit huffily from a boutique."
-
-dist:
- mkdir -p ../../$(distdir)/src/gentool/
- cp {Makefile,AUTHORS,README,TODO,ChangeLog,gentool,gentool.1} ../../$(distdir)/src/gentool/
-
-install:
- install -m 0755 gentool $(bindir)/
- install -d $(docdir)/gentool
- install -m 0644 {README,AUTHORS} $(docdir)/gentool/
- install -m 0644 gentool.1 $(mandir)/
diff --git a/trunk/src/gentool/README b/trunk/src/gentool/README
deleted file mode 100644
index e69de29..0000000
--- a/trunk/src/gentool/README
+++ /dev/null
diff --git a/trunk/src/gentool/TODO b/trunk/src/gentool/TODO
deleted file mode 100644
index e69de29..0000000
--- a/trunk/src/gentool/TODO
+++ /dev/null
diff --git a/trunk/src/gentool/gentool b/trunk/src/gentool/gentool
deleted file mode 100755
index 34128af..0000000
--- a/trunk/src/gentool/gentool
+++ /dev/null
@@ -1,897 +0,0 @@
-#! /usr/bin/env python2.2
-#
-# Copyright 2003 Karl Trygve Kalleberg
-# Copyright 2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-#
-# $Header$
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-
-__author__ = "Karl Trygve Kalleberg"
-__email__ = "karltk@gentoo.org"
-__version__ = "0.1.0"
-__productname__ = "gentool"
-__description__ = "Gentoo Package Query Tool"
-
-import re
-import sys
-import time
-import string
-import gentoolkit
-from output import *
-
-
-# Auxiliary functions
-
-def fileAsStr(name, fdesc, showType=0, showMD5=0, showTimestamp=0):
-
- type = ""; fname = ""; stamp = ""; md5sum = ""
-
- if fdesc[0] == 'obj':
- type = "file"
- fname = name
- stamp = timestampAsStr(int(fdesc[1]))
- md5sum = fdesc[2]
- elif fdesc[0] == "dir":
- type = "dir"
- fname = white(name)
- elif fdesc[0] == "sym":
- type = "symlink"
- stamp = timestampAsStr(int(fdesc[1].replace(")","")))
- tgt = fdesc[2].split()[0]
- fname = turquoise(name + " -> " + tgt)
- else:
- raise "Unknown type: " + fdesc[0]
-
- s = ""
- if showType:
- s += "%6s " % type
- s += fname
- if showTimestamp:
- s += stamp + " "
- if showMD5:
- s += md5sum + " "
- return s
-
-def timestampAsStr(timestamp):
- return time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(timestamp))
-
-
-class Command:
- def __init__(self):
- pass
- def shortHelp(self):
- return "short help description"
- def longHelp(self):
- return "help for syntax and options"
- def perform(self, args):
- pass
- def parseArgs(self, args):
- pass
-
-
-class CmdListFiles(Command):
- """List files owned by a particular package"""
- def __init__(self):
- self.default_options = {
- "showType": 0,
- "showTimestamp": 0,
- "showMD5": 0
- }
-
- def parseArgs(self,args):
- query = ""
- need_help = 0
- opts = self.default_options
- for x in args:
- if x in ["-h", "--help"]:
- need_help = 1
- elif x in ["--md5sum"]:
- opts["showMD5"] = 1
- elif x in ["--timestamp"]:
- opts["showTimestamp"] = 1
- elif x in ["--type"]:
- opts["showType"] = 1
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
-
- (query, opts) = self.parseArgs(args)
-
- if Config["verbosityLevel"] >= 3:
- print "Searching for packages matching '" + query + "'..."
-
- pkgs = gentoolkit.find_packages(query)
- for x in pkgs:
-
- if not x.is_installed():
- continue
-
- if Config["verbosityLevel"] >= 1:
- print "Contents of " + x.get_cpv() + ":"
-
- cnt = x.get_contents()
-
- for name in cnt:
- print fileAsStr(name,
- cnt[name],
- showType=opts["showType"],
- showTimestamp=opts["showTimestamp"],
- showMD5=opts["showMD5"])
-
-
- def longHelp(self):
- return "List files owned by a particular package\n" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("files") + yellow(" <local-opts> <cat/>packagename<-version>") + "\n" + \
- "\n" + \
- "Note: category and version parts are optional. \n" + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n" + \
- " " + yellow("--timestamp") + " - append timestamp\n" + \
- " " + yellow("--md5sum") + " - append md5sum\n" + \
- " " + yellow("--type") + " - prepend file type"
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("pkgspec") + " - list files owned by " + teal("pkgspec")
-
-
-class CmdListBelongs(Command):
- """List all packages owning a particular file"""
- def __init__(self):
- self.default_opts = {
- "category": "*",
- "earlyOut": 0
- }
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- elif x in ["-c", "--category"]:
- opts["category"] = args[i+1]
- skip = 1
- elif x in ["-e", "--earlyout"]:
- opts["earlyOut"] = 1
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- cat = opts["category"]
- filter_fn = None
- if cat != "*":
- filter_fn = lambda x: x.find(cat+"/")==0
-
- if Config["verbosityLevel"] >= 3:
- print "Searching for file '" + query + "' in " + cat + "..."
-
- matches = gentoolkit.find_all_installed_packages(filter_fn)
- rx = re.compile(query)
-
- found = 0
- for pkg in matches:
- cnt = pkg.get_contents()
- for file in cnt.keys():
- if rx.search(file):
- print pkg.get_cpv() + " (" + fileAsStr(file, cnt[file]) + ")"
- if opts["earlyOut"]:
- found = 1
- break
- if found:
- break
-
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("file") + " - list all packages owning " + teal("file")
- def longHelp(self):
- return "List all packages owning a particular file" + \
- "\n" + \
- "\n" + \
- turquoise("Note: ") + "Normally, only one package will own a file. If multiple packages own the same file, it usually consitutes a problem, and should be reported.\n" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("belongs") + yellow(" <local-opts> ") + teal("filename") + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n" + \
- " " + yellow("-c, --category cat") + " - only search in category " + yellow("cat") + "\n" + \
- " " + yellow("-e, --earlyout") + " - stop when first match found\n"
-
-class CmdDisplayUSEs(Command):
- """Advanced report of a package's USE flags"""
- def __init__(self):
- self.default_opts = {
- }
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
-
- (query, opts) = self.parseArgs(args)
-
- matches = gentoolkit.find_packages(query)
-
- useflags = gentoolkit.settings["USE"].split()
- usedesc = {}
- uselocaldesc = {}
-
- # Load global USE flag descriptions
- try:
- fd = open(gentoolkit.settings["PORTDIR"]+"/profiles/use.desc")
- usedesc = {}
- for line in fd.readlines():
- if line[0] == "#":
- continue
- fields = line.split(" - ")
- if len(fields) == 2:
- usedesc[fields[0].strip()] = fields[1].strip()
- except IOError:
- if Config["verbosityLevel"] >= 5:
- print "Warning: Could not load USE flag descriptions from " + gentoolkit.settings["PORTDIR"] + "/profiles/use.desc"
-
- # Load local USE flag descriptions
- try:
- fd = open(gentoolkit.settings["PORTDIR"]+"/profiles/use.local.desc")
- for line in fd.readlines():
- if line[0] == "#":
- continue
- fields = line.split(" - ")
- if len(fields) == 2:
- catpkguse = re.search("([a-z]+-[a-z]+/.*):(.*)", fields[0])
- if catpkguse:
- if not uselocaldesc.has_key(catpkguse.group(1).strip()):
- uselocaldesc[catpkguse.group(1).strip()] = {catpkguse.group(2).strip() : fields[1].strip()}
- else:
- uselocaldesc[catpkguse.group(1).strip()][catpkguse.group(2).strip()] = fields[1].strip()
- except IOError:
- if Config["verbosityLevel"] >= 5:
- print "Warning: Could not load USE flag descriptions from " + gentoolkit.settings["PORTDIR"] + "/profiles/use.desc"
-
- print "[ Colour Code : " + green("set") + " " + red("unset") + " ]"
- print "[ Legend : (U) Col 1 - Current USE flags ]"
- print "[ : (I) Col 2 - Installed With USE flags ]"
-
- # Iterate through matches, printing a report for each package
- for p in matches:
- if not p.is_installed():
- continue
-
- bestver = p.get_cpv()
- iuse = p.get_env_var("IUSE")
-
- if iuse: usevar = iuse.split()
- else: usevar = []
-
- inuse = []
- used = p.get_use_vars().split()
-
- # store (inuse, inused, flag, desc)
- output = []
-
- for u in usevar:
- inuse = 0
- inused = 0
- try:
- desc = usedesc[u]
- except KeyError:
- try:
- desc = uselocaldesc[p][u]
- except KeyError:
- desc = ""
-
- if u in useflags: inuse = 1
- if u in used: inused = 1
-
- output.append((inuse, inused, u, desc))
-
- # pretty print
- if output:
- print
- print white(" U I ") + "[ Found these USE variables in : " + white(bestver) + " ]"
- maxflag_len = 0
- for inuse, inused, u, desc in output:
- if len(u) > maxflag_len:
- maxflag_len = len(u)
-
- for inuse, inused, u, desc in output:
- flag = ["-","+"]
- colour = [red, green]
- if inuse != inused:
- print yellow(" %s %s" % (flag[inuse], flag[inused])),
- else:
- print " %s %s" % (flag[inuse], flag[inused]),
-
- print colour[inuse](u.ljust(maxflag_len)),
-
- # print description
- if desc:
- print ":", desc
- else:
- print ": unknown"
- else:
- print "[ No USE flags found for :", white(p.get_cpv()), "]"
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("pkgspec") + " - display USE flags for " + teal("pkgspec")
- def longHelp(self):
- return "Display USE flags for a given package\n" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("uses") + yellow(" <local-opts> ") + teal("pkgspec") + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n"
-
-
-class CmdDisplayDepGraph(Command):
- """Display tree graph of deps for pkgQuery"""
-
- def __init__(self):
- self.default_opts = {
- "displayUSEFlags": 1,
- "fancyFormatting": 1
- }
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- elif x in ["-U","--no-useflags"]:
- opts["displayUSEFlags"] = 0
- elif x in ["-l","--linear"]:
- opts["fancyFormatting"] = 0
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- matches = gentoolkit.find_packages(query)
-
- for pkg in matches:
-
- if Config["verbosityLevel"] >= 3:
- print "Displaying dependencies for " + pkg.get_cpv() + "\n"
-
- if not pkg.is_installed():
- continue
- self._graph(pkg, opts)
-
- def _graph(self, pkg, opts, level=0,pkgtbl=[],suffix=""):
-
- cpv=pkg.get_cpv()
-
- pfx = ""
- if opts["fancyFormatting"]:
- pfx = level*" " + "`-- "
- print pfx + cpv + suffix
-
- pkgtbl.append(cpv)
-
- for x in pkg.get_runtime_deps():
- suffix = ""
- cpv = x[2]
- pkg = gentoolkit.find_best_match(x[0] + cpv)
- if not pkg:
- continue
- if pkg.get_cpv() in pkgtbl:
- continue
- if cpv.find("virtual")==0:
- suffix += " (" + cpv + ")"
- if len(x[1]) and opts["displayUSEFlags"]:
- suffix += " [ " + string.join(x[1]) + " ]"
- pkgtbl = self._graph(pkg, opts, level+1, pkgtbl, suffix)
- return pkgtbl
-
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("pkgspec") + " - display a dependency tree for " + teal("pkgspec")
- def longHelp(self):
- return "Display a dependency tree for a given package\n" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("depgraph") + yellow(" <local-opts> ") + teal("pkgspec") + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n" + \
- " " + yellow("-U, --no-useflags") + " - do not show USE flags\n" + \
- " " + yellow("-l, --linear") + " - do not use fancy formatting"
-
-class CmdDisplaySize(Command):
- """Display disk size consumed by a package"""
- def __init__(self):
- self.default_opts = {
- "reportSizeInBytes": 0
- }
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- elif x in ["-b","--bytes"]:
- opts["reportSizeInBytes"] = 1
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- matches = gentoolkit.find_packages(query)
-
- for pkg in matches:
- if not pkg.is_installed():
- continue
-
- (size, files, uncounted) = pkg.size()
-
- print turquoise("*") + " " + white(pkg.get_cpv())
- print string.rjust(" Total Files : ",25) + str(files)
-
- if uncounted:
- print string.rjust(" Inaccessible Files : ",25) + str(uncounted)
-
- sz = "%.2f KiB" % (size/1024.0)
- if opts["reportSizeInBytes"]:
- sz = str(size) + " bytes"
-
- print string.rjust("Total Size : ",25) + sz
-
-
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("pkgspec") + " - print size of files contained in package " + teal("pkgspec")
- def longHelp(self):
- return "Print size total size of files contained in a given package" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("size") + yellow(" <local-opts> ") + teal("pkgspec") + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n" + \
- " " + yellow("-b, --bytes") + " - report size in bytes\n"
-
-class CmdDisplayChanges(Command):
- """Display changes for pkgQuery"""
- pass
-
-class CheckException:
- def __init__(self, s):
- self.s = s
-
-class CmdCheckIntegrity(Command):
- """Check timestamps and md5sums for files owned by pkgspec"""
- def __init__(self):
- self.default_opts = {
- "showSummary" : 1,
- "showGoodFiles" : 0,
- "showBadFiles" : 1,
- "checkTimestamp" : 1,
- "checkMD5sum": 1
- }
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def checkMD5sum(self, file):
- return 1
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- matches = gentoolkit.find_packages(query)
-
- for pkg in matches:
- if not pkg.is_installed():
- continue
- files = pkg.get_contents()
- for file in files.keys():
- type = files[file][0]
- try:
- st = os.lstat(file)
- if type == "dir":
- if not os.path.isdir(file):
- raise CheckException(file + " exists, but is not a directory")
- elif type == "obj":
- mtime = files[file][1]
- if opts["checkTimestamp"]:
- if st.st_mtime != int(mtime):
- raise CheckException(file + (" has wrong mtime (is %d, should be %s)" % (st.st_mtime, mtime)))
- if opts["checkMD5sum"]:
- if not self.checkMD5sum(file):
- raise CheckException(file + " has incorrect md5sum")
- elif type == "sym":
- # FIXME: nastry strippery; portage should have this fixed!
- t = files[file][2]
- i = t.find("(")
- target = t[0:i].strip()
- if not os.path.islink(file):
- raise CheckException(file + " exists, but is not a symlink")
- tgt = os.readlink(file)
- if tgt != target:
- raise CheckException(file + " does not point to " + target)
-
- else:
- print file
- print files[file]
- print type
- raise "Unknown type"
- except CheckException, (e):
- print e.s
- except OSError:
- print file + " does not exist"
-
- def shortHelp(self):
- return teal("pkgspec") + " - check package's files against recorded MD5 sums and timestamps"
- def longHelp(self):
- return "Check package's files against recorded MD5 sums and timestamps"
-
-class CmdDisplayStatistics(Command):
- """Display statistics about installed and uninstalled packages"""
- pass
-
-class CmdWhich(Command):
- """Display the filename of the ebuild for a given package
- that would be used by Portage with the current configuration."""
- def __init__(self):
- self.default_opts = {}
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- matches = gentoolkit.find_packages(query)
-
- for pkg in matches:
- print os.path.normpath(pkg.get_ebuild_path())
-
- def shortHelp(self):
- return teal("pkgspec") + " - print full path to ebuild for package " + teal("pkgspec")
- def longHelp(self):
- return "Print full path to ebuild for a given package"
-
-class CmdListGLSAs(Command):
- """List outstanding GLSAs."""
- pass
-
-class CmdListDepends(Command):
- """List all packages directly or indirectly depending on pkgQuery"""
- pass
-
-class CmdListPackages(Command):
- """List packages satisfying pkgQuery"""
- def __init__(self):
- self.default_opts = {
- "category": "*",
- "includeInstalled": 1,
- "includePortTree": 0,
- "includeOverlayTree": 0,
- "regex": 0
- }
-
- def parseArgs(self, args):
-
- query = ""
- need_help = 0
- opts = self.default_opts
- skip = 0
-
- for i in xrange(len(args)):
-
- if skip:
- skip -= 1
- continue
- x = args[i]
-
- if x in ["-h","--help"]:
- need_help = 1
- break
- elif x in ["-i", "--installed"]:
- opts["includeInstalled"] = 1
- elif x in ["-I", "--exclude-installed"]:
- opts["includeInstalled"] = 0
- elif x in ["-p", "--portage-tree"]:
- opts["includePortTree"] = 1
- elif x in ["-o", "--overlay-tree"]:
- opts["includeOverlayTree"] = 1
- else:
- query = x
-
- if need_help or query == "":
- print self.longHelp()
- sys.exit(-1)
-
- return (query, opts)
-
- def perform(self, args):
- (query, opts) = self.parseArgs(args)
-
- (cat, name, ver, rev) = gentoolkit.split_package_name(query)
-
- if rev == "r0": rev = ".*"
- if name == "": name = ".*"
- if ver == "": ver = ".*"
- if cat == "": cat = ".*"
-
- package_finder = None
-
- if opts["includeInstalled"] and (opts["includePortTree"] or opts["includeOverlayTree"]):
- package_finder = gentoolkit.find_all_packages
- elif opts["includeInstalled"]:
- package_finder = gentoolkit.find_all_installed_packages
- elif opts["includePortTree"] or opts["includeOverlayTree"]:
- package_finder = gentoolkit.find_all_uninstalled_packages
-
- if not package_finder:
- print red("!!! You must specify one of ") + yellow("-i") + red(", ") + yellow("-p") + red(" or ") + yellow("-o")
- sys.exit(2)
-
- rx = re.compile(cat + "/" + name)
- filter_fn = lambda x: rx.search(x)
-
- if Config["verbosityLevel"] >= 3:
- scat = "'" + cat + "'"
- if cat == ".*":
- scat = "all categories"
- sname = "package '" + name + "'"
- if name == ".*":
- sname = "all packages"
- print "Searching for " + sname + " in " + scat + " among:"
- if opts["includeInstalled"]:
- print turquoise(" *") + " installed packages"
- if opts["includePortTree"]:
- print turquoise(" *") + " Portage tree (" + gentoolkit.settings["PORTDIR"] + ")"
- if opts["includeOverlayTree"]:
- print turquoise(" *") + " overlay tree (" + gentoolkit.settings["PORTDIR_OVERLAY"] + ")"
-
- matches = package_finder(filter_fn)
-
- rx = re.compile(cat + "/" + name + "-" + ver + "(-" + rev + ")?")
- pfxmodes = [ "[---]", "[I--]", "[-P-]", "[--O]" ]
- for pkg in matches:
- status = 0
- if pkg.is_installed():
- status = 1
- elif pkg.is_overlay():
- status = 3
- else:
- status = 2
-
- if (status == 1 and opts["includeInstalled"]) or \
- (status == 2 and opts["includePortTree"]) or \
- (status == 3 and opts["includeOverlay"]):
- if rx.search(pkg.get_cpv()):
- print pfxmodes[status] + " " + pkg.get_cpv()
-
- def shortHelp(self):
- return yellow("<local-opts> ") + teal("pkgspec") + " - list all packages matching " + teal("pkgspec")
- def longHelp(self):
- return "List all packages matching a query pattern" + \
- "\n" + \
- "Syntax:\n" + \
- " " + green("list") + yellow(" <local-opts> ") + teal("pkgspec") + \
- "\n" + \
- yellow("<local-opts>") + " is either of: \n" + \
- " " + yellow("-i, --installed") + " - search installed packages (default)\n" + \
- " " + yellow("-I, --exclude-installed") + " - do not search installed packages\n" + \
- " " + yellow("-p, --portage-tree") + " - also search in portage tree (" + gentoolkit.settings["PORTDIR"] + ")\n" + \
- " " + yellow("-o, --overlay-tree") + " - also search in overlay tree (" + gentoolkit.settings["PORTDIR_OVERLAY"] + ")\n"
-
-
-Known_commands = {
- "list": CmdListPackages(),
- "files": CmdListFiles(),
- "belongs": CmdListBelongs(),
- "depends": CmdListDepends(),
- "uses": CmdDisplayUSEs(),
- "depgraph": CmdDisplayDepGraph(),
- "changes": CmdDisplayChanges(),
- "size": CmdDisplaySize(),
- "check": CmdCheckIntegrity(),
- "stats": CmdDisplayStatistics(),
- "glsa": CmdListGLSAs(),
- "which": CmdWhich()
- }
-
-Config = {
- # Query will include packages installed on the system
- "installedPackages": 1,
- # Query will include packages available for installation
- "uninstalledPackages": 0,
- # Query will include overlay packages (iff uninstalledPackages==1)
- "overlayPackages": 1,
- # Query will include masked packages (iff uninstalledPackages==1)
- "maskedPackages": 0,
- # Query will only consider packages in the following categories, empty means all.
- "categoryFilter": [],
- # Enable color output (-1 = use Portage setting, 0 = force off, 1 = force on)
- "color": -1,
- # Level of detail on the output
- "verbosityLevel": 3,
- # Query will display info for multiple SLOTed versions
- "considerDuplicates": 1
-}
-
-def printVersion():
- print __productname__ + "(" + __version__ + ") - " + \
- __description__
- print "Author(s): " + __author__
-
-def printUsage():
- print white("Usage: ") + turquoise("gentool") + yellow(" <global-opts> ") + green("command") + yellow(" <local-opts>")
- print "where " + yellow("<global-opts>") + " is one of"
- print yellow(" -q, --quiet") + " - minimal output"
- print yellow(" -C, --nocolor") + " - turn off colours"
- print yellow(" -h, --help") + " - this help screen"
- print yellow(" -V, --version") + " - display version info"
-
- print "where " + green("command") + " is one of"
- for x in Known_commands.keys():
- print " " + green(x) + " " + Known_commands[x].shortHelp()
-
-def parseArgs(args):
-
- command = None
- local_opts = []
-
- for i in xrange(len(args)):
- x = args[i]
- if 0:
- pass
- elif x in ["-h","--help"]:
- printUsage()
- sys.exit(0)
- elif x in ["-V","--version"]:
- printVersion()
- sys.exit(0)
- elif x in ["-C","--nocolor"]:
- Config.color = 0
- elif x in ["-q","--quiet"]:
- Config["verbosityLevel"] = 0
- elif x in Known_commands.keys():
- command = Known_commands[x]
- local_opts = args[i+1:]
- break
-
- # Set up colour output correctly
- if (Config["color"] == -1 and \
- ((not sys.stdout.isatty()) or \
- (gentoolkit.settings["NOCOLOR"] in ["yes","true"]))) \
- or \
- Config["color"] == 0:
- nocolor()
-
- return (command, local_opts)
-
-if __name__ == "__main__":
- (cmd, local_opts) = parseArgs(sys.argv[1:])
- if cmd:
- cmd.perform(local_opts)
-
diff --git a/trunk/src/gentool/gentool-bump-revision b/trunk/src/gentool/gentool-bump-revision
deleted file mode 100755
index 234b83c..0000000
--- a/trunk/src/gentool/gentool-bump-revision
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# Copyright 2002-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header$
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-
-if [ ! -f $HOME/.gentoo/gentool-env ] ; then
- echo "You must make a $HOME/.gentoo/gentool-env file that contains"
- echo "AUTHORNAME=\"Your name\""
- echo "AUTHOREMAIL=\"Your @gentoo.org mail address\""
-fi
-
-. $HOME/.gentoo/gentool-env
-
-dn="`dirname $1`"
-bn="`basename $1`"
-ebuild=`echo $bn | sed "s/\.ebuild//"`
-
-ver=`echo $ebuild | sed "s/\(.*\)-\([0-9].*\)/\2/"`
-name=`echo $ebuild | sed "s/\(.*\)-\([0-9].*\)/\1/"`
-rev=`echo $ver | grep "\-r[0-9]*" | sed "s/.*-r\([0-9]*\)/\1/"`
-basever=`echo $ver | sed "s/-r[0-9]*//"`
-
-oldver=$ebuild
-newver=""
-if [ -z "$rev" ] ; then
- newver=${ebuild}-r1
-else
- newrev=$[rev + 1]
- newver=${name}-${basever}-r${newrev}
-fi
-
-echo "# Directory : $dn"
-echo "# Old version : $oldver"
-echo "# New version : $newver"
-echo
-
-cd ${dn}
-
-echo "Updating revisions for ebuilds digests"
-mv ${oldver}.ebuild ${newver}.ebuild
-mv files/digest-${oldver} files/digest-${newver}
-
-#echo "Removing old revisions from CVS"
-#cvs remove -f ${oldver}.ebuild
-#cvs remove -f files/digest-${oldver}
-
-echo "Adding new revisions to CVS"
-cvs add ${newver}.ebuild
-cvs add files/digest-${newver}
-
-if [ ! -f ChangeLog ] ; then
- echo "!!! Cannot fix ChangeLog, does not exist" > /dev/stderr
- exit -1
-fi
-
-echo "Adding new entry in ChangeLog"
-
-lns=`cat ChangeLog | wc -l | tr -d ' '`
-mv ChangeLog ChangeLog.orig
-(head -n 3 ChangeLog.orig ;
- echo ""
- echo "*$newver (`date +\"%d %b %Y\"`)" ;
- echo "" ;
- echo " `date +\"%d %b %Y\"`; $AUTHORNAME <$AUTHOREMAIL> ${newver}.ebuild files/digest-${newver}:" ;
- echo "" ;
- echo " # INSERT COMMENT HERE" ;
- echo "" ;
- echo " Removed ${oldver}.ebuild files/digest-${oldver}" ;
- echo "" ;
- tail -n $[lns-4] ChangeLog.orig
-) > ChangeLog
diff --git a/trunk/src/gentool/gentool-bump-revision.1 b/trunk/src/gentool/gentool-bump-revision.1
deleted file mode 100644
index b7efc47..0000000
--- a/trunk/src/gentool/gentool-bump-revision.1
+++ /dev/null
@@ -1,20 +0,0 @@
-.TH gentool-bump-revision "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-bump-revision \- Bumps the revision number of a given package
-.SH SYNOPSIS
-.B gentool-bump-revision
-\fIebuild\fR
-.SH DESCRIPTION
-The \fBgentool-bump-revision\fR utility bumps the revision of an existing
-ebuild in the Portage tree. It does this by copying the specified ebuild
-file to a new filename with an increased revision number. It takes care
-of the digest file, adding both to CVS, and it also adds an entry in the
-ChangeLog for you to fill in. After the revision bump, should always make
-certain any auxiliary files like scripts, etc, are installed properly.
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-change(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
diff --git a/trunk/src/gentool/gentool-package-count b/trunk/src/gentool/gentool-package-count
deleted file mode 100755
index f7e02e4..0000000
--- a/trunk/src/gentool/gentool-package-count
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-pcnt=`find /usr/portage/ -type f -name "*.ebuild" | sed "s/-[0-9].*//" | sort | uniq | wc -l`
-numebuilds=`find /usr/portage/ -type f -name "*.ebuild" | wc -l`
-numcat=`find /usr/portage/ -type d -name "*-*" -maxdepth 1 | wc -l`
-
-echo "Number of categories : $numcat"
-echo "Number of ebuilds : $numebuilds"
-echo "Unique packages : $pcnt"
diff --git a/trunk/src/gentool/gentool-package-count.1 b/trunk/src/gentool/gentool-package-count.1
deleted file mode 100644
index ad27479..0000000
--- a/trunk/src/gentool/gentool-package-count.1
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH gentool-package-count "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-package-count\- Counts the number of packages available in the tree.
-.SH SYNOPSIS
-.B gentool-package-revision
-.SH DESCRIPTION
-The \fBgentool-package-count\fR utility counts the number of packages
-available for installation in your local Portage tree. It will inform of
-total package count, total category count, and total unique packages. It
-is completely useless.
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-gentool-package-size(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
diff --git a/trunk/src/gentool/gentool-package-size b/trunk/src/gentool/gentool-package-size
deleted file mode 100755
index 7209a9a..0000000
--- a/trunk/src/gentool/gentool-package-size
+++ /dev/null
@@ -1,138 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright(c) 2002, Gentoo Technologies, Inc
-# Copyright(c) 2002, Karl Trygve Kalleberg <karltk@gentoo.org>
-# Distributed under the terms of the GNU General Public License v2
-#
-
-import sys
-import string
-import os
-import os.path
-
-base = "/var/db/pkg"
-
-def getdirs(path):
- files = os.listdir(path)
- dirs = []
- for i in files:
- if os.path.isdir(path + "/" + i):
- dirs.append(i)
- return dirs
-
-def findContentFile(spec):
- k = string.split(spec,"/")
-
- if len(k) == 2:
- cat = k[0]
- pnm = k[1]
- else:
- cat = ""
- pnm = k[0]
-
- if cat:
- dirlist = os.listdir(base + "/" + cat)
- for pkg in dirlist:
- if string.find(pkg, pnm) == 0:
- return (cat, pkg, base + "/" + cat + "/" + pkg + "/CONTENTS")
- else:
- cats = getdirs(base)
- for cat in cats:
- pkgs = getdirs(base + "/" + cat)
- for pkg in pkgs:
- if string.find(pkg, pnm) == 0:
- return (cat, pkg, base + "/" + cat + "/" + pkg + "/CONTENTS")
- return None
-
-def main():
- spec=sys.argv[1]
-
- try:
- (cat, pkg, contents) = findContentFile(spec)
- except:
- print "No package resembling '" + spec + "' found"
- sys.exit(-1)
-
- ins = open(contents)
-
- files = []
- inaccurate = 0
- total = 0
- for i in ins.readlines():
- k = string.split(i)
- if len(k) and k[0] == "obj":
- files.append(k[1])
- for i in files:
- try:
- total+=os.path.getsize(i)
- except os.error:
- inaccurate=1
- k = str(total) + " (" + str(total/1024) + "kiB)"
- if inaccurate:
- k += " ~"
- print cat + "/" + pkg + " " + k
-
-if __name__ == "__main__":
- main()
-
-"""
-#!/bin/sh
-
-# Copyright(c) 2002, Gentoo Technologies, Inc
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-
-spec=$1
-
-name=`echo $1 | sed "s/\([^/]*\)\///"`
-category=`echo $1 | sed "s/\/.*//"`
-
-if [ "$category" == "$name" ] ; then
- category=
-fi
-
-function tryfile() {
- local foo
- foo=/var/db/pkg/$1/CONTENTS
- bar=`ls $foo 2> /dev/null`
- for i in $bar ; do
- if [ -f "$i" ] ; then
- echo $i
- break
- fi
- done
-}
-
-file=`tryfile "${category}/${name}"`
-if [ -z $file ] ; then
- file=`tryfile "${category}/${name}*"`
- if [ -z $file ] ; then
- file=`tryfile "${category}*/${name}"`
- if [ -z $file ] ; then
- file=`tryfile "${category}*/${name}*"`
- if [ -z $file ] ; then
- echo "!!! Package resembling ${category}/${name} not found"
- exit 1
- fi
- fi
- fi
-fi
-
-pkgname=`echo $file | sed -e "s:\/var\/db\/pkg\/::" -e "s:\/CONTENTS::"`
-
-filelist=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /"`
-
-size=0
-for i in $filelist ; do
- if [ -e $i ] ; then
- s=`du -s $i | cut -f1`
- size=$[size + s]
- fi
-done
-#size=0
-#for i in $totals ; do
-# size=$[size+i]
-#done
-
-echo "$pkgname $size ($[size/1024]KB)"
-
-"""
diff --git a/trunk/src/gentool/gentool-package-size.1 b/trunk/src/gentool/gentool-package-size.1
deleted file mode 100644
index 29408b0..0000000
--- a/trunk/src/gentool/gentool-package-size.1
+++ /dev/null
@@ -1,44 +0,0 @@
-.TH gentool-package-size "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-package-size \- Calculates the diskspace occupied by a package
-.SH SYNOPSIS
-.B gentool-package-revision
-\fIpackage-name\fR
-.SH DESCRIPTION
-The \fBgentool-package-revision\fR utility calculates the actual diskspace
-taken by a given package. It will not consider the parition block size. The
-package name need not be absolute, the closest match is sought.
-.SH EXAMPLE
-.LP
-To look for the first package with a name starting with \fImozilla\fR:
-.RS
-.nf
-\fBgentool-package-revision mozilla\fP
-.fi
-.RE
-
-.LP
-To look for the first package in category \fInet-www\fR starting with
-\fImozilla\fR:
-.RS
-.nf
-\fBgentool-package-revision net-www/mozilla\fP
-.fi
-.RE
-
-.LP
-To only match a very specific version of \fImozilla\fR in the
-\fInet-www\fR category:
-.RS
-.nf
-\fBgentool-package-revision net-www/mozilla-1.0.1-r3\fP
-.fi
-.RE
-
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-gentool-package-count(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
diff --git a/trunk/src/gentool/gentool.1 b/trunk/src/gentool/gentool.1
deleted file mode 100644
index 0f52b7f..0000000
--- a/trunk/src/gentool/gentool.1
+++ /dev/null
@@ -1,12 +0,0 @@
-.TH gentool "1" "Nov 2003" "gentoolkit"
-.SH NAME
-gentool \- Gentoo: Package Query Tool
-.SH SYNOPSIS
-.B gentool
-.SH BUGS
-This tool does not yet have a man page. Feel free to submit a bug about it to
-http://bugs.gentoo.org
-.SH AUTHORS
-This informative man page was written by Karl Trygve Kalleberg
-<karltk@gentoo.org>.
-