diff options
Diffstat (limited to 'src/dep-clean')
-rw-r--r-- | src/dep-clean/AUTHORS | 9 | ||||
-rw-r--r-- | src/dep-clean/ChangeLog | 13 | ||||
-rw-r--r-- | src/dep-clean/README | 4 | ||||
-rw-r--r-- | src/dep-clean/dep-clean | 164 | ||||
-rw-r--r-- | src/dep-clean/dep-clean.1 | 194 |
5 files changed, 384 insertions, 0 deletions
diff --git a/src/dep-clean/AUTHORS b/src/dep-clean/AUTHORS new file mode 100644 index 0000000..2fa030f --- /dev/null +++ b/src/dep-clean/AUTHORS @@ -0,0 +1,9 @@ +Maintainer: +Karl Trygve Kalleberg <karltk@gentoo.org> + +Authors: +Karl Trygve Kalleberg <karltk@gentoo.org> (dep-clean, man page) +Jerry Haltom <ssrit@larvalstage.net> (dep-clean) +Brandon Low <lostlogic@gentoo.org> (dep-clean) +Paul Belt <gaarde@users.sourceforge.net> (man page) +Brandon Low <lostlogic@gentoo.org> (dep-clean) diff --git a/src/dep-clean/ChangeLog b/src/dep-clean/ChangeLog new file mode 100644 index 0000000..dc6980e --- /dev/null +++ b/src/dep-clean/ChangeLog @@ -0,0 +1,13 @@ + 04 Oct 2003: Karl Trygve Kalleberg <karltk@gentoo.org> dep-clean, dep-clean.1: + * Rewrote to Python + * Uses gentoolkit + * Changed the switches to be proper toggles + + 25 Feb 2003; Brandon Low <lostlogic@gentoo.org> dep-clean, dep-clean.1: + * Update to work with current everything + * Add -q and change the default behaviour and the verbose behavior + * Make a lot faster by rewriting most everything + * Make script much more readable + * Make pay attention to PORTDIR_OVERLAY + * Bring back from the dead as it give more info + than the depclean action in portage. diff --git a/src/dep-clean/README b/src/dep-clean/README new file mode 100644 index 0000000..6521aef --- /dev/null +++ b/src/dep-clean/README @@ -0,0 +1,4 @@ +See man dep-clean or just run dep-clean --help. + +QuickStart: +dep-clean displays missing, extra, and removed packages on your system. diff --git a/src/dep-clean/dep-clean b/src/dep-clean/dep-clean new file mode 100644 index 0000000..2f2bde0 --- /dev/null +++ b/src/dep-clean/dep-clean @@ -0,0 +1,164 @@ +#!/usr/bin/python +# +# Terminology: +# +# portdir = /usr/portage + /usr/local/portage +# vardir = /var/db/pkg + +import sys +import gentoolkit +try: + from portage.output import * +except ImportError: + from output import * + +__author__ = "Karl Trygve Kalleberg, Brandon Low, Jerry Haltom" +__email__ = "karltk@gentoo.org, lostlogic@gentoo.org, ssrit@larvalstage" +__version__ = "0.2.0" +__productname__ = "dep-clean" +__description__ = "Portage auxiliary dependency checker" + +class Config: + pass + +def defaultConfig(): + Config.displayUnneeded = 1 + Config.displayNeeded = 1 + Config.displayRemoved = 1 + Config.color = -1 + Config.verbosity = 2 + Config.prefixes = { "R" : "", + "U" : "", + "N" : "" } +def asCPVs(pkgs): + return map(lambda x: x.get_cpv(), pkgs) + +def asCPs(pkgs): + return map(lambda x: x.get_cp(), pkgs) + +def toCP(cpvs): + def _(x): + (c,p,v,r) = gentoolkit.split_package_name(x) + return c + "/" + p + return map(_, cpvs) + +def checkDeps(): + if Config.verbosity > 1: + print "Scanning packages, please be patient..." + + unmerged = asCPVs(gentoolkit.find_all_uninstalled_packages()) + unmerged_cp = toCP(unmerged) + + merged = asCPVs(gentoolkit.find_all_installed_packages()) + merged_cp = toCP(merged) + + (system, unres_system) = gentoolkit.find_system_packages() + system = asCPVs(system) + + (world, unres_world) = gentoolkit.find_world_packages() + world = asCPVs(world) + + desired = system + world + + unneeded = filter(lambda x: x not in desired, merged) + needed = filter(lambda x: x not in merged, desired) + old = filter(lambda x: x not in unmerged_cp, merged_cp) + + if len(needed): + print "Packages required, but not by world and system:" + for x in needed: print " " + x + raise "Internal error, please report." + + if len(unres_system) and Config.displayNeeded: + if Config.verbosity > 0: + print white("Packages in system but not installed:") + for x in unres_system: + print " " + Config.prefixes["N"] + red(x) + + if len(unres_world) and Config.displayNeeded: + if Config.verbosity > 0: + print white("Packages in world but not installed:") + for x in unres_world: + print " " + Config.prefixes["N"] + red(x) + + if len(old) and Config.displayRemoved: + if Config.verbosity > 0: + print white("Packages installed, but no longer available:") + for x in old: + print " " + Config.prefixes["R"] + yellow(x) + + if len(unneeded) and Config.displayUnneeded: + if Config.verbosity > 0: + print white("Packages installed, but not required by system or world:") + for x in unneeded: + print " " + Config.prefixes["U"] + green(x) + +def main(): + + defaultConfig() + + for x in sys.argv: + if 0: + pass + elif x in ["-h","--help"]: + printUsage() + sys.exit(0) + elif x in ["-V","--version"]: + printVersion() + sys.exit(0) + + elif x in ["-n","--needed","--needed=yes"]: + Config.displayNeeded = 1 + elif x in ["-N","--needed=no"]: + Config.displayNeeded = 0 + + elif x in ["-u","--unneeded","--unneeded=yes"]: + Config.displayUnneeded = 1 + elif x in ["-U","--unneeded=no"]: + Config.displayUnneeded = 0 + + elif x in ["-r","--removed","--removed=yes"]: + Config.displayRemoved = 1 + elif x in ["-R","--removed","--removed=no"]: + Config.displayRemoved = 0 + elif x in ["-c","--color=yes"]: + Config.color = 1 + elif x in ["-C","--color=no"]: + Config.color = 0 + + elif x in ["-v", "--verbose"]: + Config.verbosity += 1 + elif x in ["-q", "--quiet"]: + Config.verbosity = 0 + + # 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() + Config.prefixes = { "R": "R ", "N": "N ", "U": "U " } + + checkDeps() + +def printVersion(): + print __productname__ + "(" + __version__ + ") - " + \ + __description__ + print "Authors: " + __author__ + +def printUsage(): + print white("Usage: ") + turquoise(__productname__) + \ + " [" + turquoise("options") + "]" + print "Where " + turquoise("options") + " is one of:" + print white("Display:") + print " -N,--needed needed packages that are not installed." + print " -R,--removed installed packages not in portage." + print " -U,--unneeded potentially unneeded packages that are installed." + print white("Other:") + print " -C,--nocolor output without color. Categories will be denoted by P,N,U." + print " -h,--help print this help" + print " -v,--version print version information" + +if __name__ == "__main__": + main() diff --git a/src/dep-clean/dep-clean.1 b/src/dep-clean/dep-clean.1 new file mode 100644 index 0000000..9e42019 --- /dev/null +++ b/src/dep-clean/dep-clean.1 @@ -0,0 +1,194 @@ +.\" Automatically generated by Pod::Man version 1.15 +.\" Thu Jul 18 15:59:55 2002 +.\" +.\" Standard preamble: +.\" ====================================================================== +.de Sh \" Subsection heading +.br +.if t .Sp +.ne 5 +.PP +\fB\\$1\fR +.PP +.. +.de Sp \" Vertical space (when we can't use .PP) +.if t .sp .5v +.if n .sp +.. +.de Ip \" List item +.br +.ie \\n(.$>=3 .ne \\$3 +.el .ne 3 +.IP "\\$1" \\$2 +.. +.de Vb \" Begin verbatim text +.ft CW +.nf +.ne \\$1 +.. +.de Ve \" End verbatim text +.ft R + +.fi +.. +.\" Set up some character translations and predefined strings. \*(-- will +.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left +.\" double quote, and \*(R" will give a right double quote. | will give a +.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used +.\" to do unbreakable dashes and therefore won't be available. \*(C` and +.\" \*(C' expand to `' in nroff, nothing in troff, for use with C<> +.tr \(*W-|\(bv\*(Tr +.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' +.ie n \{\ +. ds -- \(*W- +. ds PI pi +. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch +. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch +. ds L" "" +. ds R" "" +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. ds -- \|\(em\| +. ds PI \(*p +. ds L" `` +. ds R" '' +'br\} +.\" +.\" If the F register is turned on, we'll generate index entries on stderr +.\" for titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and +.\" index entries marked with X<> in POD. Of course, you'll have to process +.\" the output yourself in some meaningful fashion. +.if \nF \{\ +. de IX +. tm Index:\\$1\t\\n%\t"\\$2" +.. +. nr % 0 +. rr F +.\} +.\" +.\" For nroff, turn off justification. Always turn off hyphenation; it +.\" makes way too many mistakes in technical documents. +.hy 0 +.if n .na +.\" +.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). +.\" Fear. Run. Save yourself. No user-serviceable parts. +.bd B 3 +. \" fudge factors for nroff and troff +.if n \{\ +. ds #H 0 +. ds #V .8m +. ds #F .3m +. ds #[ \f1 +. ds #] \fP +.\} +.if t \{\ +. ds #H ((1u-(\\\\n(.fu%2u))*.13m) +. ds #V .6m +. ds #F 0 +. ds #[ \& +. ds #] \& +.\} +. \" simple accents for nroff and troff +.if n \{\ +. ds ' \& +. ds ` \& +. ds ^ \& +. ds , \& +. ds ~ ~ +. ds / +.\} +.if t \{\ +. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" +. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' +. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' +. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' +. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' +. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' +.\} +. \" troff and (daisy-wheel) nroff accents +.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' +.ds 8 \h'\*(#H'\(*b\h'-\*(#H' +.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] +.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' +.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' +.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] +.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] +.ds ae a\h'-(\w'a'u*4/10)'e +.ds Ae A\h'-(\w'A'u*4/10)'E +. \" corrections for vroff +.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' +.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' +. \" for low resolution devices (crt and lpr) +.if \n(.H>23 .if \n(.V>19 \ +\{\ +. ds : e +. ds 8 ss +. ds o a +. ds d- d\h'-1'\(ga +. ds D- D\h'-1'\(hy +. ds th \o'bp' +. ds Th \o'LP' +. ds ae ae +. ds Ae AE +.\} +.rm #[ #] #H #V #F C +.\" ====================================================================== +.\" +.IX Title "DEP-CLEAN 1" +.TH DEP-CLEAN 1 "Copyright 2002 Gentoo Technologies, Inc." "2002-07-18" "GenToolKit's Dependency Checker!" +.UC +.SH "NAME" +dep-clean \- Shows unrequired packages and missing dependencies. +.SH "SYNOPSIS" +.IX Header "SYNOPSIS" +.Vb 1 +\& dep-clean [-RUNICv] +.Ve +.SH "DESCRIPTION" +.IX Header "DESCRIPTION" +dep-clean displays extraneous, missing or extra packages. Extra packages are those in which are not a part of the portage tree (/usr/portage). It does \s-1NOT\s0 modify the system in any way. +.SH "OPTIONS" +.IX Header "OPTIONS" +.Ip "\-n, \-\-needed" 4 +.Ip "\-N, \-\-needed=no" 4 +.IX Item "-n, --needed" +Toggle display of needed packages that are not installed. (red) (default=yes) +.Ip "\-r, \-\-removed" 4 +.Ip "\-R, \-\-removed=no" 4 +.IX Item "-R, --removed" +Toggle display of installed packages not in portage. (yellow) (default=yes) +.Ip "\-u, \-\-unneeded" 4 +.Ip "\-U, \-\-unneeded=no" 4 +.IX Item "-U, --unneeded" +Toggle display of unneeded packages that are installed. (green) (default=yes) +.Ip "\-c, \-\-color" 4 +.Ip "\-C, \-\-color=no" 4 +.IX Item "-c, --color" +Toggle output of color. Without color, package types will be noted with R, U and N. +Default is use whatever Portage is set for. +.Ip "\-v, \-\-verbose" 4 +.IX Item "-v, --verbose" +Be more verbose. +.Ip "\-q, \-\-quiet" 4 +.IX Item "-q, --quiet" +Be quiet (display only packages). +.SH "NOTES" +.IX Header "NOTES" +.Ip "" 4 +If this script is run on a system that is not up-to-date or which hasn't been cleaned (with 'emerge \-c') recently, the output may be deceptive. +.Ip "" 4 +If the same package name appears in all three categories, then it is definitely time to update that package and then run 'emerge \-c'. +.Ip "" 4 +The \-U, \-N and \-R options may be combined, default is \-UNR +.SH "AUTHORS" +.IX Header "AUTHORS" +Jerry Haltom <ssrit at larvalstage dot net> (dep-clean) +.br +Brandon Low <lostlogic at gentoo dot org> (dep-clean) +.PP +Paul Belt <gaarde at users dot sourceforge dot net> (man page) +.br +Karl Trygve Kalleberg <karltk at gentoo dot org> (dep-clean, man page) |