From: fuzzyray Date: Thu, 8 Sep 2005 21:19:36 +0000 (-0000) Subject: Added eclean bug# 33877 and updated README bug# 103662 X-Git-Tag: gentoolkit-0.2.4.3~285 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=456429d82046a4efc0fb5f41c596290754cc692c;p=gentoolkit.git Added eclean bug# 33877 and updated README bug# 103662 svn path=/; revision=228 --- diff --git a/trunk/ChangeLog b/trunk/ChangeLog index fdcd3b1..3e7ad0f 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,7 @@ +2005-09-08 Paul Varner + * eclean: Inital commit of eclean 0.4.1 from Thomas de Grenier de + Latour (tgl) (bug 33877) + 2005-06-28 Paul Varner * revdep-rebuild: Revert fix for bug 93574 as it can cause packages to be missed. (bug 97171) diff --git a/trunk/Makefile b/trunk/Makefile index 58f5385..76a6afe 100644 --- a/trunk/Makefile +++ b/trunk/Makefile @@ -39,7 +39,7 @@ dist-gentoolkit-dev: dist-gentoolkit: mkdir -p release/gentoolkit-$(VERSION)$(RELEASE_TAG) rm -rf release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ - for x in equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check; do \ + for x in eclean equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check; do \ ( cd src/$$x ; make distdir=release/gentoolkit-$(VERSION)$(RELEASE_TAG) dist ) \ done cp Makefile AUTHORS README TODO COPYING NEWS ChangeLog release/gentoolkit-$(VERSION)$(RELEASE_TAG)/ @@ -62,7 +62,7 @@ install-gentoolkit: install -m 0644 AUTHORS ChangeLog COPYING NEWS README TODO $(docdir)/ - for x in equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check ; do \ + for x in eclean equery etcat euse qpkg gentoolkit revdep-rebuild glsa-check ; do \ ( cd src/$$x ; make DESTDIR=$(DESTDIR) install ) \ done diff --git a/trunk/README b/trunk/README index f54f78c..18b7c02 100644 --- a/trunk/README +++ b/trunk/README @@ -1,8 +1,11 @@ -Package: Gentoolkit -Version: 0.2.0_pre5 -Authors: Karl Trygve Kalleberg +Package: gentoolkit/gentoolkit-dev +Version: 0.2.1 +Authors: Aron Griffis Brandon Low + Ian Leitch + Karl Trygve Kalleberg Marius Mauch + Paul Varner See src//AUTHORS for tool-specific authors MOTIVATION @@ -14,20 +17,25 @@ into full-fledged tools in their own right. CONTENTS -dep-clean - cleans out unwanted dependencies -emerge-rsync - coloured output of changes in last rsync -emerge-webrsync - rsync-over-http -equery - replacement for etcat and qpkg -epm - rpm-like query tool -etcat - extracts auxillary information from portage -etc-update - keeps your /etc up to date after package installs -pkg-clean - cleans packages -pkg-size - calculates size of an installed package -portage-statistics - shows various statistics about the Portage Tree -qpkg - convient package query tool -revdep-rebuild - scans/fixes broken shared libs and binaries -useflag - tool for handling use flag settings - +gentoolkit +========== +eclean - tool to clean up outdated distfiles and packages +equery - replacement for etcat and qpkg +etcat - extracts auxillary information from portage (deprecated) +euse - tool to manage USE flags +glsa-check - tool to manage GLSA's (Gentoo Linux Security Advisory) +qpkg - convient package query tool (deprecated) +revdep-rebuild - scans/fixes broken shared libs and binaries + +gentoolkit-dev +============== +ebump - Ebuild revision bumper +echangelog - update portage ChangeLogs +ego - +ekeyword - modify package KEYWORDS +epkgmove - tool for moving and renaming packages in CVS +eviewcvs - generate viewcvs URLs +gensync - Overlay Sync Tool IMPROVEMENTS diff --git a/trunk/makedefs.mak b/trunk/makedefs.mak index 98155a5..2ece448 100644 --- a/trunk/makedefs.mak +++ b/trunk/makedefs.mak @@ -15,3 +15,4 @@ docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)$(RELEASE_TAG) bindir=$(DESTDIR)/usr/bin sbindir=$(DESTDIR)/usr/sbin mandir=$(DESTDIR)/usr/share/man/man1 +sysconfdir=$(DESTDIR)/etc diff --git a/trunk/src/eclean/AUTHORS b/trunk/src/eclean/AUTHORS new file mode 100644 index 0000000..9263cbb --- /dev/null +++ b/trunk/src/eclean/AUTHORS @@ -0,0 +1 @@ +Thomas de Grenier de Latour (tgl) diff --git a/trunk/src/eclean/ChangeLog b/trunk/src/eclean/ChangeLog new file mode 100644 index 0000000..ad8a0ef --- /dev/null +++ b/trunk/src/eclean/ChangeLog @@ -0,0 +1,23 @@ +2005-08-28 Thomas de Grenier de Latour (tgl) + * Version 0.4.1 + * added support for some "eclean-dist" and "eclean-pkg" symlinks on eclean + (and thus refactored command-line parsing and help screen code) + * accept file names in exclude files for specific distfiles protection + (useful to protect the OOo i18n files for instance, which are not in + $SRC_URI but put there manually) + * minor rewrite of some findDistfiles() code + * added /usr/lib/portage/pym python path, just to be sure it comes first + (after all, "ouput" is a pretty generic name for a python module...) + * updated manpage + +2005-08-27 Thomas de Grenier de Latour (tgl) + * Version 0.4 + * added exclusion files support + * added time limit option + * added size limit option (for distfiles only) + * added fetch-restricted distfile optionnal protection + * added --package-names option for protection of all versions of installed + packages. + * removed support of multiple actions on command-line. That would have been + hell with action-specific options. + * updated manpage diff --git a/trunk/src/eclean/Makefile b/trunk/src/eclean/Makefile new file mode 100644 index 0000000..79c5895 --- /dev/null +++ b/trunk/src/eclean/Makefile @@ -0,0 +1,24 @@ +# Copyright 2004 Karl Trygve Kalleberg +# Copyright 2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# +# $Header$ + +include ../../makedefs.mak + +all: + +dist: + mkdir -p ../../$(distdir)/src/eclean + cp eclean eclean.1 Makefile *.exclude ../../$(distdir)/src/eclean + cp AUTHORS THANKS TODO ChangeLog ../../$(distdir)/src/eclean + +install: + install -m 0755 eclean $(bindir)/ + ln -sf eclean $(bindir)/eclean-pkg + ln -sf eclean $(bindir)/eclean-dist + install -d $(sysconfdir)/eclean + install -m 0644 distfiles.exclude packages.exclude $(sysconfdir)/eclean/ + install -d $(docdir)/eclean + install -m 0644 AUTHORS THANKS TODO ChangeLog $(docdir)/eclean/ + install -m 0644 eclean.1 $(mandir)/ diff --git a/trunk/src/eclean/THANKS b/trunk/src/eclean/THANKS new file mode 100644 index 0000000..6b8dc2e --- /dev/null +++ b/trunk/src/eclean/THANKS @@ -0,0 +1,7 @@ +The starting point ideas were found here: +http://forums.gentoo.org/viewtopic.php?t=3011 + +Thanks to eswanson and far for their contributions, and to wolf31o2 for his +support. Thanks also to karltk, some of this code was at some point inspired +by his "equery" tool. And thanks to people who had a look on bug #33877: +Benjamin Braatz, fuzzyray, genone, etc. diff --git a/trunk/src/eclean/TODO b/trunk/src/eclean/TODO new file mode 100644 index 0000000..04e64ca --- /dev/null +++ b/trunk/src/eclean/TODO @@ -0,0 +1,16 @@ +- exclusion file syntax could be improved (maybe it should support real + dep-atoms, or wildcards, etc.) + +- some policy to keep the X latest versions of a package (in each of its + SLOT maybe) would be really cool... + +- add an option to protect system binary packages + => yup, but later... (needs some portage modifications to be done right) + +- add actions for PORT_LOGDIR and/or /var/tmp/portage cleaning? + => bah, don't know... imho tmpreaper or find+rm onliners are enough here + +- cleanup of DISTDIR/cvs-src when action=distfiles + => i never use cvs ebuilds, i should check what it does exactly + +- rewrite for a decent Portage API if there ever is one diff --git a/trunk/src/eclean/distfiles.exclude b/trunk/src/eclean/distfiles.exclude new file mode 100644 index 0000000..024de7a --- /dev/null +++ b/trunk/src/eclean/distfiles.exclude @@ -0,0 +1,5 @@ +# /etc/eclean/distfiles.exclude +# In this file you can list some categories or cat/pkg-name for which you want +# to protect distfiles from "ecleaning". You can also name some specific files. +# See `man eclean` for syntax details. + diff --git a/trunk/src/eclean/eclean b/trunk/src/eclean/eclean new file mode 100644 index 0000000..eb56165 --- /dev/null +++ b/trunk/src/eclean/eclean @@ -0,0 +1,787 @@ +#!/usr/bin/env python +# Copyright 2003-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + + +############################################################################### +# Meta: +__author__ = "Thomas de Grenier de Latour (tgl)" +__email__ = "degrenier@easyconnect.fr" +__version__ = "0.4.1" +__productname__ = "eclean" +__description__ = "A cleaning tool for Gentoo distfiles and binaries." + + +############################################################################### +# Python imports: +import sys +import os, stat +import string, re +import time +import getopt +import fpformat +import signal +sys.path.insert(0,'/usr/lib/portage/pym') +import portage +from output import * + +# Ignominous CVS / non-CVS compatibility hacks: +if portage.VERSION[:6] == '2.0.51': listdir = portage.listdir +# else, assume it's a reasonably recent CVS (or future 2.1) +else: from portage_file import listdir + + +############################################################################### +# Misc. shortcuts to some portage stuff: +port_settings = portage.settings +distdir = port_settings["DISTDIR"] +pkgdir = port_settings["PKGDIR"] + + +############################################################################### +# printVersion: +def printVersion(): + print "%s (version %s) - %s" \ + % (__productname__, __version__, __description__) + print "Author: %s <%s>" % (__author__,__email__) + print "Copyright 2003-2005 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 >>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. " + 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." + return + if error in ('global-options', 'packages-options', 'distfiles-options', \ + 'merged-packages-options', 'merged-distfiles-options',): + eerror("Wrong option on command line.") + print >>out + elif error == 'actions': + eerror("Wrong or missing action name on command line.") + print >>out + print >>out, white("Usage:") + if error in ('actions','global-options', 'packages-options', \ + 'distfiles-options') or help == 'all': + print >>out, " "+turquoise(__productname__), \ + yellow("[global-option] ..."), \ + green(""), \ + yellow("[action-option] ...") + if error == 'merged-distfiles-options' or help in ('all','distfiles'): + print >>out, " "+turquoise(__productname__+'-dist'), \ + yellow("[global-option, distfiles-option] ...") + if error == 'merged-packages-options' or help in ('all','packages'): + print >>out, " "+turquoise(__productname__+'-pkg'), \ + yellow("[global-option, packages-option] ...") + if error in ('global-options', 'actions'): + print >>out, " "+turquoise(__productname__), \ + yellow("[--help, --version]") + if help == 'all': + print >>out, " "+turquoise(__productname__+"(-dist,-pkg)"), \ + yellow("[--help, --version]") + if error == 'merged-packages-options' or help == 'packages': + print >>out, " "+turquoise(__productname__+'-pkg'), \ + yellow("[--help, --version]") + if error == 'merged-distfiles-options' or help == 'distfiles': + print >>out, " "+turquoise(__productname__+'-dist'), \ + yellow("[--help, --version]") + print >>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=