From: fuzzyray Date: Tue, 9 Mar 2010 16:42:04 +0000 (-0000) Subject: sync with genscripts rev 343. This adds the initial py3k support and the analyse... X-Git-Tag: gentoolkit-0.3.0_rc10~9 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2f90a4b9ceff920f793541376da21d313af083d9;p=gentoolkit.git sync with genscripts rev 343. This adds the initial py3k support and the analyse utility to gentoolkit svn path=/trunk/gentoolkit/; revision=751 --- diff --git a/ChangeLog b/ChangeLog index a1f4395..63d781c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ +2010-03-09: Paul Varner + * gentoolkit: Add inital py3k support. + * analyse: Add new analyse utility from dol-sen. This will probably + change to a different name for final gentoolkit-0.3.0 release. + 2010-02-05: Paul Varner - *revdep-rebuild: Update revdep-rebuild to use extended regular + * revdep-rebuild: Update revdep-rebuild to use extended regular expressions instead of basic regular expressions. (Bug 143498) 2010-02-04: Paul Varner diff --git a/README.dev b/README.dev index 37864fb..99a7ed4 100644 --- a/README.dev +++ b/README.dev @@ -25,7 +25,7 @@ svn copy svn+ssh://@svn.gentoo.org/var/svnroot/gentoolkit/trunk/gentoolkit svn update to pull the tag from subversion cd to the local tags/gentoolkit-0.3.0 directory -- Create a source distribution (you need to add VERSION here, too): +- Create a source distribution (you need to add VERSION here): VERSION="0.3.0" ./setup.py sdist Transfer dist/gentoolkit-0.3.0.tar.gz to dev.gentoo.org:/space/distfiles-local diff --git a/TODO b/TODO index d3e2cb2..f4d4124 100644 --- a/TODO +++ b/TODO @@ -20,10 +20,22 @@ - use ~/.gentoo/gentoolkit/ebump.conf - use /etc/gentoolkit/ebump.conf -equery: +equery (modern): Add more --debug stuff Write tests for Dependencies._parser Profile Dependencies._parser + Tighten up CPV.split_cpv, it's slow and bad + Extend PackageFormatter usage to everything that outputs packages to + allow for purvasive use of -F, --format goodness + Add package::repo search syntax to do_lookup + _do_repository_lookup? + Move do_lookout and all it's silly friends into the new query module + and Query class. Essentially, Query, when applied to a pkgspec input + should contain most of the common 'helper' methods. So we should be + be able to do: + Query('portage').find_best(), + Query('portage').find_package(), + Query('portag*').is_regex() or .uses_globbing(), etc. Refactor each module to be useful for import. Done modules: +depends +belongs diff --git a/bin/analyse b/bin/analyse new file mode 100755 index 0000000..a90410b --- /dev/null +++ b/bin/analyse @@ -0,0 +1,48 @@ +#!/usr/bin/python +# +# Copyright 2010 Brian Dolbec +# Copyright 2002-2010 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 or later +# +# $Header$ + +"""'analyse' is a flexible utility for Gentoo linux which can display various +information about installed packages, such as the USE flags used and the +packages that use them. It can also be used to help rebuild /etc/portage/package.* +files in the event of corruption, and possibly more. +""" + +from __future__ import print_function + +import sys +# This block ensures that ^C interrupts are handled quietly. +try: + import signal + + def exithandler(signum,frame): + signal.signal(signal.SIGINT, signal.SIG_IGN) + signal.signal(signal.SIGTERM, signal.SIG_IGN) + print() + sys.exit(1) + + signal.signal(signal.SIGINT, exithandler) + signal.signal(signal.SIGTERM, exithandler) + signal.signal(signal.SIGPIPE, signal.SIG_DFL) + +except KeyboardInterrupt: + print() + sys.exit(1) + +from gentoolkit import analyse, errors + +try: + analyse.main() +except errors.GentoolkitException as err: + if '--debug' in sys.argv: + raise + else: + from gentoolkit import pprinter as pp + sys.stderr.write(pp.error(str(err))) + print() + print("Add '--debug' to global options for traceback.") + sys.exit(1) diff --git a/bin/eclean b/bin/eclean index 158a953..2d7f09c 100755 --- a/bin/eclean +++ b/bin/eclean @@ -1,9 +1,10 @@ #!/usr/bin/python -# Copyright 2003-2010 Gentoo Foundation +# Copyright 2003-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ -from __future__ import with_statement +from __future__ import print_function + ############################################################################### # Meta: @@ -18,15 +19,17 @@ __description__ = "A cleaning tool for Gentoo distfiles and binaries." # Python imports: import sys -import os, stat +import stat import re import time import getopt -import fpformat import signal import portage from portage.output import * +from portage import os + +from gentoolkit.helpers import walk listdir = portage.listdir @@ -40,12 +43,12 @@ pkgdir = port_settings["PKGDIR"] ############################################################################### # printVersion: def printVersion(): - print "%s (%s) - %s" \ - % (__productname__, __version__, __description__) - print - print "Author: %s <%s>" % (__author__,__email__) - print "Copyright 2003-2010 Gentoo Foundation" - print "Distributed under the terms of the GNU General Public License v2" + print("%s (%s) - %s" \ + % (__productname__, __version__, __description__)) + print() + print("Author: %s <%s>" % (__author__,__email__)) + print("Copyright 2003-2009 Gentoo Foundation") + print("Distributed under the terms of the GNU General Public License v2") ############################################################################### @@ -62,112 +65,112 @@ def printUsage(error=None,help=None): if not error and not help: help = 'all' if error == 'time': eerror("Wrong time specification") - print >>out, "Time specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: y (years), m (months), w (weeks), "+ \ - "d (days) and h (hours)." - print >>out, "For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ - " weeks\", etc. " + print("Time specification should be an integer followed by a"+ \ + " single letter unit.", file=out) + print("Available units are: y (years), m (months), w (weeks), "+ \ + "d (days) and h (hours).", file=out) + print("For instance: \"1y\" is \"one year\", \"2w\" is \"two"+ \ + " weeks\", etc. ", file=out) return if error == 'size': eerror("Wrong size specification") - print >>out, "Size specification should be an integer followed by a"+ \ - " single letter unit." - print >>out, "Available units are: G, M, K and B." - print >>out, "For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ - "is \"two hundreds kilobytes\", etc." + print("Size specification should be an integer followed by a"+ \ + " single letter unit.", file=out) + print("Available units are: G, M, K and B.", file=out) + print("For instance: \"10M\" is \"ten megabytes\", \"200K\" "+ \ + "is \"two hundreds kilobytes\", etc.", file=out) return if error in ('global-options', 'packages-options', 'distfiles-options', \ 'merged-packages-options', 'merged-distfiles-options',): eerror("Wrong option on command line.") - print >>out + print(file=out) elif error == 'actions': eerror("Wrong or missing action name on command line.") - print >>out - print >>out, white("Usage:") + print(file=out) + print(white("Usage:"), file=out) if error in ('actions','global-options', 'packages-options', \ 'distfiles-options') or help == 'all': - print >>out, " "+turquoise(__productname__), \ + print(" "+turquoise(__productname__), \ yellow("[global-option] ..."), \ green(""), \ - yellow("[action-option] ...") + yellow("[action-option] ..."), file=out) if error == 'merged-distfiles-options' or help in ('all','distfiles'): - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[global-option, distfiles-option] ...") + print(" "+turquoise(__productname__+'-dist'), \ + yellow("[global-option, distfiles-option] ..."), file=out) if error == 'merged-packages-options' or help in ('all','packages'): - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[global-option, packages-option] ...") + print(" "+turquoise(__productname__+'-pkg'), \ + yellow("[global-option, packages-option] ..."), file=out) if error in ('global-options', 'actions'): - print >>out, " "+turquoise(__productname__), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__), \ + yellow("[--help, --version]"), file=out) if help == 'all': - print >>out, " "+turquoise(__productname__+"(-dist,-pkg)"), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__+"(-dist,-pkg)"), \ + yellow("[--help, --version]"), file=out) if error == 'merged-packages-options' or help == 'packages': - print >>out, " "+turquoise(__productname__+'-pkg'), \ - yellow("[--help, --version]") + print(" "+turquoise(__productname__+'-pkg'), \ + yellow("[--help, --version]"), file=out) if error == 'merged-distfiles-options' or help == 'distfiles': - print >>out, " "+turquoise(__productname__+'-dist'), \ - yellow("[--help, --version]") - print >>out + print(" "+turquoise(__productname__+'-dist'), \ + yellow("[--help, --version]"), file=out) + print(file=out) if error in ('global-options', 'merged-packages-options', \ 'merged-distfiles-options') or help: - print >>out, "Available global", yellow("options")+":" - print >>out, yellow(" -C, --nocolor")+ \ - " - turn off colors on output" - print >>out, yellow(" -d, --destructive")+ \ - " - only keep the minimum for a reinstallation" - print >>out, yellow(" -e, --exclude-file=")+ \ - " - path to the exclusion file" - print >>out, yellow(" -i, --interactive")+ \ - " - ask confirmation before deletions" - print >>out, yellow(" -n, --package-names")+ \ - " - protect all versions (when --destructive)" - print >>out, yellow(" -p, --pretend")+ \ - " - only display what would be cleaned" - print >>out, yellow(" -q, --quiet")+ \ - " - be as quiet as possible" - print >>out, yellow(" -t, --time-limit=