From: fuzzyray Date: Fri, 12 Mar 2010 21:44:29 +0000 (-0000) Subject: Update to genscripts rev 382. This has more fixes for py3k and the modular rewrite... X-Git-Tag: gentoolkit-0.3.0_rc10~7 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1ddc073811b7b69aab22cd65990bbca8e7104bef;p=gentoolkit.git Update to genscripts rev 382. This has more fixes for py3k and the modular rewrite of eclean. svn path=/trunk/gentoolkit/; revision=755 --- diff --git a/TODO b/TODO index f4d4124..997919e 100644 --- a/TODO +++ b/TODO @@ -3,15 +3,11 @@ - add glsa pkgspec - query for current GLSAs on installed package(s) - rewrite ekeywords and echangelog to use gentoolkit -- fully deprecate qpkg -- fully deprecate pkg-size - merge change and echangelog - merge useflag and euse, have _one_ command line tool - update ufed to rely on the CLI tool - update ufed to rely on generate-use - merge generate-use and ufed? -- rewrite revdep-rebuild to use gentoolkit - - drop qpkg dependency; use equery instead - write efeatures for turning on/off FEATURES in make.conf - look at ekeys, ewatch - revision bump tool @@ -27,43 +23,13 @@ equery (modern): 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 - +meta - +changes - +depgraph Ebuild changes: - Add: src_test() { "${python}" setup.py test || die "testing returned non zero" } - - Add: - DEPEND on python 2.5 (needed for 'from __future__ import with_statement' and others) For Next Release: - write NEWS file - make CPV.__init__ more strict, it allows some silly stuff - - $ equery uses '>=sys-apps/portage-2' - * Searching for >=sys-apps/portage-2 ... - * Found these USE flags for sys-apps/portage-2.1.6.13: - - belongs doesn't properly match atom syntax - - -For following release: - - transition package query backend to using Query class. - Query class should accept any kind package of input accepted by equery. - Most of the functions in helpers should be able to moved out, either in - to query (many of those functions pertain to finding packages matching a - query) or into other appropriate modules (split_cpv, - compare_package_strings into cpv, as they also requires a cpv string) diff --git a/bin/eclean b/bin/eclean index 2d7f09c..e17f9f0 100755 --- a/bin/eclean +++ b/bin/eclean @@ -1,837 +1,49 @@ #!/usr/bin/python -# Copyright 2003-2005 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 -# $Header: $ + +"""Copyright 2003-2010 Gentoo Foundation +Distributed under the terms of the GNU General Public License v2 +""" from __future__ import print_function -############################################################################### # Meta: -__author__ = "Thomas de Grenier de Latour (tgl)" -__email__ = "degrenier@easyconnect.fr" +__author__ = "Thomas de Grenier de Latour (tgl), " + \ + "modular re-write by: Brian Dolbec (dol-sen)" +__email__ = "degrenier@easyconnect.fr, " + \ + "brian.dolbec@gmail.com" __version__ = "svn" __productname__ = "eclean" __description__ = "A cleaning tool for Gentoo distfiles and binaries." -############################################################################### -# Python imports: - import sys -import stat -import re -import time -import getopt -import signal - -import portage -from portage.output import * -from portage import os - -from gentoolkit.helpers import walk -listdir = portage.listdir +# This block ensures that ^C interrupts are handled quietly. +try: + import signal -############################################################################### -# Misc. shortcuts to some portage stuff: -port_settings = portage.settings -distdir = port_settings["DISTDIR"] -pkgdir = port_settings["PKGDIR"] + 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) -############################################################################### -# printVersion: -def printVersion(): - print("%s (%s) - %s" \ - % (__productname__, __version__, __description__)) +except KeyboardInterrupt: 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") - - -############################################################################### -# printUsage: print help message. May also print partial help to stderr if an -# error from {'options','actions'} is specified. -def printUsage(error=None,help=None): - out = sys.stdout - if error: out = sys.stderr - if not error in ('actions', 'global-options', \ - 'packages-options', 'distfiles-options', \ - 'merged-packages-options', 'merged-distfiles-options', \ - 'time', 'size'): - error = None - if not error and not help: help = 'all' - if error == 'time': - eerror("Wrong time specification") - 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("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(file=out) - elif error == 'actions': - eerror("Wrong or missing action name on command line.") - print(file=out) - print(white("Usage:"), file=out) - if error in ('actions','global-options', 'packages-options', \ - 'distfiles-options') or help == 'all': - print(" "+turquoise(__productname__), \ - yellow("[global-option] ..."), \ - green(""), \ - yellow("[action-option] ..."), file=out) - if error == 'merged-distfiles-options' or help in ('all','distfiles'): - print(" "+turquoise(__productname__+'-dist'), \ - yellow("[global-option, distfiles-option] ..."), file=out) - if error == 'merged-packages-options' or help in ('all','packages'): - print(" "+turquoise(__productname__+'-pkg'), \ - yellow("[global-option, packages-option] ..."), file=out) - if error in ('global-options', 'actions'): - print(" "+turquoise(__productname__), \ - yellow("[--help, --version]"), file=out) - if help == 'all': - print(" "+turquoise(__productname__+"(-dist,-pkg)"), \ - yellow("[--help, --version]"), file=out) - if error == 'merged-packages-options' or help == 'packages': - print(" "+turquoise(__productname__+'-pkg'), \ - yellow("[--help, --version]"), file=out) - if error == 'merged-distfiles-options' or help == 'distfiles': - 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("Available global", yellow("options")+":", file=out) - print(yellow(" -C, --nocolor")+ \ - " - turn off colors on output", file=out) - print(yellow(" -d, --destructive")+ \ - " - only keep the minimum for a reinstallation", file=out) - print(yellow(" -e, --exclude-file=")+ \ - " - path to the exclusion file", file=out) - print(yellow(" -i, --interactive")+ \ - " - ask confirmation before deletions", file=out) - print(yellow(" -n, --package-names")+ \ - " - protect all versions (when --destructive)", file=out) - print(yellow(" -p, --pretend")+ \ - " - only display what would be cleaned", file=out) - print(yellow(" -q, --quiet")+ \ - " - be as quiet as possible", file=out) - print(yellow(" -t, --time-limit=