aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/change/AUTHORS5
-rw-r--r--deprecated/change/ChangeLog7
-rw-r--r--deprecated/change/README20
-rw-r--r--deprecated/change/change343
-rw-r--r--deprecated/change/change.10
-rw-r--r--deprecated/dep-clean/AUTHORS9
-rw-r--r--deprecated/dep-clean/ChangeLog13
-rw-r--r--deprecated/dep-clean/README4
-rw-r--r--deprecated/dep-clean/dep-clean164
-rw-r--r--deprecated/dep-clean/dep-clean.1194
-rw-r--r--deprecated/dev-scripts/README2
-rwxr-xr-xdeprecated/dev-scripts/included_headers.sh159
-rwxr-xr-xdeprecated/dev-scripts/linking_libs.sh204
-rw-r--r--deprecated/distfiles-clean/AUTHORS6
-rw-r--r--deprecated/distfiles-clean/ChangeLog2
-rw-r--r--deprecated/distfiles-clean/TODO0
-rw-r--r--deprecated/distfiles-clean/distfiles-clean78
-rw-r--r--deprecated/epkginfo/AUTHORS3
-rw-r--r--deprecated/epkginfo/README1
-rwxr-xr-xdeprecated/epkginfo/epkginfo244
-rw-r--r--deprecated/epkginfo/epkginfo.134
-rw-r--r--deprecated/epkgmove/AUTHORS2
-rw-r--r--deprecated/epkgmove/ChangeLog20
-rw-r--r--deprecated/epkgmove/Makefile20
-rw-r--r--deprecated/epkgmove/README16
-rw-r--r--deprecated/epkgmove/TODO0
-rw-r--r--deprecated/epkgmove/epkgmove895
-rw-r--r--deprecated/etc-update/AUTHORS0
-rw-r--r--deprecated/etc-update/ChangeLog0
-rw-r--r--deprecated/etc-update/Makefile20
-rw-r--r--deprecated/etc-update/README0
-rwxr-xr-xdeprecated/etc-update/etc-update165
-rw-r--r--deprecated/etc-update/etc-update.112
-rw-r--r--deprecated/etcat/AUTHORS5
-rw-r--r--deprecated/etcat/ChangeLog36
-rw-r--r--deprecated/etcat/Makefile18
-rw-r--r--deprecated/etcat/README2
-rw-r--r--deprecated/etcat/TODO0
-rwxr-xr-xdeprecated/etcat/etcat688
-rw-r--r--deprecated/etcat/etcat.179
-rw-r--r--deprecated/genpkgindex/Makefile18
-rw-r--r--deprecated/genpkgindex/genpkgindex336
-rw-r--r--deprecated/genpkgindex/genpkgindex.159
-rw-r--r--deprecated/gensync/AUTHORS5
-rw-r--r--deprecated/gensync/ChangeLog12
-rw-r--r--deprecated/gensync/Makefile24
-rw-r--r--deprecated/gensync/README16
-rw-r--r--deprecated/gensync/TODO4
-rw-r--r--deprecated/gensync/bmg-gnome-current.syncsource18
-rw-r--r--deprecated/gensync/bmg-main.syncsource18
-rwxr-xr-xdeprecated/gensync/gensync226
-rw-r--r--deprecated/gensync/gensync.175
-rw-r--r--deprecated/gensync/gensync.conf8
-rw-r--r--deprecated/lintool/AUTHORS1
-rw-r--r--deprecated/lintool/COPYING340
-rw-r--r--deprecated/lintool/ChangeLog71
-rw-r--r--deprecated/lintool/NEWS0
-rw-r--r--deprecated/lintool/README23
-rw-r--r--deprecated/lintool/lintool.141
-rwxr-xr-xdeprecated/lintool/lintool.py320
-rw-r--r--deprecated/lintool/lintool/__init__.py3
-rw-r--r--deprecated/lintool/lintool/changelog.py105
-rw-r--r--deprecated/lintool/lintool/digest.py28
-rw-r--r--deprecated/lintool/lintool/ebuild.py349
-rw-r--r--deprecated/lintool/lintool/test.py30
-rw-r--r--deprecated/moo/AUTHORS1
-rw-r--r--deprecated/moo/README0
-rw-r--r--deprecated/moo/TODO0
-rwxr-xr-xdeprecated/moo/moo244
-rw-r--r--deprecated/moo/moo.112
-rw-r--r--deprecated/old-scripts/Makefile32
-rw-r--r--deprecated/old-scripts/dep-clean272
-rw-r--r--deprecated/old-scripts/dep-clean.1190
-rwxr-xr-xdeprecated/old-scripts/ewhich44
-rw-r--r--deprecated/old-scripts/ewhich.124
-rw-r--r--deprecated/old-scripts/mkebuild216
-rw-r--r--deprecated/old-scripts/mkebuild.120
-rw-r--r--deprecated/old-scripts/pkg-clean107
-rw-r--r--deprecated/old-scripts/pkg-clean.120
-rw-r--r--deprecated/old-scripts/pkg-size63
-rw-r--r--deprecated/old-scripts/pkg-size.111
-rw-r--r--deprecated/pkg-clean/AUTHORS5
-rw-r--r--deprecated/pkg-clean/ChangeLog0
-rw-r--r--deprecated/pkg-clean/README0
-rw-r--r--deprecated/pkg-clean/pkg-clean99
-rw-r--r--deprecated/pkg-clean/pkg-clean.120
-rw-r--r--deprecated/pkg-size/pkg-size66
-rw-r--r--deprecated/qpkg/AUTHORS0
-rw-r--r--deprecated/qpkg/ChangeLog5
-rw-r--r--deprecated/qpkg/Makefile19
-rw-r--r--deprecated/qpkg/README0
-rw-r--r--deprecated/qpkg/TODO0
-rw-r--r--deprecated/qpkg/qpkg581
-rw-r--r--deprecated/qpkg/qpkg.1112
-rw-r--r--deprecated/qpkg/qpkg.sh520
-rw-r--r--deprecated/useflag/AUTHORS0
-rw-r--r--deprecated/useflag/ChangeLog0
-rw-r--r--deprecated/useflag/README0
-rw-r--r--deprecated/useflag/useflag610
-rw-r--r--deprecated/useflag/useflag.169
100 files changed, 8962 insertions, 0 deletions
diff --git a/deprecated/change/AUTHORS b/deprecated/change/AUTHORS
new file mode 100644
index 0000000..4b3873a
--- /dev/null
+++ b/deprecated/change/AUTHORS
@@ -0,0 +1,5 @@
+Dan Armak <danarmak@gentoo.org>
+ * Basic idea
+ * Initial version
+Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Gentoolkit-specific changes
diff --git a/deprecated/change/ChangeLog b/deprecated/change/ChangeLog
new file mode 100644
index 0000000..bd7d5dd
--- /dev/null
+++ b/deprecated/change/ChangeLog
@@ -0,0 +1,7 @@
+2002-08-11 Dan Armak <danarmak@gentoo.org>:
+ * Fix two bugs which are long to describe, so I won't do so here.
+ They caused malformed or incomplete changelog files to be created.
+
+2002-08-09 Karl Trygve Kalleberg <karltk@gentoo.org>:
+ * Reformatted usage to work with 80 columns
+ * Now loads ~/.gentoo/gentool-env instead of ~/.change
diff --git a/deprecated/change/README b/deprecated/change/README
new file mode 100644
index 0000000..bda1842
--- /dev/null
+++ b/deprecated/change/README
@@ -0,0 +1,20 @@
+Package : change
+Version : 0.2.4
+Author : See AUTHORS
+
+MOTIVATION
+
+Maintaing Gentoo's ChangeLog files in the Portage Tree is a tedious affair.
+Many of the details are well-defined enough for a tool to do. change is this
+tool.
+
+MECHANICS
+
+change can create a ChangeLog, add entries to the ChangeLog file, scan for
+updated files.
+
+
+IMPROVEMENTS
+
+For improvements, send a mail to karltk@gentoo.org or make out a bug at
+bugs.gentoo.org and assign it to me.
diff --git a/deprecated/change/change b/deprecated/change/change
new file mode 100644
index 0000000..094573b
--- /dev/null
+++ b/deprecated/change/change
@@ -0,0 +1,343 @@
+#! /bin/bash
+
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# Author: Dan Armak <danarmak@gentoo.org>
+# $Header: /space/gentoo/cvsroot/gentoolkit/src/change/change,v 1.2 2002/08/11 13:32:12 karltk Exp $
+
+eval `grep PORTDIR= /etc/make.globals`
+eval `grep PORTDIR= /etc/make.conf`
+[ -z "$PORTDIR" ] && PORTDIR="/usr/portage"
+
+# register temp files (we delete them in the end)
+TMPMESSAGE=`tempfile -p change` || cleanup 1
+TMPHEADER=`tempfile -p change` || cleanup 1
+TMPENTRY=`tempfile -p change` || cleanup 1
+TMPOLDLOG=`tempfile -p change` || cleanup 1
+TMPCHANGELOG=`tempfile -p change` || cleanup 1
+
+# get user info from config file - $AUTHORNAME and $AUTHOREMAIL
+init() {
+ . ~/.gentoo/gentool-env || return 1
+}
+
+print_about() {
+
+ echo "change v 0.2.4 - A Gentoo ChangeLog editor."
+ echo "Author Dan Armak <danarmak@gentoo.org>"
+}
+
+print_usage() {
+
+ echo "Usage:
+change <package list> [-shv] [-m|--message msg] [-f|--message-file file]
+ [-a|--authorname name] [-l|--authormail mail]
+ [-n|--new-version ver] [-o|--output dest]
+
+<package list>: List of packages whose changelogs are to be edited. All
+changelogs edited in one run will be added the same log message.
+
+Acceptable formats: Example:
+category/package kde-base/kdebase
+path to package dir kdebase || ../../kdebase
+path to changelog file portage/kde-base/kdebase/ChangeLog
+
+Note that you must use -g for changelog files outside $PORTDIR.
+
+-m, --message \"msg\" Use log message \"msg\", do not open editor.
+-f, --message-file <file> Use contents of <file> as log message, do not open
+ editor.
+-a, --authorname \"name\" Use \"name\" (e.g. Dan Armak) in log.
+-l, --authormail \"email\" Use \"email\" (e.g. danarmak@gentoo.org) in log.
+-n, --new-version \"ver\" Add a line about a new version number \"ver\" to
+ the log.
+-g, --generate Create a new changelog file if one does not exist.
+ This option must come before the list of affected
+ changelog files. Incidentally, this option also
+ enables you to work with a changelog file outside
+ $PORTDIR.
+ You must use it every time you edit such a file.
+ However, change won't be able to figure out the
+ category and package names of your changelog file
+ and those parts will be missing. (FIXME!)
+-o, --output \"file\" Save new changelog in file \"file\".
+ Default is the the same file we're changing (i.e.
+ no backup).
+-s, --stdout Print new changelog to stdout (disables saving to
+ file). This suppresses the usual info messages.
+-c, --changed-files List of changed files (goes into entry header).
+ Default is to simply say \"ChangeLog :\". Multiple
+ -c options can be given.
+-h, --help Print this usage information.
+-v, --version Print a short about line and the version number and
+ exit.
+
+See also the mandatory config file ~/.gentoo/gentool-env (the gentool-env man
+page contains a template).
+"
+
+}
+
+# parse command line parameters
+# this function should be called before all others (e.g. before init())
+# or else it might stomp on some settings
+parse_params() {
+
+ # at least one parameter required - changelog to process
+ if [ -z "$1" ]; then
+ echo "At least one parameter is required."
+ print_about
+ print_usage
+ cleanup 1
+ fi
+
+ while [ -n "$1" ]; do
+
+ # note: with parameters that come in two pieces (i.e. -m foo)
+ # we identify the first one, grab the second one from $2 and
+ # shift an extra time
+ case "$1" in
+
+ # optional log message, if defined then we won't launch $EDITOR
+ # comes in explicit string and file reference variations
+ -m | --message)
+ MESSAGE="$2"
+ shift
+ ;;
+ -f | --message-file)
+ cp $2 $TMPMESSAGE
+ shift
+ ;;
+
+ # general settings (usually set in .change)
+ -a | --authorname)
+ AUTHORNAME="$2"
+ shift
+ ;;
+ -l | --authormail)
+ AUTHOREMAIL="$2"
+ shift
+ ;;
+
+ # add a line about a new version (starting with *) to the changelog
+ # to add the line but no changelog info, call with -n -m ""
+ -n | --new-version)
+ NEWVERSION="$2"
+ shift
+ ;;
+
+ # create a new changelog file
+ -g | --generate)
+ GENERATE=true
+ ;;
+
+ # output redirection. default (if $OUTPUT isn't set) is to change the
+ # specified changelog file.
+ # illegal if more than one changelog file/package is specified.
+ -o | --output)
+ OUTPUT="$2"
+ shift
+ ;;
+ # redirect output to stdout - can be combined with -o
+ -s | --stdout)
+ STDOUT="true"
+ OUTPUT="/dev/null"
+ ;;
+
+ # list of files changed (second part inclosed in quotes!)
+ -c | --changed-files)
+ CHANGED="$CHANGED $2"
+ shift
+ ;;
+
+ # request for version/usage information etc
+ -h | --help)
+ print_about
+ print_usage
+ cleanup 0
+ ;;
+ -v | --version)
+ print_about
+ cleanup 0
+ ;;
+
+ # everything else we couldn't identify. most of it is packages/files to work on.
+ *)
+ for x in "$MYPORTDIR/$1/ChangeLog" "$PORTDIR/$1/ChangeLog" "$PWD/$1/ChangeLog" "$PWD/$1"; do
+ if [ -f "$x" ]; then
+ FILES="$FILES $x"
+ shift # because by calling continue we skip the shift at the end of the case block
+ continue 2 # next while iteration
+ fi
+ done
+ # if we haveb't detected a changelog file, maybe we need to create one
+ if [ -n "$GENERATE" ]; then
+ for x in "$PWD/$1" "$1" "$MYPORTDIR/$1" "$PORTDIR/$1"; do
+ if [ -d "$x" ]; then
+ touch $x/ChangeLog
+ FILES="$FILES $x/ChangeLog"
+ shift # because by calling continue we skip the shift at the end of the case block
+ continue 2 # next while iteration
+ fi
+ done
+ fi
+
+ echo "!!! Error: unrecognized option: $1"
+ echo
+ print_usage
+ cleanup 1
+
+ ;;
+
+ esac
+
+ shift
+ done
+
+ if [ -z "$FILES" ]; then
+ echo "No changelog path or package name passed, mandatory parameter missing."
+ echo
+ print_usage
+ cleanup 1
+ fi
+
+}
+
+# get the log message
+get_msg() {
+
+ if [ -n "`cat $TMPMESSAGE`" ]; then
+ echo "Using message-on-file."
+ elif [ -n "$MESSAGE" ]; then
+ echo "$MESSAGE" > $TMPMESSAGE
+ else # [ -z "$MESSAGE" ]
+
+ echo > $TMPMESSAGE
+ echo "Please enter changelog. You can leave this line, it will be automatically removed." >> $TMPMESSAGE
+ $EDITOR $TMPMESSAGE
+ cp $TMPMESSAGE ${TMPMESSAGE}2
+ sed -e '/Please enter changelog. You can leave this line, it will be automatically removed./ D' \
+ ${TMPMESSAGE}2 > $TMPMESSAGE
+ rm ${TMPMESSAGE}2
+
+ fi
+
+ # break up into 80-character columns (actually 78 chars because we'll
+ # add two spaces to every line)
+ cp $TMPMESSAGE ${TMPMESSAGE}2
+ fmt -s -w 78 ${TMPMESSAGE}2 > $TMPMESSAGE
+ rm ${TMPMESSAGE}2
+
+ # add two spaces to the beginning of every line of the message.
+ # do this separately from the sed in the else section above
+ # because it should be executed for the if and elif sections too.
+ cp $TMPMESSAGE ${TMPMESSAGE}2
+ sed -e 's:^: :g' ${TMPMESSAGE}2 > $TMPMESSAGE
+ rm ${TMPMESSAGE}2
+
+}
+
+# get list of files and wrap it in the following manner:
+# 1 item on the first list and upto 80 chars on every other.
+# also adds 2 spaces to the beginning of every line but the first.
+wrap_list() {
+
+ echo -n $1
+ shift
+
+ while [ -n "$1" ]; do
+ if [ -n "$LIST" ]; then
+ LIST="$LIST, $1"
+ else
+ echo ,
+ LIST="$1"
+ fi
+ shift
+ done
+ LIST="$LIST :"
+
+ echo $LIST | fmt -s -w 78 | sed -e 's:^: :g' -
+
+}
+
+# do the actual work on te changelog file passed as $1
+process() {
+ # figure out category and package names
+ name=${1//${PORTDIR}}
+ name=${name//${MYPORTDIR}}
+ name=${name//\/ChangeLog}
+
+ OLDIFS="$IFS"
+ IFS="/"
+ for x in $name; do
+ if [ -z "$CATEGORY" ]; then
+ CATEGORY="$x"
+ else
+ PACKAGE="$x"
+ fi
+ done
+ IFS="$OLDIFS"
+
+ # create header
+ echo \
+"# ChangeLog for $CATEGORY/$PACKAGE
+# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL v2
+# \$Header: \$
+" > $TMPHEADER
+
+ # create entry line
+ if [ -n "$NEWVERSION" ]; then
+ echo "*$PACKAGE-$NEWVERSION (`date '+%d %b %Y'`)" > $TMPENTRY
+ echo >> $TMPENTRY
+ fi
+
+ echo -n " `date "+%d %b %Y"`; ${AUTHORNAME} <${AUTHOREMAIL}> " >> $TMPENTRY
+ [ -z "$CHANGED" ] && CHANGED="ChangeLog "
+ wrap_list $CHANGED >> $TMPENTRY
+
+ echo >> $TMPENTRY
+
+ # get the original changelog, minus the old header
+ sed -e '/^# ChangeLog for/ D
+ /^# Copyright 2002 Gentoo Technologies/ D
+ /^# \$Header:/ D' $1 > $TMPOLDLOG
+
+ # join everything together
+ cat $TMPHEADER $TMPENTRY $TMPMESSAGE $TMPOLDLOG > $TMPCHANGELOG
+
+ # various output options
+ if [ -n "$OUTPUT" ]; then
+ cp $TMPCHANGELOG $OUTPUT
+ [ -z "$STDOUT" ] && echo "New changelog saved in $OUTPUT."
+ else
+ cp $TMPCHANGELOG $1
+ [ -z "$STDOUT" ] && echo "Original changelog $1 replaced."
+ fi
+
+ if [ -n "$STDOUT" ]; then
+ cat $TMPCHANGELOG
+ fi
+
+}
+
+# pass exit code to this function
+cleanup() {
+
+ rm -f $TMPMESSAGE $TMPHEADER $TMPENTRY $TMPCHANGELOG $TMPOLDLOG
+
+ exit $1
+
+}
+
+parse_params "${@}"
+
+init
+
+get_msg
+
+for x in $FILES; do
+ process $x
+done
+
+cleanup 0
+
diff --git a/deprecated/change/change.1 b/deprecated/change/change.1
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/change/change.1
diff --git a/deprecated/dep-clean/AUTHORS b/deprecated/dep-clean/AUTHORS
new file mode 100644
index 0000000..2fa030f
--- /dev/null
+++ b/deprecated/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/deprecated/dep-clean/ChangeLog b/deprecated/dep-clean/ChangeLog
new file mode 100644
index 0000000..dc6980e
--- /dev/null
+++ b/deprecated/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/deprecated/dep-clean/README b/deprecated/dep-clean/README
new file mode 100644
index 0000000..6521aef
--- /dev/null
+++ b/deprecated/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/deprecated/dep-clean/dep-clean b/deprecated/dep-clean/dep-clean
new file mode 100644
index 0000000..2f2bde0
--- /dev/null
+++ b/deprecated/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/deprecated/dep-clean/dep-clean.1 b/deprecated/dep-clean/dep-clean.1
new file mode 100644
index 0000000..9e42019
--- /dev/null
+++ b/deprecated/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)
diff --git a/deprecated/dev-scripts/README b/deprecated/dev-scripts/README
new file mode 100644
index 0000000..990a2ab
--- /dev/null
+++ b/deprecated/dev-scripts/README
@@ -0,0 +1,2 @@
+This directory is intended to be used for small developer oriented scripts used in gentoolkit-dev.
+If a script develops into a full fledged tool, it will be moved into its own subdirectory.
diff --git a/deprecated/dev-scripts/included_headers.sh b/deprecated/dev-scripts/included_headers.sh
new file mode 100755
index 0000000..915628b
--- /dev/null
+++ b/deprecated/dev-scripts/included_headers.sh
@@ -0,0 +1,159 @@
+#!/bin/bash
+
+# CHANGES
+#
+# 20051211: Add qfile use from portage-utils, prefer over equery. Create new
+# function track_headers() to handle package manager queries for both
+# relative and absolute headers. Split relative and absolute queries into two
+# separate places, since relative aren't quite as reliable. Prefer headers
+# found in the tarball over those in /usr/include. Also, note which headers
+# weren't considered in the calculation and the reasons why not.
+
+location=${1}
+
+usage() {
+ echo "${0##*/} [ -d ] source_location"
+ echo " Returns owners of all include files used. ${0##*/} defaults to"
+ echo " files in /usr/include, so if a file with the same name within the"
+ echo " source is the actual one used, false dependencies may be printed."
+ echo
+ echo " -d"
+ echo " Show debug output: Print files not found"
+ exit 1
+}
+
+decho() {
+ if [[ -n "${DEBUG}" ]]; then
+ echo "${1}"
+ fi
+}
+
+if [[ $# -le 0 ]] || [[ $# -ge 3 ]]; then
+ usage
+fi
+
+# Handle command-line options
+while getopts d options; do
+ case ${options} in
+ d) DEBUG=1
+ ;;
+ *) usage
+ ;;
+ esac
+done
+# Reset post-option stuff to positional parameters
+shift $((OPTIND - 1))
+
+get_absolute_includes() {
+ grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '<' -e '>' \
+ | cut -d':' -f2 | cut -d'<' -f2 | cut -d'>' -f1 | grep '.*.[ch]' \
+ | sort | uniq
+}
+
+get_relative_includes() {
+ grep '^#[[:space:]]*include' -r ${1} | grep '.*.[ch]' | grep -e '"' -e '"' \
+ | cut -d':' -f2 | cut -d'"' -f2 | cut -d'"' -f1 | grep '.*.[ch]' \
+ | sort | uniq
+}
+
+track_headers() {
+ if [[ -x $(which qfile 2> /dev/null) ]]; then
+ qfile ${@} | cut -d'(' -f1 | sort | uniq
+ elif [[ -x $(which equery 2> /dev/null) ]]; then
+ equery -q belongs ${@} | cut -d'(' -f1
+ elif [[ -x $(which rpm 2> /dev/null) ]]; then
+ rpm -qf ${@}
+ else
+ echo "Couldn't find package query tool! Printing headerpaths instead."
+ echo
+ for header in ${@}; do
+ echo ${header}
+ done
+ fi
+}
+
+echo "Analyzing source ... "
+absolute_headers="$(get_absolute_includes ${1})"
+relative_headers="$(get_relative_includes ${1})"
+
+echo "Looking for absolute headers ... "
+echo
+for header in ${absolute_headers}; do
+ absheader="/usr/include/${header}"
+ if [[ -e ${absheader} ]]; then
+ abs_headerpaths="${abs_headerpaths} ${absheader}"
+ echo " Looking for ${absheader} ... OK"
+ else
+ # Try as a relative header in case people use -I with <>
+ relative_headers="${relative_headers} ${header}"
+ decho " Looking for ${absheader} ... Not found!"
+ fi
+done
+
+echo
+echo "Looking for relative headers ... "
+echo
+for header in ${relative_headers}; do
+ fullheader=${header}
+ header=${header##*/}
+ # Prefer headers in tarball over /usr/include
+ header_options=$(find ${location} -name ${header} | grep ${fullheader})
+ if [[ -z ${header_options} ]]; then
+ header_options="$(find /usr/include -name ${header} | grep ${fullheader})"
+ header_loc="/usr/include"
+ else
+ decho " Local header ${header} ... Not considering."
+ local_headers="${local_headers} ${header}"
+ continue
+ fi
+ count="0"
+ for found in ${header_options}; do
+ (( count++ ))
+ done
+ if [[ ${count} -ge 2 ]]; then
+ echo " Looking for ${header} ... "
+ echo " More than one option found for ${header} in ${header_loc}."
+ echo " Not considering ${header}."
+ duplicate_headers="${duplicate_headers} ${header}"
+ continue
+ elif [[ ${count} -le 0 ]]; then
+ decho " Looking for ${header} ... Not found!"
+ unfound_headers="${unfound_headers} ${header}"
+ continue
+ fi
+ header=${header_options}
+ if [[ -e ${header} ]] && [[ ${header_loc} = /usr/include ]]; then
+ rel_headerpaths="${rel_headerpaths} ${header}"
+ echo " Looking for ${header} ... OK"
+ else
+ decho " Looking for ${header} ... Not found!"
+ fi
+done
+
+echo "Tracing headers back to packages ..."
+echo
+echo "Headers ignored because they exist in the tarball:"
+echo
+for header in ${local_headers}; do
+ echo "${header}"
+done
+echo
+echo "Headers ignored because of duplicates in /usr/include:"
+echo
+for header in ${duplicate_headers}; do
+ echo "${header}"
+done
+echo
+echo "Headers ignored because they weren't found:"
+echo
+for header in ${unfound_headers}; do
+ echo "${header}"
+done
+echo
+echo "Absolute headers:"
+echo
+track_headers ${abs_headerpaths}
+echo
+echo "Relative headers:"
+echo
+track_headers ${rel_headerpaths}
diff --git a/deprecated/dev-scripts/linking_libs.sh b/deprecated/dev-scripts/linking_libs.sh
new file mode 100755
index 0000000..a249305
--- /dev/null
+++ b/deprecated/dev-scripts/linking_libs.sh
@@ -0,0 +1,204 @@
+#!/bin/bash
+
+# CHANGES
+#
+# 20051211: Move most of the logic to check for bad links into get_libnames()
+# seds, so we don't wrongly sed out whole link lines. Seems to catch more
+# problems, such as ' or ` or -- in a link.
+# 20051210: Prefer qfile from portage-utils over equery if it's available.
+# Check for ... in "link" lines because configure checks are not links.
+# Change get_link_generic() to handle whole lines at a time instead of single
+# words, so get_linklines() works.
+# 20051210: Rework get_libnames() to use a new style of grep, because the old
+# way was broken on some packages from the \b. Also optimize the "Looking for
+# libraries" section to only grep the log file once for links and cache it;
+# also only grep the link lines ones for a given library, then parse the
+# output for static or shared. Should speed things up considerably for large
+# packages. I get 5 seconds in Analyzing log and 15 in Looking for libs on an
+# xorg-x11-6.8.99.15 log on second run.
+# Create get_link_generic() that both sections call with different options.
+
+usage() {
+ echo "${0##*/} compilation_log"
+ echo " Checks for -lfoo link commands and finds the library owners."
+ exit 1
+}
+
+if [[ $# -lt 1 || $1 == -h || $1 == --help ]]; then
+ usage
+fi
+
+
+# Finds all lines in a file that involve linking
+# get_link_generic(char *grep_opts, char *filename)
+get_link_generic() {
+ egrep ${1} '\-l\w[^[:space:]]*' ${2} \
+ | while read linker; do
+ # -linker is passed through to ld and doesn't mean the inker lib.
+ # The new -w in grep makes sure they're separate "words", but its
+ # "word" characters only include alnum and underscore, so -- gets
+ # through.
+ # Some configure lines with ... match, so we drop them
+ # Some of the configure options match, so we get rid of = for that.
+ if \
+ [[ "${linker}" != *...* ]] \
+ && [[ "${linker}" != -lib ]] \
+ && [[ "${linker}" != -libs ]]; then
+ echo ${linker}
+ fi
+ done
+}
+
+# Note the lack of -o, as compared to get_libnames() egrep
+get_linklines() {
+ get_link_generic "-w" ${1} | sort | uniq
+}
+
+get_libnames() {
+ for x; do
+ get_link_generic "-o -w" ${x} \
+ | sed \
+ -e "/^-link/d" \
+ -e "/^-lib/d" \
+ -e "s:^-l::g" \
+ -e "/=/d" \
+ -e "/'/d" \
+ -e "/^-/d" \
+ -e "s:\.*$::g" \
+ -e "s:|::g" \
+ -e "s:\"::g" \
+ -e "/^-link/d" \
+ -e "/^-lib/d"
+ done | sort | uniq
+}
+
+get_libdirs() {
+ cat /etc/ld.so.conf | sed -e "/^#/d"
+}
+
+check_exists() {
+ if [[ -n ${1// } ]]; then
+ return 0
+ fi
+
+ return 1
+}
+
+trace_to_packages() {
+ local paths=$1
+
+ check_exists "${paths}"
+ local ret=$?
+ if [[ $ret -ne 0 ]]; then
+ return 1
+ fi
+
+ if [[ -x $(which qfile 2> /dev/null) ]]; then
+ qfile -q ${paths} | sort | uniq
+ elif [[ -x $(which equery 2> /dev/null) ]]; then
+ equery -q belongs ${paths} | cut -d'(' -f1
+ elif [[ -x $(which rpm 2> /dev/null) ]]; then
+ rpm -qf ${paths}
+ else
+ echo "Couldn't find package query tool! Printing paths instead."
+ echo
+ for path in ${paths}; do
+ echo ${path}
+ done
+ fi
+}
+
+# *64 needs to be first, as *lib is a symlink to it so equery screws up
+libdirs="/lib64 /usr/lib64 /lib /usr/lib $(get_libdirs)"
+
+echo "Analyzing log ..."
+libnames=$(get_libnames "$@")
+
+#echo libnames=$libnames
+
+echo "Looking for libraries ..."
+linker_lines=$(get_linklines ${1})
+
+#echo linker_lines=$linker_lines
+
+for libname in ${libnames}; do
+ static=0
+ shared=0
+ line=$(echo ${linker_lines} | grep "\b-l${libname}\b")
+ if echo ${line} | grep -q '\b-static\b'; then
+ static=1
+ fi
+ if ! echo ${line} | grep -q '\b-static\b'; then
+ shared=1
+ fi
+ staticlibname="lib${libname}.a"
+ sharedlibname="lib${libname}.so"
+ if [[ ${static} -eq 1 ]]; then
+ echo -n " Looking for ${staticlibname} ... "
+ for libdir in ${libdirs}; do
+ found=0
+ if [[ -e ${libdir}/${staticlibname} ]]; then
+ libpaths="${libpaths} ${libdir}/${staticlibname}"
+ found=1
+ echo "OK"
+ break
+ fi
+ done
+ if [[ ${found} -ne 1 ]]; then
+ echo "Not found!"
+ fi
+ fi
+ if [[ ${shared} -eq 1 ]]; then
+ echo -n " Looking for ${sharedlibname} ... "
+ for libdir in ${libdirs}; do
+ found=0
+ if [[ -e ${libdir}/${sharedlibname} ]]; then
+ libpaths="${libpaths} ${libdir}/${sharedlibname}"
+ found=1
+ echo "OK"
+ break
+ fi
+ done
+ if [[ ${found} -ne 1 ]]; then
+ echo "Not found!"
+ fi
+ fi
+done
+
+# Add backslashes in front of any + symbols
+libpaths=${libpaths//+/\\+}
+
+echo "Looking for build tools (imake, etc) ..."
+BUILD_PKGS=$(egrep -h "$@" \
+ -e '^(/usr/(X11R6/)?bin/)?rman' \
+ -e '^(/usr/(X11R6/)?bin/)?gccmakedep' \
+ -e '^(/usr/(X11R6/)?bin/)?makedepend' \
+ -e '^(/usr/(X11R6/)?bin/)?imake' \
+ -e '^(/usr/(X11R6/)?bin/)?rman' \
+ -e '^(/usr/(X11R6/)?bin/)?lndir' \
+ -e '^(/usr/(X11R6/)?bin/)?xmkmf' \
+ | awk '{ print $1 }' \
+ | sort \
+ | uniq)
+
+for PKG in ${BUILD_PKGS}; do
+ PKG=$(basename ${PKG})
+ echo -n " Looking for ${PKG} ... "
+ if [[ -e /usr/bin/${PKG} ]]; then
+ echo "OK"
+ buildpaths="${buildpaths} ${PKG}"
+ else
+ echo "Not found!"
+ fi
+done
+
+echo
+echo "Tracing libraries back to packages ..."
+echo
+trace_to_packages "${libpaths}"
+
+echo
+echo "Tracing build tools back to packages ..."
+echo
+
+trace_to_packages "${buildpaths}"
diff --git a/deprecated/distfiles-clean/AUTHORS b/deprecated/distfiles-clean/AUTHORS
new file mode 100644
index 0000000..d913891
--- /dev/null
+++ b/deprecated/distfiles-clean/AUTHORS
@@ -0,0 +1,6 @@
+José Fonseca <j_r_fonseca@yahoo.co.uk>
+ * Wrote the script
+
+Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Wrote the man page.
+
diff --git a/deprecated/distfiles-clean/ChangeLog b/deprecated/distfiles-clean/ChangeLog
new file mode 100644
index 0000000..dfe6aa8
--- /dev/null
+++ b/deprecated/distfiles-clean/ChangeLog
@@ -0,0 +1,2 @@
+2002-15-11: Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Imported newest contributions from #10647.
diff --git a/deprecated/distfiles-clean/TODO b/deprecated/distfiles-clean/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/distfiles-clean/TODO
diff --git a/deprecated/distfiles-clean/distfiles-clean b/deprecated/distfiles-clean/distfiles-clean
new file mode 100644
index 0000000..23af32b
--- /dev/null
+++ b/deprecated/distfiles-clean/distfiles-clean
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# distfiles-clean
+#
+# Cleans unused files from Portage's distfiles directory.
+#
+# José Fonseca <j_r_fonseca@yahoo.co.uk>
+
+PROGRAM=`basename "$0"`
+
+while [ ${#} -gt 0 ]
+do
+ case "$1" in
+ -h|--help)
+ USAGE=y
+ break
+ ;;
+ -i|--ignore)
+ IGNORE="$IGNORE $2"
+ shift 2
+ ;;
+ -I|--ignore-file)
+ IGNORE="$IGNORE `cat "$2"`"
+ shift 2
+ ;;
+ -p|--pretend)
+ PRETEND=y
+ shift
+ ;;
+ *)
+ echo "$PROGRAM: Invalid option \'$1\'" 1>&2
+ USAGE=y
+ break
+ ;;
+ esac
+done
+
+# For PORTDIR and DISTDIR
+. /etc/make.globals
+. /etc/make.conf
+
+if [ "$USAGE" ]
+then
+ echo "Usage: $PROGRAM [-h|--help] [-i|--ignore <glob>] [-I|--ignore-file <globfile>] [-p|--pretend]"
+ echo "Cleans unused files from $DISTDIR directory."
+ exit
+fi
+
+DBDIR=/var/db/pkg
+CACHEDIR=/var/cache/edb/dep
+
+for DIR in "$PORTDIR" "$DISTDIR" "$DBDIR" "$CACHEDIR"
+do
+ if [ ! -d "$DIR" ]
+ then
+ echo "$PROGRAM: \'$DIR\' not found."
+ exit
+ fi
+done
+
+TMPFILE=`mktemp /tmp/$PROGRAM.XXXXXX`
+
+cd "$DISTDIR"
+
+{
+ echo "cvs-src"
+ [ "$IGNORE" ] && ls -1d $IGNORE
+ find "$DBDIR" -name '*.ebuild' | sed -n -e "s:^$DBDIR/\([^/]*\)/\([^/]*\)/\([^/]*\)\.ebuild$:$CACHEDIR/\1/\3:p" | xargs sed -s -e '4!d;/^$/d;s/[[:alnum:]]\+?\|(\|)//g;s/\<[^[:space:]]\+\/\<//g;s/^[[:space:]]\+//g;s/[[:space:]]\+$//g;s/[[:space:]]\+/\n/g'
+} | sort -u > "$TMPFILE" && ls -1 | comm -23 - "$TMPFILE" | {
+ if [ "$PRETEND" ]
+ then
+ cat
+ else
+ xargs rm -f
+ fi
+}
+
+rm "$TMPFILE"
diff --git a/deprecated/epkginfo/AUTHORS b/deprecated/epkginfo/AUTHORS
new file mode 100644
index 0000000..f499856
--- /dev/null
+++ b/deprecated/epkginfo/AUTHORS
@@ -0,0 +1,3 @@
+Author: Ned Ludd <solar@gentoo.org> (glue all the parts together)
+Author: Eldad Zack <eldad@gentoo.org> (earch)
+Author : Eric Olinger <EvvL AT RustedHalo DOT net> (metadata)
diff --git a/deprecated/epkginfo/README b/deprecated/epkginfo/README
new file mode 100644
index 0000000..f0e3656
--- /dev/null
+++ b/deprecated/epkginfo/README
@@ -0,0 +1 @@
+epkginfo is now a an alias for equery meta. This is the original version that was written by solar.
diff --git a/deprecated/epkginfo/epkginfo b/deprecated/epkginfo/epkginfo
new file mode 100755
index 0000000..fd59e4b
--- /dev/null
+++ b/deprecated/epkginfo/epkginfo
@@ -0,0 +1,244 @@
+#!/usr/bin/python
+##############################################################################
+# $Header: $
+##############################################################################
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author: Ned Ludd <solar@gentoo.org> (glue all the parts together)
+# Author: Eldad Zack <eldad@gentoo.org> (earch)
+# Author : Eric Olinger <EvvL AT RustedHalo DOT net> (metadata)
+
+# Gentoo metadata xml and arch keyword checking tool.
+
+import os
+import sys
+import re
+from stat import *
+from xml.sax import saxutils, make_parser, handler
+from xml.sax.handler import feature_namespaces
+
+import portage
+from portage.output import *
+
+__version__ = "svn"
+
+def earch(workdir):
+ """Prints arch keywords for a given dir"""
+ portdir = portage.settings["PORTDIR"]
+ #workdir = "."
+ os.chdir(workdir)
+
+ archdict = {}
+ ebuildlist = []
+ for file in os.listdir(workdir):
+ if re.search("\.ebuild$",file):
+ ebuildlist.append(re.split("\.ebuild$",file)[0])
+
+ ebuildlist.sort(lambda x,y: portage.pkgcmp(portage.pkgsplit(x),portage.pkgsplit(y)))
+
+ slot_list = []
+
+ for pkg in ebuildlist:
+ portdb = portage.portdbapi(portdir)
+ aux = portdb.aux_get(workdir.rsplit("/")[-2] + "/" + pkg, ['SLOT', 'KEYWORDS'])
+
+ slot = aux[0]
+ keywords = keywords = re.split(' ',aux[1])
+
+ if not slot in slot_list:
+ slot_list.append(slot)
+
+ for arch in keywords:
+ if arch in archdict:
+ archdict[arch].append((pkg, slot))
+ else:
+ archdict[arch] = [ (pkg, slot) ]
+
+ archlist = archdict.keys();
+ archlist.sort()
+
+ slot_list.sort()
+
+ for slot in slot_list:
+ visible_stable = {}
+ visible_unstable = {}
+
+ for arch in archlist:
+ visible_stable[arch] = None
+ visible_unstable[arch] = None
+
+ for pkg in ebuildlist:
+ for arch in archlist:
+ if (arch and (pkg, slot) in archdict[arch]):
+ if arch[0] == "-":
+ pass
+ elif "~" == arch[0]:
+ visible_unstable[arch] = pkg
+ else:
+ visible_unstable["~" + arch] = None
+ visible_stable[arch] = pkg
+
+ for pkg in ebuildlist:
+ found = False
+ for arch in archlist:
+ if (pkg, slot) in archdict[arch]:
+ found = True
+
+ if not found:
+ continue
+
+ if not pkg == ebuildlist[0]:
+ print ""
+
+ print darkgreen("Keywords: ") + pkg + "[" + slot + "]:",
+
+ for arch in archlist:
+ if (arch and (pkg, slot) in archdict[arch]):
+ if arch[0] == "-":
+ print red(arch),
+ elif "~" == arch[0]:
+ if visible_unstable[arch] == pkg:
+ print blue(arch),
+ else:
+ if visible_stable[arch] == pkg:
+ print green(arch),
+
+
+class Metadata_XML(handler.ContentHandler):
+ _inside_herd="No"
+ _inside_maintainer="No"
+ _inside_email="No"
+ _inside_longdescription="No"
+
+ _herd = []
+ _maintainers = []
+ _longdescription = ""
+
+ def startElement(self, tag, attr):
+ if tag == "herd":
+ self._inside_herd="Yes"
+ if tag == "longdescription":
+ self._inside_longdescription="Yes"
+ if tag == "maintainer":
+ self._inside_maintainer="Yes"
+ if tag == "email":
+ self._inside_email="Yes"
+
+ def endElement(self, tag):
+ if tag == "herd":
+ self._inside_herd="No"
+ if tag == "longdescription":
+ self._inside_longdescription="No"
+ if tag == "maintainer":
+ self._inside_maintainer="No"
+ if tag == "email":
+ self._inside_email="No"
+
+ def characters(self, contents):
+ if self._inside_herd == "Yes":
+ self._herd.append(contents)
+
+ if self._inside_longdescription == "Yes":
+ self._longdescription = contents
+
+ if self._inside_maintainer=="Yes" and self._inside_email=="Yes":
+ self._maintainers.append(contents)
+
+
+def check_metadata(full_package):
+ """Checks that the primary maintainer is still an active dev and list the herd the package belongs to"""
+ metadata_file=portage.settings["PORTDIR"] + "/" + portage.pkgsplit(full_package)[0] + "/metadata.xml"
+ if not os.path.exists(metadata_file):
+ print darkgreen("Maintainer: ") + red("Error (Missing metadata.xml)")
+ return 1
+
+ parser = make_parser()
+ handler = Metadata_XML()
+ handler._maintainers = []
+ parser.setContentHandler(handler)
+ parser.parse( metadata_file )
+
+ if handler._herd:
+ herds = ", ".join(handler._herd)
+ print darkgreen("Herd: ") + herds
+ else:
+ print darkgreen("Herd: ") + red("Error (No Herd)")
+ return 1
+
+
+ if handler._maintainers:
+ print darkgreen("Maintainer: ") + ", ".join(handler._maintainers)
+ else:
+ print darkgreen("Maintainer: ") + "none"
+
+ if len(handler._longdescription) > 1:
+ print darkgreen("Description: ") + handler._longdescription
+ print darkgreen("Location: ") + os.path.normpath(portage.settings["PORTDIR"] + "/" + portage.pkgsplit(full_package)[0])
+
+
+def usage(code):
+ """Prints the uage information for this script"""
+ print green("epkginfo"), "(%s)" % __version__
+ print
+ print "Usage: epkginfo [package-cat/]package"
+ sys.exit(code)
+
+
+# default color setup
+if ( not sys.stdout.isatty() ) or ( portage.settings["NOCOLOR"] in ["yes","true"] ):
+ nocolor()
+
+def fc(x,y):
+ return cmp(y[0], x[0])
+
+
+def grab_changelog_devs(catpkg):
+ try:
+ os.chdir(portage.settings["PORTDIR"] + "/" + catpkg)
+ foo=""
+ r=re.compile("<[^@]+@gentoo.org>", re.I)
+ s="\n".join(portage.grabfile("ChangeLog"))
+ d={}
+ for x in r.findall(s):
+ if x not in d:
+ d[x] = 0
+ d[x] += 1
+
+ l=[(d[x], x) for x in d.keys()]
+ #l.sort(lambda x,y: cmp(y[0], x[0]))
+ l.sort(fc)
+ for x in l:
+ p = str(x[0]) +" "+ x[1].lstrip("<").rstrip(">")
+ foo += p[:p.find("@")]+", "
+ return foo
+ except:
+ raise
+
+def main ():
+ if len( sys.argv ) < 2:
+ usage(1)
+
+ for pkg in sys.argv[1:]:
+
+ if sys.argv[1:][:1] == "-":
+ print "NOT WORKING?=="+sys.argv[1:]
+ continue
+
+ try:
+ package_list = portage.portdb.xmatch("match-all", pkg)
+ if package_list:
+
+ catpkg = portage.pkgsplit(package_list[0])[0]
+
+ print darkgreen("Package: ") + catpkg
+ check_metadata(package_list[0])
+ earch(portage.settings["PORTDIR"] + "/" + catpkg)
+ #print darkgreen("ChangeLog: ") + grab_changelog_devs(catpkg)
+ print ""
+ else:
+ print "!!! No package '%s'" % pkg
+ except:
+ print red("Error: "+pkg+"\n")
+
+
+if __name__ == '__main__':
+ main()
diff --git a/deprecated/epkginfo/epkginfo.1 b/deprecated/epkginfo/epkginfo.1
new file mode 100644
index 0000000..cefe602
--- /dev/null
+++ b/deprecated/epkginfo/epkginfo.1
@@ -0,0 +1,34 @@
+.TH "epkginfo" "1" "0.4.1" "Ned Ludd" "gentoolkit"
+.SH "NAME"
+.LP
+epkginfo \- Displays metadata information from packages in portage
+.SH "SYNTAX"
+.LP
+epkginfo [\fIpackage\-cat/\fP]package
+.SH "EXAMPLES"
+$ epkginfo app\-portage/gentoolkit
+.br
+\fBPackage:\fR app\-portage/gentoolkit
+.br
+\fBHerd:\fR tools\-portage
+.br
+\fBMaintainer:\fR tools\-portage
+.br
+\fBLocation:\fR /usr/portage/app\-portage/gentoolkit
+.br
+\fBKeywords:\fR gentoolkit\-0.2.2:
+.br
+\fBKeywords:\fR gentoolkit\-0.2.3: mips
+.br
+\fBKeywords:\fR gentoolkit\-0.2.3\-r1: ppc ppc64 alpha arm s390 amd64 hppa x86 sparc ia64 m68k sh
+.br
+\fBKeywords:\fR gentoolkit\-0.2.4_pre3:
+.br
+\fBKeywords:\fR gentoolkit\-0.2.4_pre4:
+.br
+\fBKeywords:\fR gentoolkit\-0.2.4_pre5: ~arm ~hppa ~x86 ~m68k ~amd64 ~ppc ~sh ~x86\-fbsd ~ia64 ~alpha ~sparc ~ppc64 ~sparc\-fbsd ~mips ~s390
+.SH "AUTHORS"
+.LP
+Ned Ludd <solar@gentoo.org>
+.SH "BUGS"
+Please report any bugs to http://bugs.gentoo.org
diff --git a/deprecated/epkgmove/AUTHORS b/deprecated/epkgmove/AUTHORS
new file mode 100644
index 0000000..38fdca1
--- /dev/null
+++ b/deprecated/epkgmove/AUTHORS
@@ -0,0 +1,2 @@
+Maintainer:
+Ian Leitch <port001@gentoo.org>
diff --git a/deprecated/epkgmove/ChangeLog b/deprecated/epkgmove/ChangeLog
new file mode 100644
index 0000000..6bfb8d7
--- /dev/null
+++ b/deprecated/epkgmove/ChangeLog
@@ -0,0 +1,20 @@
+2004-02-03 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Updated epkgmove to 1.3.1, as availble on
+ http://dev.gentoo.org/~port001/DevTools/epkgmove/epkgmove-1.3.1.py
+
+2004-09-27 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Updated epkgmove to 1.1, as availble on
+ http://dev.gentoo.org/~port001/DevTools/epkgmove/epkgmove-1.1.py
+
+2004-09-10 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Updated epkgmove to 1.0, as availble on
+ http://dev.gentoo.org/~port001/DevTools/epkgmove/epkgmove-1.0.py
+
+2004-07-21 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Updated epkgmove to 0.5, as availble on
+ http://dev.gentoo.org/~port001/DevTools/epkgmove/epkgmove-0.5.py
+
+2004-04-02 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Updated epkgmove to 0.4, as availble on
+ http://dev.gentoo.org/~port001/DevTools/epkgmove/epkgmove-0.4.py
+
diff --git a/deprecated/epkgmove/Makefile b/deprecated/epkgmove/Makefile
new file mode 100644
index 0000000..ce9b950
--- /dev/null
+++ b/deprecated/epkgmove/Makefile
@@ -0,0 +1,20 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+.PHONY: all
+all:
+
+dist:
+ mkdir -p ../../$(distdir)/src/epkgmove/
+ cp Makefile AUTHORS README TODO ChangeLog epkgmove ../../$(distdir)/src/epkgmove/
+
+install: all
+ install -m 0755 epkgmove $(bindir)/
+ install -d $(docdir)/epkgmove
+ install -m 0644 AUTHORS README TODO ChangeLog $(docdir)/epkgmove/
+# install -m 0644 epkgmove.1 $(mandir)/
diff --git a/deprecated/epkgmove/README b/deprecated/epkgmove/README
new file mode 100644
index 0000000..4668fa3
--- /dev/null
+++ b/deprecated/epkgmove/README
@@ -0,0 +1,16 @@
+
+Package : epkgmove
+Version : 0.5
+Author : See AUTHORS
+
+MOTIVATION
+
+Eases moving around ebuilds in the Portage CVS tree.
+
+MECHANICS
+
+N/A
+
+IMPROVEMENTS
+
+N/A
diff --git a/deprecated/epkgmove/TODO b/deprecated/epkgmove/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/epkgmove/TODO
diff --git a/deprecated/epkgmove/epkgmove b/deprecated/epkgmove/epkgmove
new file mode 100644
index 0000000..42b6e7d
--- /dev/null
+++ b/deprecated/epkgmove/epkgmove
@@ -0,0 +1,895 @@
+#!/usr/bin/python -O
+# Copyright 2004 Ian Leitch
+# Copyright 1999-2004 Gentoo Foundation
+# $Header$
+#
+# Author:
+# Ian Leitch <port001@gentoo.org>
+#
+
+import os
+import re
+import sys
+import signal
+import commands
+from time import sleep
+from random import randint
+from optparse import OptionParser
+
+import portage
+try:
+ from portage.output import *
+except ImportError:
+ from output import *
+
+__author__ = "Ian Leitch"
+__email__ = "port001@gentoo.org"
+__productname__ = "epkgmove"
+__version__ = "1.3.1 - \"Moving Fusion + Bandages + Plasters\""
+__description__ = "A tool for moving and renaming packages in CVS"
+
+def print_usage():
+
+ print
+ print "%s %s [ %s ] [ %s ] [ %s ]" % (white("Usage:"), turquoise(__productname__), green("option"), green("origin"), green("destination"))
+ print " '%s' and '%s' are expected as a full package name, e.g. net-im/gaim" % (green("origin"), green("destination"))
+ print " See %s --help for a list of options" % __productname__
+ print
+
+def check_cwd(portdir):
+
+ if os.getcwd() != portdir:
+ print
+ print "%s Not in PORTDIR!" % yellow(" *")
+ print "%s Setting to: %s" % (yellow(" *"), os.getcwd())
+ os.environ["PORTDIR"]=os.getcwd()
+ return os.getcwd()
+
+ return portdir
+
+def check_args(args, portdir, options, cvscmd):
+
+ booboo = False
+ re_expr = "^[\da-zA-Z-]{,}/[\d\w0-9-]{,}$"
+ o_re_expr = re.compile(re_expr)
+
+ if len(args) == 0:
+ print "\n%s ERROR: errr, didn't you forget something" % red("!!!"),
+ count = range(3)
+ for second in count:
+ sys.stdout.write(".")
+ sys.stdout.flush()
+ sleep(1)
+ sys.stdout.write("?")
+ sys.stdout.flush()
+ sleep(1)
+ print "\n\n%s %s hits you with a clue stick %s" % (green(" *"), __productname__, green("*"))
+ sleep(1)
+ print_usage()
+ sys.exit(1)
+
+ if options.remove:
+ if len(args) > 1:
+ error("Please remove packages one at a time")
+ sys.exit(1)
+ elif not o_re_expr.match(args[0].rstrip("/")):
+ error("Expected full package name as argument")
+ sys.exit(1)
+ elif not os.path.exists(os.path.join(portdir, args[0].rstrip("/"))):
+ error("No such package '%s'" % args[0].rstrip("/"))
+ sys.exit(1)
+ else:
+ if not options.cvs_up:
+ update_categories(portdir, args, cvscmd["update"])
+ return (args[0].rstrip("/"), None)
+
+ if len(args) == 2:
+ if not o_re_expr.match(args[0].rstrip("/")):
+ error("Expected full package name as origin argument")
+ booboo = True
+ elif not o_re_expr.match(args[1].rstrip("/")):
+ error("Expected full package name as destination argument")
+ booboo = True
+
+ if booboo == True:
+ sys.exit(1)
+ else:
+ error("Expected two arguments as input.")
+ print_usage()
+ sys.exit(1)
+
+ if not options.cvs_up:
+ update_categories(portdir, args, cvscmd["update"])
+
+ if not os.path.exists(os.path.join(portdir, args[0].rstrip("/"))):
+ error("No such package '%s'" % args[0].rstrip("/"))
+ booboo = True
+ elif os.path.exists(os.path.join(portdir, args[1].rstrip("/"))):
+ error("Package '%s' already exists" % args[1].rstrip("/"))
+ booboo = True
+
+ if booboo == True:
+ sys.exit(1)
+
+ return (args[0].rstrip("/"), args[1].rstrip("/"))
+
+def check_repos(portdir):
+
+ files = os.listdir(portdir)
+
+ for file in files:
+ if not os.path.isdir(file):
+ files.remove(file)
+
+ if "CVS" not in files:
+ error("Current directory doesn't look like a CVS repository")
+ sys.exit(1)
+
+def check_commit_queue():
+
+ empty = True
+
+ print
+ print "%s Checking commit queue for outstanding changes..." % green(" *")
+ print "%s Note: This may take a VERY long time" % yellow(" *")
+ print
+
+ output = commands.getoutput("cvs diff")
+
+ for line in output.split("\n"):
+ if not line.startswith("?"):
+ empty = False
+ break
+
+ if empty == False:
+ error("Commit queue not empty! Please commit all outstanding changes before using %s." % __productname__)
+ sys.exit(1)
+
+def update_categories(portdir, catpkgs, cvsupcmd):
+
+ my_catpkgs = []
+
+ print
+ print "%s Updating categories: " % green(" *")
+
+ if len(catpkgs) >= 2:
+ if catpkgs[0].split("/", 1)[0] == catpkgs[1].split("/", 1)[0]:
+ my_catpkgs.append(catpkgs[0])
+ else:
+ my_catpkgs.append(catpkgs[0])
+ my_catpkgs.append(catpkgs[1])
+ else:
+ my_catpkgs.append(catpkgs[0])
+
+ for catpkg in my_catpkgs:
+ (category, package) = catpkg.split("/", 1)
+ if os.path.exists(os.path.join(portdir, category)):
+ os.chdir(os.path.join(portdir, category))
+ print " %s %s" % (green("*"), category)
+ do_cmd(cvsupcmd)
+ else:
+ print " %s %s" % (red("!"), category)
+
+ os.chdir(portdir)
+
+def error(msg):
+
+ sys.stderr.write("\n%s ERROR: %s\n" % (red("!!!"), msg))
+
+def signal_handler(signal_number=None, stack_frame=None):
+
+ error("Caught SIGINT; exiting...")
+ sys.exit(1)
+ os.kill(0, signal.SIGKILL)
+
+def do_cmd(cmd):
+
+ (status, output) = commands.getstatusoutput(cmd)
+ if status != 0:
+ error("Command '%s' failed with exit status %d." % (cmd, status))
+ for line in output.split("\n"):
+ if line != "":
+ print " %s %s" % (red("!"), line)
+ sys.exit(1)
+
+class CVSAbstraction:
+
+ def __init__(self, portdir, oldcatpkg, newcatpkg, cvscmd, options):
+
+ self._portdir = portdir
+ self._cvscmd = cvscmd
+ self._options = options
+ self._ignore = ("CVS")
+
+ self._old_category = ""
+ self._old_package = ""
+ self._new_category = ""
+ self._new_package = ""
+ self._old_catpkg = oldcatpkg
+ self._new_catpkg = newcatpkg
+
+ self._action = ""
+
+ self._distinguish_action(oldcatpkg, newcatpkg)
+
+ def _distinguish_action(self, oldcatpkg, newcatpkg):
+
+ (self._old_category, self._old_package) = oldcatpkg.split("/")
+ if newcatpkg:
+ (self._new_category, self._new_package) = newcatpkg.split("/")
+
+ if self._old_category != self._new_category and self._new_category:
+ if self._old_package != self._new_package and self._new_package:
+ self._action = "MOVE & RENAME"
+ else:
+ self._action = "MOVE"
+ elif self._old_package != self._new_package and self._new_package:
+ self._action = "RENAME"
+ elif not self._new_package:
+ self._action = "REMOVE"
+ else:
+ error("Unable to distingush required action.")
+ sys.exit(1)
+
+ def __backup(self):
+
+ print "%s Backing up %s..." % (green(" *"), turquoise(self._old_catpkg))
+
+ if not os.path.exists("/tmp/%s" % __productname__):
+ os.mkdir("/tmp/%s" % __productname__)
+
+ if os.path.exists("/tmp/%s/%s" % (__productname__, self._old_package)):
+ do_cmd("rm -rf /tmp/%s/%s" % (__productname__, self._old_package))
+
+ do_cmd("cp -R %s /tmp/%s/%s" % (os.path.join(self._portdir, self._old_catpkg), __productname__, self._old_package))
+
+ def perform_action(self):
+
+ count_down = 5
+
+ print
+ if self._action == "REMOVE":
+ print "%s Performing a '%s' of %s..." % (green(" *"), green(self._action), turquoise(self._old_catpkg))
+ else:
+ print "%s Performing a '%s' of %s to %s..." % (green(" *"), green(self._action), turquoise(self._old_catpkg), yellow(self._new_catpkg))
+
+ if not self._options.countdown:
+ print "%s Performing in: " % green(" *"),
+ count = range(count_down)
+ count.reverse()
+ for second in count:
+ sys.stdout.write("%s " % red(str(second + 1)))
+ sys.stdout.flush()
+ sleep(1)
+ print
+
+ if not self._action == "REMOVE":
+ self.__backup()
+
+ if self._action == "MOVE & RENAME":
+ self._perform_move_rename()
+ elif self._action == "MOVE":
+ self._perform_move()
+ elif self._action == "RENAME":
+ self._perform_rename()
+ elif self._action == "REMOVE":
+ self._perform_remove()
+
+ def _perform_remove(self):
+
+ deps = self.__get_reverse_deps()
+
+ if deps:
+ print "%s The following ebuild(s) depend on this package:" % red(" *")
+ for dep in deps:
+ print "%s %s" % (red(" !"), dep)
+ if self._options.force:
+ print "%s Are you sure you wish to force removal of this package?" % yellow(" *"),
+ try:
+ choice = raw_input("(Yes/No): ")
+ except KeyboardInterrupt:
+ error("Interrupted by user.")
+ sys.exit(1)
+ if choice.strip().lower() != "yes":
+ error("Bailing on forced removal.")
+ sys.exit(1)
+ else:
+ error("Refusing to remove from CVS, package has dependents.")
+ sys.exit(1)
+
+ self.__remove_old_package()
+
+ def _perform_move(self):
+
+ self.__add_new_package()
+ self.__regen_manifest()
+ self.__update_dependents(self.__get_reverse_deps())
+ self.__remove_old_package()
+
+ def _perform_move_rename(self):
+
+ self._perform_rename()
+
+ def _perform_rename(self):
+
+ self.__rename_files()
+ self.__add_new_package()
+ self.__regen_digests()
+ self.__update_dependents(self.__get_reverse_deps())
+ self.__remove_old_package()
+
+ def __rename_files(self):
+
+ def rename_files(arg, dir, files):
+
+ if os.path.basename(dir) not in self._ignore:
+ if os.path.basename(dir) != self._old_package:
+ for file in files:
+ new_file = ""
+ if file.find(self._old_package) >= 0:
+ new_file = file.replace(self._old_package, self._new_package)
+ do_cmd("mv %s %s" % (os.path.join(dir, file), os.path.join(dir, new_file)))
+ if not os.path.isdir(os.path.join(dir, new_file)) and not file.startswith("digest-"):
+ self.__rename_file_contents(os.path.join(dir, new_file))
+ else:
+ for file in files:
+ if file.endswith(".ebuild"):
+ new_file = file.replace(self._old_package, self._new_package)
+ do_cmd("mv %s %s" % (os.path.join(dir, file), os.path.join(dir, new_file)))
+ self.__rename_file_contents(os.path.join(dir, new_file))
+ elif file.endswith(".xml"):
+ self.__rename_file_contents(os.path.join(dir, file))
+
+ print "%s Renaming files..." % green(" *")
+ os.path.walk("/tmp/%s/%s" % (__productname__, self._old_package), rename_files , None)
+ do_cmd("mv /tmp/%s/%s /tmp/%s/%s" % (__productname__, self._old_package, __productname__, self._new_package))
+
+ def __regen_manifest(self, path=None, dep=False):
+
+ if dep:
+ print "%s Regenerating Manifest..." % green(" *")
+ else:
+ print "%s Regenerating Manifest..." % green(" *")
+ if path:
+ os.chdir(path)
+ else:
+ os.chdir(os.path.join(self._portdir, self._new_catpkg))
+ for ebuild in os.listdir("."):
+ if ebuild.endswith(".ebuild"):
+ do_cmd("/usr/lib/portage/bin/ebuild %s manifest" % ebuild)
+ break
+
+ self.__gpg_sign(dep)
+
+ def __regen_digests(self):
+
+ print "%s Regenerating digests:" % green(" *")
+ os.chdir(os.path.join(self._portdir, self._new_catpkg))
+ for digest in os.listdir("files/"):
+ if digest.startswith("digest-"):
+ os.unlink("files/%s" % digest)
+ for ebuild in os.listdir("."):
+ if ebuild.endswith(".ebuild"):
+ print " >>> %s" % ebuild
+ do_cmd("/usr/lib/portage/bin/ebuild %s digest" % ebuild)
+
+ self.__gpg_sign()
+
+ def __gpg_sign(self, dep=False):
+
+ gpg_cmd = ""
+
+ os.chdir(os.path.join(self._portdir, self._new_catpkg))
+
+ if "sign" in portage.features:
+ if dep:
+ print "%s GPG Signing Manifest..." % green(" *")
+ else:
+ print "%s GPG Signing Manifest..." % green(" *")
+ gpg_cmd = "gpg --quiet --sign --clearsign --yes --default-key %s" % portage.settings["PORTAGE_GPG_KEY"]
+ if portage.settings.has_key("PORTAGE_GPG_DIR"):
+ gpg_cmd = "%s --homedir %s" % (gpg_cmd, portage.settings["PORTAGE_GPG_DIR"])
+ do_cmd("%s Manifest" % gpg_cmd)
+ do_cmd("mv Manifest.asc Manifest")
+ do_cmd("%s 'Manifest recommit'" % self._cvscmd["commit"])
+
+ def __rename_file_contents(self, file):
+
+ def choice_loop(line, match_count, choice_list, type="name", replace=""):
+
+ new_line = line
+ accepted = False
+ skipp = False
+
+ while(not accepted):
+ print " ",
+ if len(choice_list) > 0:
+ for choice in choice_list:
+ print "%s: Replace with '%s'," % (white(choice), green(choice_list[choice])),
+ if match_count == 0:
+ print "%s: Pass, %s: Skip this file, %s: Custom" % (white(str(len(choice_list)+1)), white(str(len(choice_list)+2)), white(str(len(choice_list)+3))),
+ else:
+ print "%s: Pass, %s: Custom" % (white(str(len(choice_list)+1)), white(str(len(choice_list)+2))),
+ try:
+ input = raw_input("%s " % white(":"))
+ except KeyboardInterrupt:
+ print
+ error("Interrupted by user.")
+ sys.exit(1)
+ if choice_list.has_key(input):
+ if type == "name":
+ new_line = new_line.replace(self._old_package, choice_list[input])
+ accepted = True
+ elif type == "P":
+ new_line = new_line.replace("${P}", choice_list[input])
+ accepted = True
+ elif type == "PN":
+ new_line = new_line.replace("${PN}", choice_list[input])
+ accepted = True
+ elif type == "PV":
+ new_line = new_line.replace("${PV}", choice_list[input])
+ accepted = True
+ elif type == "PVR":
+ new_line = new_line.replace("${PVR}", choice_list[input])
+ accepted = True
+ elif type == "PR":
+ new_line = new_line.replace("${PR}", choice_list[input])
+ accepted = True
+ elif type == "PF":
+ new_line = new_line.replace("${PF}", choice_list[input])
+ accepted = True
+ elif input == str(len(choice_list)+1):
+ accepted = True
+ elif input == str(len(choice_list)+2) and match_count == 0:
+ accepted = True
+ skipp = True
+ elif input == str(len(choice_list)+3) and match_count == 0 or input == str(len(choice_list)+2) and match_count != 0:
+
+ input_accepted = False
+
+ while(not input_accepted):
+ try:
+ custom_input = raw_input(" %s Replacement string: " % green("*"))
+ except KeyboardInterrupt:
+ print
+ error("Interrupted by user.")
+ sys.exit(1)
+ while(1):
+ print " %s Replace '%s' with '%s'? (Y/N)" % (yellow("*"), white(replace), white(custom_input)),
+ try:
+ yes_no = raw_input(": ")
+ except KeyboardInterrupt:
+ print
+ error("Interrupted by user.")
+ sys.exit(1)
+ if yes_no.lower() == "y":
+ input_accepted = True
+ break
+ elif yes_no.lower() == "n":
+ break
+
+ new_line = new_line.replace(replace, custom_input)
+ accepted = True
+ else:
+ accepted = False
+
+ if skipp:
+ break
+
+ return (new_line, skipp)
+
+ found = False
+ contents = []
+ new_contents = []
+ match_count = 0
+ skipp = False
+
+ try:
+ readfd = open(file, "r")
+ contents = readfd.readlines()
+ readfd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+
+ for line in contents:
+ if line.find(self._old_package) >= 0:
+ found = True
+ break
+
+ if found == True:
+ print "%s Editing %s:" % (green(" *"), white(file.split("/tmp/%s/%s/" % (__productname__, self._old_package))[1]))
+ try:
+ writefd = open(file, "w")
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+ for line in contents:
+ tmp_line = line
+ if not line.startswith("# $Header:"):
+ if line.find(self._old_package) >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace(self._old_package, yellow(self._old_package)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": self._new_package,
+ "2": "${PN}"}, type="name", replace=self._old_package)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${P}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${P}", yellow("${P}")))
+ (pkg, version, revising) = portage.pkgsplit(os.path.split(file)[1][:-7])
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": "%s-%s" % (pkg, version),
+ "2": "%s-%s" % (self._old_package, version)}, type="P", replace="${P}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PN}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${PN}", yellow("${PN}")))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": self._new_package,
+ "2": self._old_package}, type="PN", replace="${PN}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PV}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${PV}", yellow("${PV}")))
+ (pkg, version, revision) = portage.pkgsplit(os.path.split(file)[1][:-7])
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": version}, type="PV", replace="${PV}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PVR}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${PVR}", yellow("${PVR}")))
+ (pkg, version, revision) = portage.pkgsplit(os.path.split(file)[1][:-7])
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": "%s-%s" % (version, revision)}, type="PVR", replace="${PVR}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PR}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${PR}", yellow("${PR}")))
+ (pkg, version, revision) = portage.pkgsplit(os.path.split(file)[1][:-7])
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": revision}, type="PR", replace="${PR}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PF}") >= 0:
+ print "%s %s" % (green(" !"), line.strip().replace("${PF}", yellow("${PF}")))
+ (pkg, version, revision) = portage.pkgsplit(os.path.split(file)[1][:-7])
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {"1": "%s-%s-%s" % (pkg, version, revision),
+ "2": "%s-%s-%s" % (self._old_package, version, revision)}, type="PF", replace="${PF}")
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${P/") >= 0:
+ start = line.find("${P/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PN/") >= 0:
+ start = line.find("${PN/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PV/") >= 0:
+ start = line.find("${PV/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PVR/") >= 0:
+ start = line.find("${PVR/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PR/") >= 0:
+ start = line.find("${PR/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+ if line.find("${PF/") >= 0:
+ start = line.find("${PF/")
+ i = 0
+ hi_str = ""
+ while(line[start + (i - 1)] != "}"):
+ hi_str += line[start + i]
+ i += 1
+ print "%s %s" % (green(" !"), line.strip().replace(hi_str, red(hi_str)))
+ (tmp_line, skipp) = choice_loop(tmp_line, match_count, {}, type=None, replace=hi_str)
+ match_count += 1
+ if skipp:
+ break
+
+ new_contents.append(tmp_line)
+
+ if not skipp:
+ for line in new_contents:
+ writefd.write(line)
+ else:
+ for line in contents:
+ writefd.write(line)
+
+ writefd.close()
+
+ def __update_dependents(self, dep_list):
+
+ if len(dep_list) <= 0:
+ return
+
+ print "%s Updating dependents:" % green(" *")
+ os.chdir(self._portdir)
+
+ for dep in dep_list:
+ print " >>> %s" % dep
+ new_contents = []
+ (category, pkg) = dep.split("/")
+ pkg_split = portage.pkgsplit(pkg)
+ os.chdir(self._portdir)
+ do_cmd("%s %s" % (self._cvscmd["update"], os.path.join(category, pkg_split[0])))
+
+ try:
+ readfd = open(os.path.join(self._portdir, category, pkg_split[0], "%s.ebuild" % pkg), "r")
+ contents = readfd.readlines()
+ readfd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+
+ for line in contents:
+ if self._old_catpkg in line:
+ new_contents.append(line.replace(self._old_catpkg, self._new_catpkg))
+ else:
+ new_contents.append(line)
+
+ try:
+ writefd = open(os.path.join(self._portdir, category, pkg_split[0], "%s.ebuild" % pkg), "w")
+ writefd.write("".join(new_contents))
+ writefd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+
+ os.chdir(os.path.join(self._portdir, category, pkg_split[0]))
+ do_cmd("echangelog 'Dependency update: %s -> %s.'" % (self._old_catpkg, self._new_catpkg))
+ do_cmd("%s 'Dependency update: %s -> %s.'" % (self._cvscmd["commit"], self._old_catpkg, self._new_catpkg))
+ self.__regen_manifest(path=os.path.join(self._portdir, category, pkg_split[0]), dep=True)
+
+ def __get_reverse_deps(self):
+
+ dep_list = []
+ conf_portdir = "/usr/portage"
+
+ def scan_for_dep(arg, dir, files):
+
+ (null, category) = os.path.split(dir)
+
+ for file in files:
+ if self._old_catpkg not in os.path.join(category, file):
+ if not os.path.isdir(os.path.join(dir, file)):
+ try:
+ fd = open(os.path.join(dir, file), "r")
+ contents = fd.readlines()
+ fd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+ if self._old_catpkg in contents[0] or self._old_catpkg in contents[1] or self._old_catpkg in contents[12]:
+ dep_list.append(os.path.join(category, file))
+
+ print "%s Resolving reverse dependencies..." % green(" *")
+
+ try:
+ fd = open("/etc/make.conf", "r")
+ contents = fd.readlines()
+ fd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+
+ for line in contents:
+ if line.startswith("PORTDIR="):
+ (null, conf_portdir) = line.strip("\"\n").split("=")
+ break
+
+ os.path.walk(os.path.join(conf_portdir, "metadata/cache"), scan_for_dep, None)
+
+ return dep_list
+
+ def __remove_old_package(self):
+
+ def remove_files(arg, dir, files):
+
+ if os.path.basename(dir) not in self._ignore:
+ for file in files:
+ if not os.path.isdir(os.path.join(dir, file)):
+ print " <<< %s" % (os.path.join(dir.strip("./"), file))
+ os.unlink(os.path.join(dir, file))
+ do_cmd("%s %s" % (self._cvscmd["remove"], os.path.join(dir, file)))
+
+ print "%s Removing %s from CVS:" % (green(" *"), turquoise(self._old_catpkg))
+ os.chdir(os.path.join(self._portdir, self._old_catpkg))
+ os.path.walk('.', remove_files , None)
+ os.chdir("..")
+
+ print "%s Commiting changes..." % green(" *")
+ if self._options.remove:
+ explanation = ""
+ while(1):
+ print "%s Please provide an explanation for this removal:" % yellow(" *"),
+ try:
+ explanation = raw_input("")
+ explanation = explanation.replace("'", "\\'").replace('"', '\\"')
+ except KeyboardInterrupt:
+ print
+ error("Interrupted by user.")
+ sys.exit(1)
+ if explanation != "":
+ break
+ do_cmd("""%s "Removed from %s: %s" """ % (self._cvscmd["commit"], self._old_category, explanation))
+ else:
+ do_cmd("%s 'Moved to %s.'" % (self._cvscmd["commit"], self._new_catpkg))
+ do_cmd("rm -rf %s" % os.path.join(self._portdir, self._old_catpkg))
+
+ print "%s Checking for remnant files..." % (green(" *"))
+ do_cmd(self._cvscmd["update"])
+
+ if not os.path.exists(os.path.join(self._portdir, self._old_catpkg)):
+ if not self._action == "REMOVE":
+ print "%s %s successfully removed from CVS." % (green(" *"), turquoise(self._old_catpkg))
+ else:
+ error("Remnants of %s still remain in CVS." % (turquoise(self._old_catpkg)))
+
+ def __add_new_package(self):
+
+ def add_files(arg, dir, files):
+
+ (null, null, null, dirs) = dir.split("/", 3)
+
+ if os.path.basename(dir) not in self._ignore:
+ os.chdir(os.path.join(self._portdir, self._new_category))
+ if os.path.basename(dir) != self._new_package:
+ print " >>> %s/" % dirs
+ os.mkdir(dirs)
+ do_cmd("%s %s" % (self._cvscmd["add"], dirs))
+ for file in files:
+ if not os.path.isdir(os.path.join(dir, file)):
+ print " >>> %s" % os.path.join(dirs, file)
+ do_cmd("cp %s %s" % (os.path.join(dir, file), dirs))
+ do_cmd("%s %s" % (self._cvscmd["add"], os.path.join(dirs, file)))
+
+ print "%s Adding %s to CVS:" % (green(" *"), turquoise(self._new_catpkg))
+ os.chdir(os.path.join(self._portdir, self._new_category))
+ print " >>> %s/" % self._new_package
+ os.mkdir(self._new_package)
+ do_cmd("%s %s" % (self._cvscmd["add"], self._new_package))
+ os.chdir(self._new_package)
+ os.path.walk("/tmp/%s/%s" % (__productname__, self._new_package), add_files , None)
+ os.chdir(os.path.join(self._portdir, self._new_catpkg))
+
+ print "%s Adding ChangeLog entry..." % green(" *")
+ do_cmd("echangelog 'Moved from %s to %s.'" % (self._old_catpkg, self._new_catpkg))
+
+ print "%s Commiting changes..." % green(" *")
+ do_cmd("%s 'Moved from %s to %s.'" % (self._cvscmd["commit"], self._old_catpkg, self._new_catpkg))
+
+ print "%s %s successfully added to CVS." % (green(" *"), turquoise(self._new_catpkg))
+
+ def log_move(self):
+
+ if not self._action == "REMOVE":
+
+ update_files = []
+ update_regex = "^[\d]Q-[\d]{4}$"
+
+ p_file_regex = re.compile(update_regex)
+
+ print "%s Logging move:" % (green(" *"))
+ os.chdir(os.path.join(self._portdir, "profiles/updates"))
+ do_cmd(self._cvscmd["update"])
+
+ for file in os.listdir("."):
+ o_file_regex = p_file_regex.match(file)
+ if file not in self._ignore and o_file_regex:
+ (q, y) = file.split("-")
+ update_files.append("%s-%s" % (y, q))
+
+ update_files.sort()
+ (y, q) = update_files[-1].split("-")
+ upfile = "%s-%s" % (q, y)
+ print " >>> %s" % upfile
+
+ try:
+ fd = open(upfile, "a")
+ fd.write("move %s %s\n" % (self._old_catpkg, self._new_catpkg))
+ fd.close()
+ except IOError, e:
+ error(e)
+ sys.exit(1)
+
+ do_cmd("%s 'Moved %s to %s'" % (self._cvscmd["commit"], self._old_catpkg, self._new_catpkg))
+ os.chdir(self._portdir)
+
+ def clean_up(self):
+
+ if not self._action == "REMOVE":
+ print "%s Removing back-up..." % (green(" *"))
+ do_cmd("rm -rf /tmp/%s/%s" % (__productname__, self._old_package))
+ if len(os.listdir("/tmp/%s" % __productname__)) == 0:
+ do_cmd("rmdir /tmp/%s" % __productname__)
+
+ os.chdir(self._portdir)
+
+if __name__ == "__main__":
+
+ signal.signal(signal.SIGINT, signal_handler)
+
+ cvscmd = {"remove": "cvs -Qf rm",
+ "commit": "cvs -Qf commit -m",
+ "update": "cvs -Qf up -dPC",
+ "add": "cvs -Qf add"}
+
+ parser = OptionParser(usage="%prog [ option ] [ origin ] [ destination ]", version="%s-%s" % (__productname__, __version__))
+ parser.add_option("--usage", action="store_true", dest="usage", default=False, help="Pint usage information")
+ parser.add_option("-q", "--queue-check", action="store_true", dest="commit_queue", default=False, help="Check the cvs tree for files awaiting commit")
+ parser.add_option("-u", "--no-cvs-up", action="store_true", dest="cvs_up", default=False, help="Skip running cvs up in the origin and destination categories")
+ parser.add_option("-c", "--no-countdown", action="store_true", dest="countdown", default=False, help="Skip countdown before performing")
+ parser.add_option("-R", "--remove", action="store_true", dest="remove", default=False, help="Remove package")
+ parser.add_option("-F", "--force", action="store_true", dest="force", default=False, help="Force removal of package, ignoring any reverse deps")
+ (options, args) = parser.parse_args()
+
+ if options.usage:
+ print_usage()
+ sys.exit(0)
+
+ if randint(1, 100) == 50:
+ print "%s I put on my robe and wizard hat..." % green(" *")
+
+ portdir = check_cwd(portage.settings["PORTDIR"].rstrip("/"))
+ check_repos(portdir)
+ (oldcatpkg, newcatpkg) = check_args(args, portdir, options, cvscmd)
+
+ if options.commit_queue:
+ check_commit_queue()
+
+ ThisPackage = CVSAbstraction(portdir, oldcatpkg, newcatpkg, cvscmd, options)
+
+ ThisPackage.perform_action()
+ ThisPackage.log_move()
+ ThisPackage.clean_up()
+
+ if options.remove:
+ print "%s %s successfully removed from CVS." % (green(" *"), turquoise(oldcatpkg))
+ else:
+ print "%s %s successfully moved to %s." % (green(" *"), turquoise(oldcatpkg), yellow(newcatpkg))
+
diff --git a/deprecated/etc-update/AUTHORS b/deprecated/etc-update/AUTHORS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/etc-update/AUTHORS
diff --git a/deprecated/etc-update/ChangeLog b/deprecated/etc-update/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/etc-update/ChangeLog
diff --git a/deprecated/etc-update/Makefile b/deprecated/etc-update/Makefile
new file mode 100644
index 0000000..95838ad
--- /dev/null
+++ b/deprecated/etc-update/Makefile
@@ -0,0 +1,20 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+all:
+ echo "PAPPLE (vb.) To do what babies do to soup with their spoons."
+
+dist:
+ mkdir -p ../../$(distdir)/src/etc-update
+ cp Makefile AUTHORS README TODO ChangeLog etc-update etc-update.1 ../../$(distdir)/src/etc-update/
+
+install:
+ install -m 0755 etc-update $(bindir)/
+ install -d $(docdir)/etc-update
+ install -m 0644 AUTHORS ChangeLog README $(docdir)/etc-update/
+ install -m 0644 etc-update.1 $(mandir)/
diff --git a/deprecated/etc-update/README b/deprecated/etc-update/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/etc-update/README
diff --git a/deprecated/etc-update/etc-update b/deprecated/etc-update/etc-update
new file mode 100755
index 0000000..f566dff
--- /dev/null
+++ b/deprecated/etc-update/etc-update
@@ -0,0 +1,165 @@
+#! /usr/bin/python
+#
+# $Header$
+#
+# Distributed under the terms of the GNU General Public License v2
+# Copyright (c) 2003 Karl Trygve Kalleberg
+#
+# Based on previous versions, by
+# - Brandon Low <lostlogic@gentoo.org>
+# - Jochem Kossen <j.kossen@home.nl>
+# - Leo Lipelis <aeoo@gentoo.org>
+
+from dialog import Dialog
+import portage
+import time
+import re
+import os
+
+__author__ = "Karl Trygve Kalleberg"
+__email__ = "karltk@gentoo.org"
+__version__ = "0.2.0"
+__productname__ = "etc-update"
+__description__ = "Interactive config file updater"
+
+globals = portage.settings.configdict["globals"]
+
+for i in globals["CONFIG_PROTECT"].split():
+ print i
+
+# list all files in all CONFIG_PROTECT dirs
+# list them in the gui
+# one-by-one:
+# - is update to header only?
+# - is the original unmodified from the previous package? (not checkable - duh!)
+# -
+
+class Config:
+ pass
+
+def loadConfig():
+ cfg = Config()
+ globals = portage.settings.configdict["globals"]
+ cfg.config_protect = globals["CONFIG_PROTECT"].split()
+ return cfg
+
+def _recurseFiles(path):
+ files = []
+ if os.path.exists(path):
+ try:
+ tmpfiles = os.listdir(path)
+ for i in tmpfiles:
+ fn = path + "/" + i
+ if os.path.isdir(fn):
+ files += _recurseFiles(fn)
+ elif os.path.isfile(fn):
+ m = re.search("\._cfg...._",fn)
+ if m:
+ files.append(fn)
+ else:
+ print "What is this anyway?:", fn
+ except OSError:
+ pass
+ # print "Access denied:", path
+
+ return files
+
+def findAllFiles(dlg, config):
+ files = []
+ gauge = dlg.gauge(0,
+ "Processing CONFIG_PROTECT directories...",
+ 7,
+ 60,
+ "Gauge",
+ sleep=3)
+ num_dirs = len(config.config_protect)
+ for i in xrange(num_dirs):
+ rem = repr(num_dirs - i / num_dirs)
+ gauge.update(rem, "Directories remaining: %s" % rem)
+ files += _recurseFiles(config.config_protect[i])
+ return files
+
+def prettifyFiles(files):
+ rx = re.compile("\._cfg...._")
+ def strip_cfg(x):
+ """Remove ._cfg????_ part """
+ m = rx.search(x)
+ if m:
+ s,e = m.span(0)
+ return x[:s] + x[e:]
+ return x
+ return map(strip_cfg, files)
+
+def updateFile(dlg, original):
+
+ # Find candidates
+
+ dir = os.path.dirname(original)
+ filename = os.path.basename(original)
+ rx = re.compile("\._cfg...._" + filename)
+ cand = filter(lambda x: rx.search(x), os.listdir(dir))
+
+ if len(cand) > 1:
+
+ # Add mtimes
+ for i in xrange(len(cand)):
+ stamp = time.localtime(os.path.getmtime(dir + "/" + cand[i]))
+ tstr = time.strftime("%a, %d %b %Y %H:%M:%S", stamp)
+ cand[i] = cand[i] + " - " + tstr
+
+
+ # Show selection
+ replacement = dlg.menu("Files that need updating",
+ Dialog.AUTO_SIZE,
+ list = cand,
+ showHelp = False,
+ title="Checklist")
+
+ else:
+ replacement = cand[0]
+
+
+ # Display diff
+
+ dlg.yesno("Would you like to update \n" + \
+ "[" + original + "]with\n[" + dir + "/" + replacement + "] ?")
+
+def displayFiles(dlg, config, files):
+
+ pretty_files = prettifyFiles(files)
+
+ while 1:
+ result = dlg.menu("Files that need updating",
+ Dialog.AUTO_SIZE,
+ list = pretty_files,
+ showHelp = False,
+ title="Checklist")
+ if result == None:
+ if dlg.ERR_CANCEL:
+ break
+
+ updateFile(dlg, result)
+
+ if len(pretty_files):
+ print "!!! Warning: There are still files that require updating."
+
+
+def main():
+ dlg = Dialog("etc-update")
+# dlg = None
+
+ config = loadConfig()
+ files = findAllFiles(dlg, config)
+ displayFiles(dlg, config,files)
+
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ print "Operation aborted!"
+
+# TODO:
+# - option for automatically update untouched files
+# - show coloured diff
+# - proper progress bar
diff --git a/deprecated/etc-update/etc-update.1 b/deprecated/etc-update/etc-update.1
new file mode 100644
index 0000000..53477d8
--- /dev/null
+++ b/deprecated/etc-update/etc-update.1
@@ -0,0 +1,12 @@
+.TH etc-update "1" "Nov 2003" "gentoolkit"
+.SH NAME
+etc-update \- Gentoo: Configuration Update Utility
+.SH SYNOPSIS
+.B etc-update
+.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>.
+
diff --git a/deprecated/etcat/AUTHORS b/deprecated/etcat/AUTHORS
new file mode 100644
index 0000000..5da0b07
--- /dev/null
+++ b/deprecated/etcat/AUTHORS
@@ -0,0 +1,5 @@
+Maintainer:
+Karl Trygve Kalleberg <karltk@gentoo.org>
+
+Authors:
+Alastair Tse <liquidx@gentoo.org> (original author)
diff --git a/deprecated/etcat/ChangeLog b/deprecated/etcat/ChangeLog
new file mode 100644
index 0000000..bdadcb6
--- /dev/null
+++ b/deprecated/etcat/ChangeLog
@@ -0,0 +1,36 @@
+2004-04-20 Marius Mauch <genone@gentoo.org>
+ - fixing -u behavior so it matches equery (bug #47690)
+
+2004-03-13 Marius Mauch <genone@gentoo.org>
+ - grouping version in --version output
+
+2004-01-23 Marius Mauch <genone@gentoo.org>
+ - now catches exceptions thrown by portage
+ - minor bugfixes
+
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added man page from app-portage/gentoolkit
+ * Added Makefile
+ * Added sys.path workaround for Portage >=2.0.50
+
+* etcat-0.2.0 (06 May 2003)
+ 06 May 2003; Alastair Tse <liquidx@gentoo.org>
+ Trying to add a dependency graph feature. kind of works with
+ some weird hacks parsing the depenency string. probably needs
+ to use functions in portage to parse it properly.
+
+* etcat-0.1.4 (27 Apr 2003)
+
+ 27 Apr 2003; Alastair Tse <liquidx@gentoo.org>
+ Added "files", "belongs", "depends" functions.
+
+*etcat-0.1.3 (24 Apr 2003)
+
+ 24 Apr 2003; Alastair Tse <liquidx@gentoo.org>
+ Fixed bug if ebuild doesn't exist. Added manpage.
+
+*etcat-0.1.2 (29 Mar 2003)
+
+ 29 Mar 2003; Alastair Tse <liquidx@gentoo.org>
+ Initial commit to gentoolkit. Check source for previous changes
+
diff --git a/deprecated/etcat/Makefile b/deprecated/etcat/Makefile
new file mode 100644
index 0000000..2281646
--- /dev/null
+++ b/deprecated/etcat/Makefile
@@ -0,0 +1,18 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# 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/etcat
+ cp Makefile AUTHORS README TODO ChangeLog etcat etcat.1 ../../$(distdir)/src/etcat
+
+install:
+ install -d $(docdir)/deprecated/etcat
+ install -m 0755 etcat $(docdir)/deprecated/etcat/
+ install -m 0644 etcat.1 README AUTHORS $(docdir)/deprecated/etcat/
diff --git a/deprecated/etcat/README b/deprecated/etcat/README
new file mode 100644
index 0000000..50bd2f3
--- /dev/null
+++ b/deprecated/etcat/README
@@ -0,0 +1,2 @@
+For more information, this tool was originally hosted on:
+http://www.liquidx.net/projects/etcat/
diff --git a/deprecated/etcat/TODO b/deprecated/etcat/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/etcat/TODO
diff --git a/deprecated/etcat/etcat b/deprecated/etcat/etcat
new file mode 100755
index 0000000..5137683
--- /dev/null
+++ b/deprecated/etcat/etcat
@@ -0,0 +1,688 @@
+#!/usr/bin/env python2
+#
+# -*- mode: python; -*-
+#
+# --| Version Information |------------------------------------------
+#
+# etcat v0.1.4 (27 Apr 2003)
+#
+# $Header$
+#
+# --| About |--------------------------------------------------------
+#
+# etcat is a Portage/Ebuild Information Extractor. Basically, it
+# provides higher level convienence functions to the Portage system
+# used by Gentoo Linux.
+#
+# You can use it to quickly find out the recent changes of your
+# favourite package, the size of installed packages, the
+# available versions for a package and more.
+#
+# --| License |------------------------------------------------------
+#
+# Distributed under the terms of the GNU General Public License v2
+# Copyright (c) 2002 Alastair Tse.
+#
+# --| Usage |--------------------------------------------------------
+#
+# etcat [options] <command> <package[-ver]|ebuild|category/package[-ver]>
+#
+# -b/belongs ) checks what package(s) a file belongs to
+# -c/changes ) list the more recent changelog entry
+# -d/depends ) list all those that have this in their depends
+# -f/files ) list all files that belong to this package
+# -g/graph ) graph dependencies
+# -s/size ) guesses the size of a installed packaged.
+# -u/uses ) list all the use variables used in this package/ebuild
+# -v/versions ) list all the versions available for a package
+#
+# --| TODO |---------------------------------------------------------
+#
+# - in ver_cmp: 1.2.10a < 1.2.10, need to fix that
+#
+# --| Changes |------------------------------------------------------
+#
+# * etcat-0.3.1 (10 Oct 2004) [karltk]
+# - Fixed changes help examples
+# * etcat-0.3.1 (08 Jan 2004) [genone]
+# - adding missing python searchpath modification
+# - fixing sort order
+# * etcat-0.3.0 (12 Jul 2003) [karltk]
+# - Refactored interesting stuff into the Gentoolkit module
+# * etcat-0.2.0 (13 Jun 2003)
+# - Updated "versions" with PORTAGE_OVERLAY detection
+# - Added "graph" feature
+# * etcat-0.1.5 (30 Apr 2003)
+# - Fixed disappearing short opts. Oops.
+# * etcat-0.1.4 (27 Apr 2003)
+# - Cleaned up command execution code to provide a single place
+# to specify functions
+# - Added own custom wrapping print code.
+# - Added "files" feature
+# - Added "depends" feature
+# * etcat-0.1.3 (24 Apr 2003)
+# - Overhaul of commandline interpreter
+# - Added "belongs" feature
+# - Reimplemented "uses" to deal with IUSE more cleanly
+# and sources use.local.desc
+# - Natural Order Listings for version
+# * etcat-0.1.2 (29 Mar 2003)
+# - Added unstable indicator to complement masked
+# - improved use flag listing
+# * etcat-0.1.1 (21 Jan 2003)
+# - Add package to versions listing even if it's not in
+# the portage anymore (21 Jan 2003)
+# - Fixed old ehack references (17 Jan 2003)
+# * etcat-0.1 (31 Oct 2002)
+# Initial Release;
+#
+# -------------------------------------------------------------------
+
+
+
+import os
+import sys
+import re
+import pprint
+import getopt
+import glob
+
+# portage and gentoolkit need special path modifications
+sys.path.insert(0, "/usr/lib/portage/pym")
+sys.path.insert(0, "/usr/lib/gentoolkit/pym")
+
+import gentoolkit
+from stat import *
+try:
+ from portage.output import *
+except ImportError:
+ from output import *
+
+__author__ = "Alastair Tse"
+__email__ = "liquidx@gentoo.org"
+__version__ = "0.3.1"
+__productname__ = "etcat"
+__description__ = "Portage Information Extractor"
+
+# .-------------------------------------------------------.
+# | Initialise Colour Settings |
+# `-------------------------------------------------------'
+if (not sys.stdout.isatty()) or (gentoolkit.settings["NOCOLOR"] in ["yes","true"]):
+ nocolor()
+
+# "option": ("shortcommand","desc",["example one", "example two"])
+options = {
+"belongs": \
+("b","Searches for a package that owns a specified file with an option to restrict the search space.",
+["etcat belongs /usr/bin/gimp media-gfx",
+ "etcat belongs /usr/lib/libjpeg.so media-*",
+ "etcat belongs /usr/lib/libmpeg.so"]),
+"changes": \
+("c","Outputs the changelog entry to screen. It is possible to give a version number along with the package name.",
+["etcat changes mozilla",
+ "etcat changes =mozilla-1.1-r1",
+ "etcat changes gkrellm$"]),
+"depends": \
+("d","Finds all packages that are directly dependent to a regex search string.",
+["etcat depends 'gnome-base/libgnome'",
+ "etcat depends '>=dev-lang/python-2.2'"]),
+"files": \
+("f","Lists files that belongs to a package and optionally with version.",[]),
+"graph": \
+("g","Graphs Dependencies (NON WORKING)",[]),
+"size": \
+("s","Lists the installed size of a package.",[]),
+"uses": \
+("u", "Advanced output of USE vars in a package. Tells you flags used by a package at time of installation, flags in current config and flag description.",[]),
+"versions": \
+("v","Displays the versions available for a specific package. Colour coded to indicate installation status and displays slot information.",
+[turquoise("(I)") + "nstalled",
+ yellow("(~)") + "Unstable Testing Branch",
+ red("(M)") + "asked Package"])
+}
+
+# .-------------------------------------------------------.
+# | Small Wrapping Printer with Indent Support |
+# `-------------------------------------------------------'
+
+def wrap_print(string, indent=0, width=74):
+ line_len = width - indent
+ str_len = len(string)
+ lines = []
+
+ pos = 0
+ thisline = ""
+ while pos < str_len:
+ # if we still have space stuff the
+ # character in this line
+ if len(thisline) < line_len-1:
+ thisline += string[pos]
+ pos += 1
+ # if we're at the end of the line,
+ # check if we should hyphenate or
+ # append
+ elif len(thisline) == line_len -1:
+ # end of a text
+ if pos == str_len -1:
+ thisline += string[pos]
+ pos += 1
+ # end of a word
+ elif string[pos] != " " and string[pos+1] == " ":
+ thisline += string[pos]
+ pos += 1
+ # just a space
+ elif string[pos] == " ":
+ thisline += string[pos]
+ pos += 1
+ # start of a word, we start the word on the next line
+ elif pos>0 and string[pos-1] == " ":
+ thisline += " "
+ # needs hyphenating
+ else:
+ thisline += "-"
+
+ # append the line
+ lines.append(thisline)
+ thisline = ""
+
+ # append last line
+ if thisline:
+ lines.append(thisline)
+
+ for line in lines:
+ print " "*indent + line
+
+# +-------------------------------------------------------+
+# | Pretty Print Log |
+# +-------------------------------------------------------+
+# | Extracts and prints out the log entry corresponding |
+# | to a certain revision if given. If not supplied, |
+# | prints out the latest/topmost entry |
+# `-------------------------------------------------------'
+
+# output the latest entry in changelog
+def output_log(lines, package_ver=""):
+ # using simple rules that all changelog entries have a "*"
+ # as the first char
+ is_log = 0
+ is_printed = 0
+
+ for line in lines:
+ if package_ver:
+ start_entry = re.search("^[\s]*\*[\s]*(" + package_ver + ")[\s]+.*(\(.*\))",line)
+ else:
+ start_entry = re.search("^[\s]*\*[\s]*(.*)[\s]+.*(\(.*\))",line)
+ if not is_log and start_entry:
+ is_printed = 1
+ is_log = 1
+ print green("*") + " " + white(start_entry.group(1)) + " " + turquoise(start_entry.group(2)) + " :"
+ elif is_log and re.search("^[\s]*\*[\s]*(.*)[\s]+.*(\(.*\))",line):
+ break
+ elif is_log:
+ print line.rstrip()
+ else:
+ pass
+
+ return is_printed
+
+# .-------------------------------------------------------.
+# | Changes Function |
+# +-------------------------------------------------------+
+# | Print out the ChangeLog entry for package[-version] |
+# `-------------------------------------------------------'
+
+def changes(query, matches):
+ if not report_matches(query,matches,installed_only=0):
+ return
+
+ for pkg in matches:
+ changelog_file = pkg.get_package_path() + "/ChangeLog"
+ if os.path.exists(changelog_file):
+ output_log(open(changelog_file).readlines(), pkg.get_name()+"-"+pkg.get_version())
+ else:
+ print red("Error") + ": No Changelog for " + pkg.get_cpv()
+
+
+# .-------------------------------------------------------.
+# | Versions Function |
+# +-------------------------------------------------------+
+# | Prints out the available version, masked status and |
+# | installed status. |
+# `-------------------------------------------------------'
+
+def versions(query, matches):
+ # this function should also report masked packages
+ matches = gentoolkit.find_packages(query, masked=True)
+ if not report_matches(query,matches):
+ return
+
+ # sorting result list
+ matches = gentoolkit.sort_package_list(matches)
+
+ # FIXME: old version printed result of regex search on name,
+ # so "ant" would return app-emacs/semantic, etc...
+
+ last_cp = ""
+
+ for pkg in matches:
+ new_cp = pkg.get_category()+"/"+pkg.get_name()
+ if last_cp != new_cp:
+ print green("*") + " " + white(new_cp) + " :"
+ last_cp = new_cp
+
+ state = []
+ color = green
+ unstable = 0
+ overlay = ""
+
+ # check if masked
+ if pkg.is_masked():
+ state.append(red("M"))
+ color = red
+ else:
+ state.append(" ")
+
+ # check if in unstable
+ kwd = pkg.get_env_var("KEYWORDS")
+ if "~" + gentoolkit.settings["ARCH"] in kwd.split():
+ state.append(yellow("~"))
+ if color != red:
+ color = yellow
+ unstable = 1
+ else:
+ state.append(" ")
+
+ # check if installed
+ if pkg.is_installed():
+ state.append(turquoise("I"))
+ color = turquoise
+ else:
+ state.append(" ")
+
+ # check if this is a OVERLAY ebuilds
+ if pkg.is_overlay():
+ overlay = " OVERLAY"
+
+ ver = pkg.get_version()
+ slot = pkg.get_env_var("SLOT")
+ print " "*8 + "[" + "".join(state) + "] " + color(ver) + " (" + color(slot) + ")" + overlay
+
+# .-------------------------------------------------------.
+# | List USE flags for a single ebuild, if it's installed |
+# +-------------------------------------------------------+
+# | Just uses the new IUSE parameter in ebuilds |
+# `-------------------------------------------------------'
+def uses(query, matches):
+ 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:
+ pass
+
+ # 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:
+ pass
+
+ print "[ Colour Code : " + green("set") + " " + red("unset") + " ]"
+ print "[ Legend : (U) Col 1 - Current USE flags ]"
+ print "[ : (I) Col 2 - Installed With USE flags ]"
+
+ if filter(gentoolkit.Package.is_installed, matches):
+ only_installed = True
+ else:
+ only_installed = False
+
+ # Iterate through matches, printing a report for each package
+ for p in matches:
+ if not p.is_installed() and only_installed:
+ continue
+
+ bestver = p.get_cpv()
+ iuse = p.get_env_var("IUSE")
+
+ if iuse: usevar = iuse.split()
+ else: usevar = []
+
+ inuse = []
+ used = p.get_use_flags().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.get_category()+"/"+p.get_name()][u]
+ except KeyError:
+ desc = ""
+
+ if u in p.get_settings("USE"): 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()), "]"
+
+ return
+
+# .-------------------------------------------------------.
+# | Graphs the Dependency Tree for a package |
+# +-------------------------------------------------------+
+# | Naive graphing of dependencies
+# `-------------------------------------------------------'
+
+def graph(query, matches):
+ if not report_matches(query, matches):
+ return
+
+ for pkg in matches:
+ if not pkg.is_installed():
+ continue
+ rgraph(pkg)
+
+def rgraph(pkg,level=0,pkgtbl=[],suffix=""):
+
+ cpv=pkg.get_cpv()
+
+ print level*" " + "`-- " + 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]):
+ suffix+=" [ " + "".join(x[1]) + " ]"
+ pkgtbl=rgraph(pkg,level+1,pkgtbl,suffix)
+ return pkgtbl
+
+# .-------------------------------------------------------.
+# | Required By Function |
+# +-------------------------------------------------------+
+# | Find what packages require a given package name |
+# `-------------------------------------------------------'
+
+def depends(query, matches):
+
+ print "[ Results for search key : " + white(query) + " ]"
+
+ isdepend = gentoolkit.split_package_name(query)
+
+ for pkg in matches:
+ if pkg.is_installed():
+ deps = pkg.get_runtime_deps()
+ for x in deps:
+ cpvs=gentoolkit.split_package_name(x[2])
+ cat_match=0
+ ver_match=0
+ name_match=0
+ if not isdepend[0] or isdepend[0] == cpvs[0]:
+ cat_match=1
+ if not isdepend[2] or \
+ (isdepend[2] == cpvs[2] and isdepend[3] == cpvs[3]):
+ ver_match=1
+ if isdepend[1] == cpvs[1]:
+ name_match=1
+ if cat_match and ver_match and name_match:
+ print turquoise("*"), white(pkg.get_cpv()), white("[ ") + "".join(x[1]), white("]")
+
+# .-------------------------------------------------------.
+# | Belongs to which package |
+# +-------------------------------------------------------+
+# | Finds what package a file belongs to |
+# `-------------------------------------------------------'
+
+def belongs(query,matches):
+
+ q = query.split()
+
+ if len(q) > 1:
+ item=q[0]
+ cat=q[1]
+ fn=lambda x: x.find(cat)==0
+ else:
+ item=q[0]
+ cat="*"
+ fn=None
+ matches = gentoolkit.find_all_installed_packages(fn)
+
+ print "Searching for " + item + " in " + cat + " ..."
+
+ rx = re.compile(item)
+
+ for pkg in matches:
+ if pkg.get_contents():
+ for fn in pkg.get_contents().keys():
+ if rx.search(fn):
+ print pkg.get_cpv()
+ break # We know this pkg matches, look for any more matches
+ return
+
+# .-------------------------------------------------------.
+# | Size of all packages matching query |
+# +-------------------------------------------------------+
+# | Finds the size of installed packages |
+# `-------------------------------------------------------'
+def size(query,packages):
+ packages = gentoolkit.find_packages(query)
+ if not report_matches(query, packages):
+ return
+
+ for pkg in packages:
+ if not pkg.is_installed():
+ continue
+ x=pkg.size()
+ size=x[0]
+ files=x[1]
+ uncounted=x[2]
+ print turquoise("*") + " " + white(pkg.get_cpv())
+ print " Total Files : ".rjust(25) + str(files)
+ if uncounted:
+ print " Inaccessible Files : ".rjust(25) + str(uncounted)
+ print " Total Size : ".rjust(25) + "%.2f KB" % (size/1024.0)
+
+
+def report_matches(query, matches, installed_only=1):
+ print "[ Results for search key : " + white(query) + " ]"
+ print "[ Candidate applications found : " + white(str(len(matches))) + " ]"
+ print
+
+ if installed_only and matches:
+ print " Only printing found installed programs."
+ print
+ elif installed_only:
+ print "No packages found."
+
+ if matches:
+ return 1
+ else:
+ return 0
+
+
+# .-------------------------------------------------------.
+# | Files in a package |
+# +-------------------------------------------------------+
+# | Lists all the files in a package |
+# `-------------------------------------------------------'
+def files(query,matches):
+ if not report_matches(query, matches):
+ return
+
+ for package in matches:
+ if not package.is_installed():
+ continue
+ contents = package.get_contents()
+
+ print yellow(" * ") + white(package.get_cpv())
+ for x in contents.keys():
+ t = contents[x][0]
+ if t == "obj":
+ print x
+ elif t == "sym":
+ print turquoise(x)
+ elif t == "dir":
+ print blue(x)
+ else:
+ print x
+
+# .-------------------------------------------------------.
+# | Help Function |
+# `-------------------------------------------------------'
+def ver():
+ print __productname__ + " (" + __version__ + ") - " + __description__ + " - By: " + __author__
+
+def help():
+ screenwidth = 74
+ margin = 2
+ margin_desc = 4
+ margin_ex = 8
+
+ ver()
+ print yellow("NOTICE: ") + "This tool will be phased out at some point in"
+ print " the future, please use equery instead."
+ print " Bugs are still fixed, but new features won't be added."
+ print
+ print white("Usage: ") + turquoise(__productname__) + " [ " + green("options") + " ] [ " + turquoise("action") + " ] [ " + turquoise("package") + " ]"
+ print
+ print turquoise("Actions:")
+ print
+ for name,tup in options.items():
+ print " "*margin + green(name) + " (" + green("-" + tup[0]) + " short option)"
+ wrap_print(tup[1],indent=margin_desc)
+ for example in tup[2]:
+ print " "*margin_ex + example
+ print
+
+# .-------------------------------------------------------.
+# | Main Function |
+# `-------------------------------------------------------'
+def main():
+
+ action = ''
+ query = ''
+
+ if len(sys.argv) < 3:
+ help()
+ sys.exit(1)
+
+ # delegates the commandline stuff to functions
+ pointer = 2
+ # short/long opts mapping
+ shortopts = ["-"+x[0] for x in options.values()]
+ short2long = {}
+ for k,v in options.items():
+ short2long[v[0]] = k
+ longopts = options.keys()
+ # loop thru arguments
+ for arg in sys.argv[1:]:
+ if arg[0] == "-" and len(arg) == 2 and arg in shortopts:
+ action = short2long[arg[1]]
+ query = ' '.join(sys.argv[pointer:])
+ break
+ elif arg in longopts:
+ action = arg
+ query = ' '.join(sys.argv[pointer:])
+ break
+ else:
+ pointer += 1
+
+ # abort if we don't have an action or query string
+ if not query or action not in options.keys():
+ help()
+ sys.exit(1)
+ else:
+ try:
+ matches = gentoolkit.find_packages(query)
+ except KeyError, e:
+ if e[0].find("Specific key requires operator") == 0:
+ print red("!!!"), "Invalid syntax: missing operator"
+ print red("!!!"), "If you want only specific versions please use one of"
+ print red("!!!"), "the following operators as prefix for the package name:"
+ print red("!!!"), " > >= = <= <"
+ print red("!!!"), "Example to only match gcc versions greater or equal 3.2:"
+ print red("!!!"), " >=sys-devel/gcc-3.2"
+ else:
+ print red("!!!"), "Internal portage error, terminating"
+ if len(e[0]):
+ print red("!!!"), e
+ sys.exit(2)
+ except ValueError, e:
+ if isinstance(e[0],list):
+ print red("!!!"), "Ambiguous package name \"%s\"" % query
+ print red("!!!"), "Please use one of the following long names:"
+ for p in e[0]:
+ print red("!!!"), " "+p
+ else:
+ print red("!!!"), "Internal portage error, terminating"
+ if len(e[0]):
+ print red("!!!"), e[0]
+ sys.exit(2)
+ function = globals()[action]
+ function(query, matches)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ print "Operation Aborted!"
+
+
diff --git a/deprecated/etcat/etcat.1 b/deprecated/etcat/etcat.1
new file mode 100644
index 0000000..6704f3b
--- /dev/null
+++ b/deprecated/etcat/etcat.1
@@ -0,0 +1,79 @@
+.TH "etcat" "1" "0.1.4" "Alastair Tse <liquidx@gentoo.org>" "Gentoo Administration"
+.SH "NAME"
+.LP
+etcat \- Gentoo: Portage Information Extractor
+.SH "SYNTAX"
+.LP
+etcat [\fIoption\fP|command] <\fIquery|package\fP>
+
+.SH "DESCRIPTION"
+.LP
+etcat tries to complement the existing portage related tools but geared specifically for the power user. It enables users and developers to quickly find out information on particular packages without resorting to manually poking the portage tree and portage database.
+
+.LP
+More specifically, it lists the versions available highlighted by their status (stable/testing/masked/install) for a package, lists use flags per package with descriptions, calculates the installed size of a package and also outputs the relevent entries in the changelog related to the package version.
+
+.LP
+It also employes a smarter package query syntax than emerge where examples such as:
+.LP .IP
+mozilla\-1.1
+.br
+mozilla\-1.*
+.LP
+are accepted.
+
+.SH "OPTIONS"
+.LP
+\fB\-b\fR <\fI/path/to/file\fR> [\fIcategory\fR]
+.br
+\fBbelongs\fR <\fI/path/to/file\fR> [\fIcategory\fR]
+.IP
+Searches for the package which a file belongs to with an option to restrict a search to a single or multiple category. Wildcards in the category name is accepted to speed up searching. (eg. etcat belongs /usr/lib/libmpeg.so "media\-*")
+
+.LP
+\fB\-c\fR <\fIpackage[\-version]\fR>
+.br
+\fBchanges\fR <\fIpackage[\-version]\fR>
+.IP
+Outputs ChangeLog entry for the package and version specified. Uses the latest package version if none specified.
+
+.LP
+\fB\-d\fR <\fIregex expression\fR>
+.br
+\fBdepends\fR <\fIregex expression\fR>
+.IP
+Searches through portage for a dependency string satisfying that regular expression.
+
+.LP
+\fB\-f\fR <\fIpackage[\-version]\fR>
+.br
+\fBfiles\fR <\fIpackage[\-version]\fR>
+.IP
+Lists all the files installed for this package.
+
+.LP
+\fB\-s\fR <\fIpackage\fR>
+.br
+\fBsize\fR <\fIpackage\fR>
+.IP
+Outputs the installed size of the package.
+
+.LP
+\fB\-u\fR <\fIpackage[\-version]\fR>
+.br
+\fBuses\fR <\fIpackage[\-version]\fR>
+.IP
+Outputs the USE flags supported by this package and also their installed state and description.
+
+.LP
+\fB\-v\fR <\fIpackage\fR>
+.br
+\fBversions\fR <\fIpackage\fR>
+.IP
+Output all the versions for packages that match the \fIpackage\fR name given with indication of whether the packages is stable, masked, unstable or installed.
+.SH "SEE ALSO"
+.LP
+Type \fBetcat\fR for examples and more information
+.SH "AUTHORS"
+.LP
+Alastair Tse <liquidx@gentoo.org>
diff --git a/deprecated/genpkgindex/Makefile b/deprecated/genpkgindex/Makefile
new file mode 100644
index 0000000..9f0ea2c
--- /dev/null
+++ b/deprecated/genpkgindex/Makefile
@@ -0,0 +1,18 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+all:
+ echo "ABWONG (AB-wong vb.) To bounce cheerfully on a bed."
+
+dist:
+ mkdir -p ../../$(distdir)/src/genpkgindex
+ cp Makefile genpkgindex genpkgindex.1 ../../$(distdir)/src/genpkgindex/
+
+install:
+ install -m 0755 genpkgindex $(bindir)/
+ install -m 0644 genpkgindex.1 $(mandir)/
diff --git a/deprecated/genpkgindex/genpkgindex b/deprecated/genpkgindex/genpkgindex
new file mode 100644
index 0000000..c079b83
--- /dev/null
+++ b/deprecated/genpkgindex/genpkgindex
@@ -0,0 +1,336 @@
+#!/usr/bin/python
+# Copyright 2006-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+
+import os
+import stat
+import sys
+import time
+import getopt
+from stat import *
+
+if getattr(__builtins__, "set", None) is None:
+ from sets import Set as set
+
+for x in ['CFLAGS','CXXFLAGS', 'LDFLAGS','USE']:
+ os.environ[x] = ''
+del x
+
+os.environ["USE_EXPAND"] = "-*"
+
+import portage
+
+try:
+ import portage.xpak as xpak
+ import portage.checksum as portage_checksum
+ import portage.dep as portage_dep
+ import portage.util as portage_util
+ import portage.const as portage_const
+except ImportError:
+ import xpak
+ import portage_checksum
+ import portage_dep
+ import portage_util
+ import portage_const
+
+compress = bool(os.environ.get("COMPRESSPKGFILE", ''))
+pkgdir = portage.settings["PKGDIR"]
+opt_args_short="hqvcP:"
+opt_args_long=["help", "quiet", "verbose", "compress", "pkgdir"]
+quiet = False
+verbose = False
+
+def usage():
+ print portage.output.green("Usage:")+"\t"+portage.output.yellow("genpkgindex")+" -"+portage.output.blue("["+opt_args_short+"]")
+ print portage.output.white(" Options:")+" --"+" --".join(opt_args_long)
+ sys.exit(1)
+
+def update_pkgdir():
+ if not os.path.exists(portage.settings["PKGDIR"]+"/All"):
+ return
+
+ os.chdir(portage.settings["PKGDIR"]+"/All")
+ for x in os.listdir("."):
+ pkg = os.path.basename(x)
+ if pkg[-5:] != ".tbz2":
+ continue
+
+ mode = os.lstat(pkg)[ST_MODE]
+ if not S_ISREG(mode):
+ if S_ISLNK(mode):
+ if not os.path.exists(os.readlink(x)):
+ if verbose:
+ portage.writemsg(portage.output.yellow(" * ")+"Removing broken symlink: "+x+"\n")
+ os.unlink(x)
+ continue
+ tbz2 = xpak.tbz2(pkg)
+ data = tbz2.getboth()
+ cat = xpak.getitem(data, "CATEGORY")
+ cat = cat[:-1]
+ if not os.path.exists("../"+cat):
+ os.mkdir("../"+cat)
+ if os.path.exists("../"+ cat + "/" + pkg):
+ os.unlink("../"+ cat + "/" + pkg)
+ os.rename(pkg, "../"+ cat + "/" + pkg)
+ os.symlink("../"+ cat + "/"+ pkg, pkg)
+
+def grabpkgnames(dirp):
+ names = []
+ categories = portage.grabfile(portage.settings["PORTDIR"]+"/profiles/categories")
+ os.chdir(dirp)
+ for cat in os.listdir('.'):
+ if cat in categories:
+ for pkg in os.listdir(cat):
+ if os.path.basename(pkg).endswith("tbz2"):
+ names.append(cat+"/"+pkg)
+ names.sort()
+ return names
+
+def cleanxfiles(dirp):
+ global verbose
+ # Clean up stale cache files
+ os.chdir(portage_const.CACHE_PATH+"/xpak")
+ for pkg in os.listdir('.'):
+ p = os.path.basename(pkg)
+ if not p.endswith(".xpak"):
+ continue
+ tbz2 = xpak.tbz2(p)
+ stuff = tbz2.getboth()
+ cat = xpak.getitem(stuff, "CATEGORY")
+ if not os.path.exists(dirp + "/" + cat[:-1] + "/" + p[:-5] + ".tbz2"):
+ # tidy up
+ if verbose:
+ portage.writemsg(portage.output.yellow(" * ") + "Stale entry: " + dirp + "/" + cat[:-1] + "/" + p[:-5] + ".tbz2\n")
+ os.unlink(p)
+ os.unlink(p[:-5]+".md5")
+
+def cleanpkgdir():
+ if os.path.exists("/usr/bin/eclean"):
+ os.system("/usr/bin/eclean -d packages")
+
+
+def parseargs():
+ global pkgdir
+ global compress
+ global verbose
+ global quiet
+
+ if portage.settings.get("NOCOLOR") not in ("yes","true"):
+ portage.output.havecolor = 1
+ else:
+ portage.output.havecolor = 0
+
+ # Parse the cmdline.
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], opt_args_short, opt_args_long)
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
+
+ for opt, optarg in opts:
+ if opt in ("-v", "verbose"):
+ verbose = True
+ if opt in ("-h", "--help"):
+ usage()
+ if opt in ("-c", "--compress"):
+ compress = True
+ if opt in ("-q", "--quiet"):
+ quiet = True
+ if opt in ("-P", "--pkgdir"):
+ pkgdir = optarg
+
+ if "cleanpkgdir" in portage.settings["FEATURES"]:
+ cleanpkgdir()
+
+def serialize_depset(src, context='and'):
+ l = []
+ if not src:
+ return ''
+ if isinstance(src, basestring):
+ return src
+ i = iter(src)
+ for x in i:
+ if isinstance(x, basestring):
+ if x != '||':
+ l.append(x)
+ continue
+ x = i.next()
+ if len(x) == 1:
+ l.append(serialize_depset(x[0]))
+ else:
+ l.append("|| ( %s )" % serialize_depset(x))
+ else:
+ # and block.
+ if context == 'and':
+ v = serialize_depset(x, context=context)
+ if v.strip():
+ l.append(v)
+ else:
+ v = serialize_depset(x, context='or')
+ if v.strip():
+ l.append("( %s )" % v.strip())
+ return ' '.join(l)
+
+def getallpkgs():
+ packages = []
+ os.chdir(pkgdir)
+ for pkg in grabpkgnames(pkgdir):
+
+ st = os.stat(pkg)
+
+ if not os.path.exists(portage_const.CACHE_PATH+"/xpak/"):
+ os.mkdir(portage_const.CACHE_PATH+"/xpak/")
+
+ fname = portage_const.CACHE_PATH+"/xpak/"+os.path.basename(pkg)[:-5]+".xpak"
+
+ if os.path.exists(fname):
+ if st.st_mtime != os.stat(fname).st_mtime:
+ #print "unlinking "+fname
+ os.unlink(fname)
+
+ if not os.path.exists(fname):
+ tbz2 = xpak.tbz2(pkg)
+ xpdata = xpak.xpak_mem(tbz2.get_data())
+ fp = open(fname, "w")
+ fp.write(xpdata+xpak.encodeint(len(xpdata))+"STOP")
+ fp.close()
+
+ chksum = portage_checksum.perform_md5(pkg)
+ fp = open(fname[:-5]+".md5", "w")
+ fp.write(chksum)
+ fp.close()
+
+ os.utime(fname, (st.st_mtime, st.st_mtime))
+
+ else:
+ if os.path.exists(fname[:-5]+".md5"):
+ chksum = "".join(portage.grabfile(fname[:-5]+".md5"))
+ else:
+ chksum = portage_checksum.perform_md5(pkg)
+
+ tbz2 = xpak.tbz2(fname)
+
+ packages.append((pkg, tbz2, chksum, st))
+ return packages
+
+def genpkgindex_header(fp, packages):
+ import re
+ profilever = os.path.normpath("///"+os.readlink("/etc/make.profile"))
+ basepath = os.path.normpath("///"+portage.settings["PORTDIR"]+"/profiles")
+ if re.match(basepath,profilever):
+ profilever = profilever[len(basepath)+1:]
+ else:
+ profilever = "!"+profilever
+ del basepath
+
+ timestamp = str(time.time()).split(".")[0]
+ fp.write("# This file was auto generated by " + os.path.basename(sys.argv[0]) + "\n")
+ if pkgdir == portage.settings["PKGDIR"]:
+ fp.write("PROFILE: "+profilever+"\n")
+ fp.write("PACKAGES: "+str(len(packages)) +"\n")
+ fp.write("TIMESTAMP: "+timestamp+"\n")
+
+ vmask = [ "AUTOCLEAN", "DISTDIR", "PKGDIR", "PORTDIR" , "PORTAGE_TMPDIR" , "PORTAGE_RSYNC_OPTS" ]
+ variables = portage_util.grabfile(portage.settings["PORTDIR"]+"/profiles/info_vars")
+ variables = [v for v in variables if v not in vmask]
+ variables.sort()
+
+ for var in variables:
+ if var in portage.settings:
+ if (len(portage.settings[var])):
+ fp.write(var+": "+portage.settings[var]+"\n")
+ else:
+ fp.write("PACKAGES: "+str(len(packages)) +"\n")
+ fp.write("TIMESTAMP: "+timestamp+"\n")
+ fp.write("\n")
+
+def genpkgindex(packages):
+ os.chdir(pkgdir)
+ control_file = ".Packages"
+ fp = open(control_file, "w")
+ genpkgindex_header(fp, packages)
+
+ for pkg, tbz2, chksum, st in packages:
+ stuff = tbz2.getboth()
+ if not stuff:
+ print "Not a tbz2: "+str(pkg)
+ continue
+
+ cat = xpak.getitem(stuff, "CATEGORY")
+
+ use = xpak.getitem(stuff, "USE")
+ if use is None:
+ use = ''
+ iuse = xpak.getitem(stuff, "IUSE")
+ if iuse is None:
+ iuse = ''
+
+ s = xpak.getitem(stuff, "DESCRIPTION")
+ if s is not None:
+ s = ' '.join(s.split())
+ if s:
+ fp.write("DESC: %s\n" % s)
+ # drop '.tbz2'
+ fp.write("CPV: %s/%s\n" % (cat.strip(), os.path.basename(pkg[:-5])))
+ s = xpak.getitem(stuff, "SLOT")
+ if s is not None:
+ s = ' '.join(s.split())
+ if s and s != "0":
+ fp.write("SLOT: %s\n" % s)
+
+ split_use = use.split()
+ for name in ("LICENSE", "RDEPEND", "PDEPEND", "PROVIDE"):
+ item = xpak.getitem(stuff, name)
+ if item is None:
+ continue
+ val = portage_dep.use_reduce(portage_dep.paren_reduce(' '.join(item.split())), uselist=split_use)
+ if val:
+ fp.write("%s: %s\n" % (name, serialize_depset(val)))
+
+ # map IUSE->USE and look for matching flags, filter dupes
+ # if both flags match then this is what matters.
+ s = set(split_use).intersection(iuse.split())
+ if s:
+ l = list(s)
+ l.sort()
+ fp.write("USE: %s\n" % ' '.join(l))
+
+ fp.write("SIZE: "+ str(st[stat.ST_SIZE]) +"\n")
+ fp.write("MD5: "+chksum+"\n")
+ fp.write("\n")
+
+ fp.write("\n")
+ fp.flush()
+ fp.close()
+
+ if (compress):
+ os.system("bzip2 < .Packages > .Packages.bz2")
+ os.rename(".Packages.bz2", "Packages.bz2")
+ else:
+ if os.path.exists("Packages.bz2"):
+ os.unlink("Packages.bz2")
+
+ os.rename(".Packages", "Packages")
+
+
+def main():
+ update_pkgdir()
+
+ parseargs()
+
+ if not quiet:
+ portage.writemsg(portage.output.green(' * ')+'Update binary package index %s/Packages\n' % pkgdir);
+
+ start = time.time()
+ packages = getallpkgs()
+ genpkgindex(packages)
+ cleanxfiles(pkgdir)
+ finish = time.time()
+
+ if not quiet:
+ portage.writemsg(portage.output.green(' * ')+"PKGDIR contains "+ str(len(packages)) + ' packages. (%.01fsec)\n' % (finish - start));
+
+
+if __name__ == "__main__":
+ main()
diff --git a/deprecated/genpkgindex/genpkgindex.1 b/deprecated/genpkgindex/genpkgindex.1
new file mode 100644
index 0000000..8a3956e
--- /dev/null
+++ b/deprecated/genpkgindex/genpkgindex.1
@@ -0,0 +1,59 @@
+.TH "genpkgindex" "1" "" "Ned Ludd" "gentoolkit"
+.SH "NAME"
+.LP
+genpkgindex \- Generates package metadata from binary packages for use with programs such a qmerge from portage\-utils
+.SH "USAGE"
+.LP
+genpkgindex [\fI\-\-options\fP]
+
+.SH "DESCRIPTION"
+.LP
+Generates package metadata from binary packages for use with programs such a qmerge from portage\-utils
+.SH "OPTIONS"
+.LP
+.TP
+\fB\-h, \-\-help\fR
+ Display help and exit
+.TP
+\fB\-v, \-\-verbose\fR
+ Be verbose
+.TP
+\fB\-q, \-\-quiet\fR
+ Be quiet
+.TP
+\fB\-c, \-\-compress\fR
+ Compresses the generated metadata with bzip2.
+.TP
+\fB\-P, \-\-pkgdir <path>\fR
+ Set the base location of the binary packages. The default is normally /usr/portage/packages
+.TP
+
+.SH "ENVIRONMENT VARIABLES"
+.LP
+.TP
+\fBPKGDIR\fP
+is the location of binary packages that you can have created with FEATURES=buildpkg, '\-\-buildpkg' or '\-b/\-B' while emerging a package.
+.SH "EXAMPLES"
+.LP
+Typical usage is to simply run:
+.LP
+genpkgindex
+.LP
+Alternatively if you want the metadata compressed:
+.LP
+genpkgindex \-\-compress
+.LP
+.SH "NOTES"
+.LP
+When no package directories are directly given to genpkgindex on the command line it will output additional variables that it assumes from the running portage environment.
+.LP
+When FEATURES=cleanpkgdir is enabled genpkgindex will invoke "/usr/bin/eclean \-d packages" before creating any package metadata.
+.LP
+genpkgindex intended use is to be run from /etc/portage/bashrc in the $EBUILD_PHASE of "postinst".
+.LP
+.SH "AUTHORS"
+.LP
+Ned Ludd <solar@gentoo.org>
+.SH "SEE ALSO"
+.LP
+emerge(1) qmerge(1) make.conf(5) portage(5)
diff --git a/deprecated/gensync/AUTHORS b/deprecated/gensync/AUTHORS
new file mode 100644
index 0000000..389c51b
--- /dev/null
+++ b/deprecated/gensync/AUTHORS
@@ -0,0 +1,5 @@
+Maintainer:
+Karl Trygve Kalleberg <karltk@gentoo.org>
+
+Original Author:
+Matthew Schick <matt@breakmygentoo.net>
diff --git a/deprecated/gensync/ChangeLog b/deprecated/gensync/ChangeLog
new file mode 100644
index 0000000..7ec2b86
--- /dev/null
+++ b/deprecated/gensync/ChangeLog
@@ -0,0 +1,12 @@
+2004-09-10 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Fixed portage import, fixes #45079.
+ * Added all sources sync patch from Adam Ashley
+ <adam_ashley@softhome.net>, fixes #45079.
+ * Fixed config dir scanning, suggested by burrelln@colorado.edu,
+ fixes #47390.
+ * Applied config file parser fix by Mamoru KOMACHI <usata@gentoo.org>,
+ fixes #44777.
+
+2004-02-08 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Initial import
+
diff --git a/deprecated/gensync/Makefile b/deprecated/gensync/Makefile
new file mode 100644
index 0000000..d5b879a
--- /dev/null
+++ b/deprecated/gensync/Makefile
@@ -0,0 +1,24 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+.PHONY: all
+all:
+
+dist:
+ mkdir -p ../../$(distdir)/src/gensync/
+ cp Makefile AUTHORS README TODO ChangeLog \
+ gensync gensync.1 gensync.conf \
+ bmg-main.syncsource bmg-gnome-current.syncsource \
+ ../../$(distdir)/src/gensync/
+
+install: all
+ install -d $(docdir)/deprecated/gensync
+ install -m 0755 gensync $(docdir)/deprecated/gensync/
+ install -m 0644 AUTHORS README TODO ChangeLog $(docdir)/deprecated/gensync/
+ install -m 0644 gensync.1 $(docdir)/deprecated/gensync/
+ install -m 0644 gensync.conf bmg-main.syncsource bmg-gnome-current.syncsource $(docdir)/deprecated/gensync/
diff --git a/deprecated/gensync/README b/deprecated/gensync/README
new file mode 100644
index 0000000..cf54dec
--- /dev/null
+++ b/deprecated/gensync/README
@@ -0,0 +1,16 @@
+
+Package : gensync
+Version : 0.1.0
+Author : See AUTHORS
+
+MOTIVATION
+
+Gensync handles rsyncing to multiple sync sources.
+
+MECHANICS
+
+N/A
+
+IMPROVEMENTS
+
+N/A
diff --git a/deprecated/gensync/TODO b/deprecated/gensync/TODO
new file mode 100644
index 0000000..733a959
--- /dev/null
+++ b/deprecated/gensync/TODO
@@ -0,0 +1,4 @@
+- Add using cvs to sync
+- Update portage cache after sync
+- Add overlay dirs defined in /etc/conf.d/gensync to /etc/make.conf
+- Sync up with Marius on the multiple overlay code
diff --git a/deprecated/gensync/bmg-gnome-current.syncsource b/deprecated/gensync/bmg-gnome-current.syncsource
new file mode 100644
index 0000000..51dd908
--- /dev/null
+++ b/deprecated/gensync/bmg-gnome-current.syncsource
@@ -0,0 +1,18 @@
+
+# This id must be unique among all the ids in /etc/gensync/*.syncsource
+id="bmg-gnome-current"
+
+# This is a human-readable description of the source
+description="BreakMyGentoo GNOME current"
+
+# The rsync url
+rsync="rsync://rsync.breakmygentoo.net/gnome-current"
+
+# By default, the overlay directory is set to ${base_overlay}/${id},
+# where base_overlay is picked from /etc/gensync/gensync.conf
+#
+# You may specify a different relative path, such as
+overlay="bmg-gnome-current.alternative"
+#
+# Or an entirely new absolute path (remeber to create the path first)
+#overlay="/my/absolute/path"
diff --git a/deprecated/gensync/bmg-main.syncsource b/deprecated/gensync/bmg-main.syncsource
new file mode 100644
index 0000000..8d74ca2
--- /dev/null
+++ b/deprecated/gensync/bmg-main.syncsource
@@ -0,0 +1,18 @@
+
+# This id must be unique among all the ids in /etc/gensync/*.syncsource
+id="bmg-main"
+
+# This is a human-readable description of the source
+description="BreakMyGentoo main tree"
+
+# The rsync url
+rsync="rsync://rsync.breakmygentoo.net/bmg-overlay"
+
+# By default, the overlay directory is set to ${base_overlay}/${id},
+# where base_overlay is picked from /etc/gensync/gensync.conf
+#
+# You may specify a different relative path, such as
+overlay="bmg-main.alternative"
+#
+# Or an entirely new absolute path (remeber to create the path first)
+#overlay="/my/absolute/path"
diff --git a/deprecated/gensync/gensync b/deprecated/gensync/gensync
new file mode 100755
index 0000000..52f25ed
--- /dev/null
+++ b/deprecated/gensync/gensync
@@ -0,0 +1,226 @@
+#!/usr/bin/python
+#
+# Simple program to rsync from various 3rd party ebuild servers.
+#
+#
+# Copyright (c) 2004, Matthew Schick <matt@breakmygentoo.net> (original author)
+# Copyright (c) 2004, Gentoo Technologies, Inc
+# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
+#
+# Distributed under the terms of the GNU General Public License v2
+
+__author__ = "Matt Schick <matt@breakmygentoo.net>, Karl Trygve Kalleberg <karltk@gentoo.org>"
+__email__ = "karltk@gentoo.org"
+__version__ = "0.1.0"
+__productname__ = "gensync"
+__description__ = "Gentoo Overlay Sync Tool"
+
+
+import sys
+import os
+import fileinput
+
+sys.path.insert(0, "/usr/lib/portage/pym")
+import portage
+
+try:
+ from portage.output import *
+except ImportError:
+ from output import *
+
+class ConfigDefaults:
+ def __init__(self):
+ self.rsync_timeout = 0
+ self.base_overlay = "/usr/local/overlays"
+ self.confdir = '/etc/gensync'
+ self._init_from_file()
+ self._setup_rsync()
+ def _init_from_file(self):
+ try:
+ ins = open("/etc/gensync/gensync.conf")
+ for x in ins.readlines():
+ # Skip line if it's a comment or not well-formed
+ if x.find("=") == -1 or \
+ (len(x) and x[0] == "#"):
+ continue
+ (attrib, value) = x.split('=')
+ attrib = attrib.strip().strip('"')
+ value = value.strip().strip('"')
+ if attrib == "rsync_timeout":
+ self.rsync_timeout = value
+ elif attrib == "base_overlay":
+ self.base_overlay = value
+ except:
+ pass
+
+ def _setup_rsync(self):
+ if self.rsync_timeout == 0:
+ try:
+ self.rsync_timeout = portage.settings["RSYNC_TIMEOUT"]
+ except:
+ self.rsync_timeout = 180
+ self.rsync_command = "/usr/bin/rsync " + \
+ "-rlptDvz --progress " + \
+ "--delete --delete-after " + \
+ "--timeout=" + str(self.rsync_timeout) + " " \
+ "--exclude='distfiles/*' " + \
+ "--exclude='local/*' " + \
+ "--exclude='packages/*' "
+
+Config = ConfigDefaults()
+
+class SyncSource:
+ """Contains all details about an upstream rsync source."""
+ def __init__(self,filename):
+ self.id = "#unset#"
+ self.name = "#unset#"
+ self.url = "#unset#"
+ self.overlay = "#unset#"
+ self._init_from_file(filename)
+
+ if self.overlay == "#unset#":
+ self.overlay = Config.base_overlay + "/" + self.id
+ elif len(self.overlay) and self.overlay[0] != "/":
+ self.overlay = Config.base_overlay + "/" + self.overlay
+ elif len(self.overlay) and self.overlay[0] == "/":
+ pass
+ else:
+ print "Malformed overlay, '" + self.overlay + "'"
+ sys.exit(-2)
+
+ def _init_from_file(self, filename):
+ """Loads configuration settings from a .syncsource file."""
+ ins = open(filename)
+ for x in ins.readlines():
+ # Skip line if it's a comment or not well-formed
+ if x.find("=") == -1 or \
+ (len(x) and x[0] == "#"):
+ continue
+ (attrib, value) = x.split("=")
+ attrib = attrib.strip().strip('"')
+ value = value.strip().strip('"')
+ if attrib == "id":
+ self.id = value
+ elif attrib == "description":
+ self.name = value
+ elif attrib == "rsync":
+ self.url = value
+ elif attrib == "overlay":
+ self.overlay = value
+ def perform_sync(self):
+ """Syncs with upstream source."""
+ cmd = Config.rsync_command + self.url +"/* " + self.overlay
+ exitcode = portage.spawn(cmd, portage.settings, free=1)
+
+ def dump(self,ous=sys.stdout):
+ ous.write("id =\"%s\"\n" % (self.id) + \
+ "name =\"%s\"\n" % (self.name) + \
+ "rsync =\"%s\"\n" % (self.url) + \
+ "overlay=\"%s\"\n\n" % (self.overlay))
+
+class SyncSourceManager:
+ """Holds information on all known upstream rsync sources."""
+ def __init__(self):
+ self.sources = []
+ self._load_source_info()
+ def _load_source_info(self):
+ for x in os.listdir(Config.confdir):
+ if x.rfind(".syncsource") > 0 and \
+ x.endswith(".syncsource"):
+ ss = SyncSource(Config.confdir + "/" + x)
+ self.sources.append(ss)
+ def list_sources(self):
+ for x in self.sources:
+ x.dump()
+ def get_sync_source(self, source_id):
+ for x in self.sources:
+ if x.id == source_id:
+ return x
+ return None
+ def get_all_sync_sources(self):
+ return self.sources
+
+def print_version():
+ print __productname__ + "(" + __version__ + ") - " + \
+ __description__
+ print "Author(s): " + __author__
+
+def print_usage():
+ print white("Usage: ") + turquoise(__productname__) + \
+ yellow(" <options> ") + green("repo-id-1 repo-id-2 ...")
+ print "where " + yellow("<options>") + " is one of"
+ print yellow(" -a, --all-sources") + " - sync all know sources"
+ print yellow(" -l, --list-sources") + " - list known rsync sources"
+ print yellow(" -C, --no-color") + " - turn off colours"
+ print yellow(" -h, --help") + " - this help screen"
+ print yellow(" -V, --version") + " - display version info"
+
+
+def parse_args(cliargs):
+
+ cmd = "sync-sources"
+ args = []
+ options = []
+
+ for x in cliargs:
+ if x in ["-V", "--version"]:
+ cmd = "print-version"
+ break
+ elif x in ["-h", "--help"]:
+ cmd = "print-usage"
+ break
+ elif x in ["-C", "--no-color"]:
+ options.append("nocolor")
+ break
+ elif x in ["-l", "--list-sources"]:
+ cmd = "list-sources"
+ elif x in ["-a", "--all-sources"]:
+ cmd = "all-sources"
+ else:
+ args.append(x)
+ return (cmd, args, options)
+
+def main():
+
+ # Setup colors, as per system defaults
+ if (not sys.stdout.isatty()) or \
+ (portage.settings["NOCOLOR"] in ["yes","true"]):
+ nocolor()
+
+ # Parse arguments
+ (cmd, args, options) = parse_args(sys.argv[1:])
+
+ # Turn off color, if specified by cmdline switch
+ if "nocolor" in options:
+ nocolor()
+
+ # Initialise sync source manager
+ ssmgr = SyncSourceManager()
+
+ # Perform selected command
+ if cmd == "list-sources":
+ ssmgr.list_sources()
+ elif cmd == "print-version":
+ print_version()
+ elif cmd == "print-usage":
+ print_usage()
+ elif cmd == "sync-sources":
+ for x in args:
+ repo = ssmgr.get_sync_source(x)
+ if repo:
+ print "Syncing '%s' into '%s'" % \
+ (repo.id, repo.overlay)
+ repo.perform_sync()
+ elif cmd == "all-sources":
+ for repo in ssmgr.get_all_sync_sources():
+ print "Syncing '%s' into '%s'" % \
+ (repo.id, repo.overlay)
+ repo.perform_sync()
+ else:
+ print red("Unknown command '" + cmd + "'")
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ print "Operation aborted by user keypress!"
diff --git a/deprecated/gensync/gensync.1 b/deprecated/gensync/gensync.1
new file mode 100644
index 0000000..17d85fc
--- /dev/null
+++ b/deprecated/gensync/gensync.1
@@ -0,0 +1,75 @@
+.TH gensync 1 "0.1.0" "Gentoolkit" "Gentoo Administration"
+.SH "NAME"
+.LP
+gensync \- Gentoo: Overlay Sync Tool
+.SH "SYNTAX"
+.LP
+gensync [\fIoption\fP] <\fIrepo-id-1 repo-id-2 ...\fP>
+
+.SH "DESCRIPTION"
+
+.LP
+
+\fIgensync\fR synchronises your machine against an upstream repository
+of ebuild files, called a sync source. Normally, Portage will only
+synchronise against the main Portage tree maintained by the Gentoo
+project. However, there exist development trees with auxiliary ebuild
+files that may occasionally be of interest to the adventurous power
+user, such as the \fIbreakmygentoo.net\fR sync source.
+
+This tool can be used to synchronise against these alternative sync
+sources.
+
+.SH "OPTIONS"
+.LP
+\fB\-l\fR
+.br
+\fB--list-sources\fB
+.IP
+List available sync sources known to \fIgensync\fR.
+
+.LP
+\fB\-V\fR
+.br
+\fB--version\fB
+.IP
+Display version information and exit.
+
+.LP
+\fB\-C\fR
+.br
+\fB--no-color\fB
+.IP
+Turn off colors.
+
+.LP
+\fB\-h\fR
+.br
+\fB\--help\fR
+.IP
+Display help.
+
+.SH "CONFIGURATION FILES"
+.LP
+\fB/etc/gensync/gensync.conf\fR
+.IP
+The main configuration file, commented and self-explanatory
+
+.LP
+\fB/etc/gensync/*.syncsource\fR
+.IP
+Per-sync source configuration files, describing the sync source to
+\fIgensync\fR.
+
+
+.SH "SEE ALSO"
+.LP
+The rest of the utilities in \fIapp-portage/gentoolkit-dev\fR, such as
+\fIechangelog\fR, \fIebump\fR and \fIego\fR.
+
+.SH "AUTHORS"
+.LP
+Matthew Schick <matt@breakmygentoo.net> (original author)
+.br
+Karl Trygve Kalleberg <karltk@gentoo.org>
+
diff --git a/deprecated/gensync/gensync.conf b/deprecated/gensync/gensync.conf
new file mode 100644
index 0000000..389e020
--- /dev/null
+++ b/deprecated/gensync/gensync.conf
@@ -0,0 +1,8 @@
+
+# By default, we ask Portage about the preferred timeout
+#rsync_timeout = 180
+
+# Normally, each sync source will be placed under
+# ${base_overlay}/${syncsource-id}, where the 'syncsource-id' is a unique
+# identifier, specified inside the individual .syncsource file
+base_overlay = /usr/local/overlays
diff --git a/deprecated/lintool/AUTHORS b/deprecated/lintool/AUTHORS
new file mode 100644
index 0000000..fe436cb
--- /dev/null
+++ b/deprecated/lintool/AUTHORS
@@ -0,0 +1 @@
+Karl Trygve Kalleberg <karltk@gentoo.org>
diff --git a/deprecated/lintool/COPYING b/deprecated/lintool/COPYING
new file mode 100644
index 0000000..60549be
--- /dev/null
+++ b/deprecated/lintool/COPYING
@@ -0,0 +1,340 @@
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) 19yy <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) 19yy name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/deprecated/lintool/ChangeLog b/deprecated/lintool/ChangeLog
new file mode 100644
index 0000000..0e8c1e9
--- /dev/null
+++ b/deprecated/lintool/ChangeLog
@@ -0,0 +1,71 @@
+2004-02-18 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Moved from separate CVS module to be part of gentoolkit-dev
+
+2002-10-31 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Fixed \$Header$ comment
+ * Fixed off-by-one in line numbering
+
+2002-10-30 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Now defaults to showing all details
+ * Added --no-details
+ * Better LICENSE parsing
+ * Better references to policy.
+ * Line numbers for whitespace testing.
+ * Released 0.2.4
+
+2002-08-12 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added more header tests
+ * Added initial tests for SLOT, KEYWORD and LICENSE
+
+2002-08-10 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Spurious space checker works again.
+ * Added Makefile, COPYING, README, AUTHORS, NEWS
+
+2002-07-22 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Changed A=${P}.tar.gz check to ^A=.*, as per Seemant's suggestion.
+
+2002-07-17 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added TestLicense to ebuild.py
+ * Added --aux-license-dir=<dir>
+ * Added MunchieFormatter
+ * Added --formatter=<formatter>
+
+2002-07-10 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Refactored; split tests into changelog, digest and ebuild-specific
+ * Added TestSyntax test to digest.py
+ * Added TestHeaders, TestConstructPresence, TestIndentation to
+ changelog.py
+
+2002-05-15 Karl Trygve Kalleberg <karltk@gentoo.org>
+
+ * Fixed test for Author: and Maintainer: to warn about their
+ deprecation and recommend the use of ChangeLog instead.
+ * Added (E) and (W) prefixes to messages printed by --show-details
+ * Added --tests=-<particular test> to allow turning off a
+ particular test easily.
+ * Added statistics output at the bottom.
+ * Updated man page to reflect new option feature.
+ * Fixed the --show-details, --show-separate annoyance.
+ * Fixed use flags parsing to disregard some false positives.
+
+2002-05-13 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Fixed --list-tests which was incorrectly --listTests
+
+2002-04-30 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added <jnelson@gentoo.org>'s cleanups
+ * Improved error reporting; now separates into errors and
+ warnings.
+ * Improved TestSpaces to check for non-conformant
+ line-continuations.
+ * Added TestUseFlags that checks that an ebuild only uses
+ sanctioned use flags (read from /usr/portage/profiles/use.desc)
+ * Added SLOT= to list desired env vars (warns if missing)
+ * Added LICENSE= to list of required env vars (errors if missing)
+ * Improved error messages
+ * Added --tests= option to allow the user to specify which tests
+ to run
+ * Added --list-tests option that lists available tests
+ * Updated man page.
+
+2002-03-22 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added this ChangeLog
diff --git a/deprecated/lintool/NEWS b/deprecated/lintool/NEWS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/lintool/NEWS
diff --git a/deprecated/lintool/README b/deprecated/lintool/README
new file mode 100644
index 0000000..1494aad
--- /dev/null
+++ b/deprecated/lintool/README
@@ -0,0 +1,23 @@
+
+Package: Lintool
+Version: 0.1.3
+Author : Karl Trygve Kalleberg <karltk@gentoo.org>
+
+
+MOTIVATION
+
+Lintool is a "lint" utility for the Gentoo Linux distribution. It is a
+tool that tests ebuilds, changelogs and package digests for
+well-formedness. It's intended to aid Gentoo Linux developers avoid most
+common mistakes when packaging software for Gentoo.
+
+MECHANICS
+
+To check an ebuild, do lintool --ebuild <path-to-ebuild>
+To check a ChangeLog, do lintool --changelog <path-to-changelog>
+To check a package digest, do lintoo --digest <path-to-digest>
+
+IMPROVEMENTS
+
+Any suggestions for improvements should be sent to karltk@gentoo.org, or
+added as a bug assigned to me.
diff --git a/deprecated/lintool/lintool.1 b/deprecated/lintool/lintool.1
new file mode 100644
index 0000000..11883e8
--- /dev/null
+++ b/deprecated/lintool/lintool.1
@@ -0,0 +1,41 @@
+.TH lintool "1" "March 2002" "gentoolkit 0.1.3"
+.SH NAME
+lintool \- manual page for the lintool program, a program that checks the
+santity of ebuild scripts.
+.SH SYNOPSIS
+.B lintool
+\fI<switches>\fR \fIebuilds...\fR
+.SH DESCRIPTION
+Lintool checks if a set of
+.I ebuilds
+conforms to the ebuild style guide. This is not
+(yet) an exhaustive test, so your ebuild might be broken even if lintool
+thinks it's okay.
+.PP
+.SH OPTIONS
+.TP
+\fB--no-summary\fI
+Turn off total summary for all tests run on all ebuilds.
+.TP
+\fB--show-separate\fI
+Show short summary of tests for each ebuild checked.
+.TP
+\fB--show-details\fI
+Show full details of tests for each ebuild checked
+.TP
+\fB--tests=test1,test2,..\fI
+Run only the tests specified to this option. Default is to run all
+tests. One can turn off a particular test by pretending it with minus (e.g.
+.I --tests=-TestUseFlags,-TestSpaces
+). A list of tests can be obtained from
+.I --list-tests
+.TP
+\fB--list-tests\fI
+List available tests.
+.SH AUTHORS
+Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
+.SH "SEE ALSO"
+ebuild(5)
+.TP
+The \fI/usr/sbin/lintool\fR script.
+
diff --git a/deprecated/lintool/lintool.py b/deprecated/lintool/lintool.py
new file mode 100755
index 0000000..721c744
--- /dev/null
+++ b/deprecated/lintool/lintool.py
@@ -0,0 +1,320 @@
+#! /usr/bin/python
+#
+# Copyright 2002 Gentoo Technologies, Inc
+# Distributed under the terms of the GNU General Public License v2.0
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+#
+# About:
+# lintool aims to check the stylistic and syntactical correctness for
+# ebuilds, changelogs and digest files for the Gentoo packaging system.
+#
+# TODO
+#
+# - Make HTMLFormatter
+#
+
+VERSION="0.2.4"
+
+import sys
+import getopt
+
+from lintool import ebuild, changelog, digest
+
+class TextFormatter:
+ def section(self, s):
+ print "\n" + "-"*79
+ print " " + s + "\n"
+ def bullet(self, s):
+ print "* " + s
+ def sub(self, s):
+ print "- " + s
+ def subwarn(self, s):
+ print "- (W) " + s
+ def suberr(self, s):
+ print "- (E) " + s
+ def subsub(self, s):
+ print " |" + s
+ def subsubwarn(self, s):
+ print " (W) |" + s
+ def subsuberr(self, s):
+ print " (E) |" + s
+ def line(self,s):
+ print s
+ def div(self, left, right):
+ l = len(left)
+ r = len(right)
+ return left + " " * (78-l-r) + right
+
+class MunchieFormatter:
+ def section(self, s):
+ print "[lintool] " + "-" * (78 - len("[lintool] "))
+ print "[lintool] " + s + "\n"
+ def bullet(self, s):
+ print "[lintool] * " + s
+ def sub(self, s):
+ print "[lintool] - " + s
+ def subwarn(self, s):
+ print "[lintool] - (W) " + s
+ def suberr(self, s):
+ print "[lintool] - (E) " + s
+ def subsub(self, s):
+ print "[lintool] |" + s
+ def subsubwarn(self, s):
+ print "[lintool] (W) |" + s
+ def subsuberr(self, s):
+ print "[lintool] (E) |" + s
+ def line(self,s):
+ print "[lintool] " + s
+ def div(self, left, right):
+ l = len("[lintool] " + left)
+ r = len(right)
+ return left + " " * (78-l-r) + right
+
+formatters = { "text" : TextFormatter(), "munchie" : MunchieFormatter() }
+
+def extractFilename(path):
+ return path
+
+def runTests(tests,results,ins):
+ for j in tests:
+ j.reset()
+
+ ln = 1
+ for i in ins.readlines():
+ for j in tests:
+ j.checkLine(i, ln)
+ ln += 1
+
+ hasWarning = 0
+ hasError = 0
+ for j in xrange(len(tests)):
+ if tests[j].hasErrors():
+ results[j][0] += 1
+ hasError = 1
+ if tests[j].hasWarnings():
+ results[j][1] += 1
+ hasWarning = 1
+ return (hasError, hasWarning)
+
+def showStatus(options,tests,formatter,file):
+ if options['showDetails'] or options['showSeparate']:
+ formatter.section("Status for " + file)
+ for j in tests:
+ if options['showSeparate'] or options['showDetails']:
+ l = len(j.getDesc())
+ formatter.bullet(formatter.div(j.getDesc(), ": " + j.getStatus()))
+ if options['showDetails']:
+ j.report()
+ elif options['showShort']:
+ allOK = 1
+ for j in tests:
+ if j.hasErrors():
+ allOK = 0
+ break
+ if allOK:
+ formatter.div(file, ": OK")
+ else:
+ formatter.div(file, ": Not OK")
+ # else fall through the bottom
+
+def usage(opts):
+ print sys.argv[0], "[options] ebuild [ebuild ebuild ... ]"
+ print
+
+ if opts:
+ print "Where [options] include:"
+ for (short,long_,desc) in opts:
+ short_ = ''
+ for s in short:
+ short_ = short_ + '-' + s + ','
+ long_ = '--' + long_
+ opt = short_ + long_
+ opt = opt.rjust(18)
+ print opt + ' ' + desc
+ print
+
+def parse_opts(argv):
+ options = { 'showSeparate': 0,
+ 'showTotal': 1,
+ 'showDetails': 1,
+ 'showShort': 1,
+ 'listTests': 0,
+ 'desiredTests': 0,
+ 'testMode' : "ebuild",
+ 'licenseDirs' : [ "/usr/portage/licenses" ],
+ 'formatter' : 'text'
+ }
+
+ opts = (('', 'show-separate',
+ 'Show short summary of tests for each ebuild checked'),
+
+ ('v', 'version',
+ 'Show program version'),
+
+ ('', 'no-summary',
+ 'Do not show total summary'),
+
+ ('', 'no-details',
+ 'Do not show full details of tests for each ebuild checked'),
+
+ ('', 'ebuild',
+ 'Files to check are ebuilds'),
+
+ ('', 'changelog',
+ 'Files to check are changelogs'),
+
+ ('', 'digest',
+ 'Files to check are digests'),
+
+ ('', 'tests=',
+ 'Comma-separated list of tests to run'),
+
+ ('', 'list-tests',
+ 'List available tests'),
+
+ ('', 'from-file=<file>',
+ 'Read ebuilds from <file>'),
+
+ ('', 'formatter=<formatter>',
+ "Use 'text' (default) or 'munchie' formatter"),
+
+ ('', 'aux-license-dir=<dir>',
+ 'Add <dir> to directories to search for licenses'),
+
+ ('?h', 'help',
+ 'Show this help'),
+ )
+
+ short_options = ''
+ long_options = []
+ for (short,long_,desc) in opts:
+ short_options = short_options + short
+ if '=' in long_:
+ long_ = long_.split('=', 1)[0] + '='
+ long_options.append(long_)
+
+ try:
+ (option_list,args) = getopt.getopt(sys.argv[1:], short_options, long_options)
+ except getopt.GetoptError, details:
+ print 'Error parsing command line:',str(details)
+ sys.exit(1)
+
+ for (option,value) in option_list:
+ if option in [ '--no-details' ]:
+ options['showShort'] = 1
+ options['showDetails'] = 0
+ elif option in [ '--show-separate' ]:
+ options['showShort'] = 0
+ options['showSeparate'] = 1
+ elif option in [ '--no-summary']:
+ options['showTotal'] = 0
+ elif option in [ '--from-file' ]:
+ lines = open(value, 'r').readlines()
+ lines = [o.strip() for o in lines]
+ args = lines + args
+ elif option in [ '--tests' ]:
+ options['desiredTests'] = value.split(",")
+ elif option in [ '--formatter' ]:
+ options['formatter'] = value
+ elif option in [ '--list-tests' ]:
+ options['listTests'] = 1
+ elif option in [ '--ebuild' ]:
+ options['testMode'] = 'ebuild'
+ elif option in [ '--changelog' ]:
+ options['testMode'] = 'changelog'
+ elif option in [ '--digest' ]:
+ options['testMode'] = 'digest'
+ elif option in [ '--aux-license-dir' ]:
+ options['licenseDirs'].append(value)
+ elif option in [ '-v', '--version' ]:
+ print "Lintool " + VERSION
+ sys.exit(0)
+ elif option in [ '-h', '-?', '--help' ]:
+ usage(opts)
+ sys.exit(0)
+ else:
+ # shouldn't ever happen. better to be safe
+ print "Unknown option - '%s'!" % (option)
+ sys.exit(1)
+
+ return (options,args)
+
+def main():
+ (options,args) = parse_opts(sys.argv[1:])
+
+ formatter = formatters[options['formatter']]
+
+ # Get test suite for given mode
+ if options['testMode'] == "ebuild":
+ available_tests = ebuild.getTests(formatter, options)
+ elif options['testMode'] == "changelog":
+ available_tests = changelog.getTests(formatter, options)
+ elif options['testMode'] == "digest":
+ available_tests = digest.getTests(formatter, options)
+
+ # List available tests, if that was the users request
+ if options['listTests']:
+ maxlen = 0
+ for i in available_tests:
+ maxlen = max(len(i.__class__.__name__), maxlen)
+ for i in available_tests:
+ n = i.__class__.__name__
+ print n + " " * (maxlen - len(n)) + " - " + i.getDesc()
+
+ # Quit with short usage string, if no params given
+ if len(args) == 0:
+ usage(None)
+ sys.exit(1)
+
+ # Create final list of tests to run
+ tests = []
+ notTests = []
+ if options['desiredTests']:
+ for i in options['desiredTests']:
+ for j in available_tests:
+ if len(i) and i[0] == "-":
+ notTests.append(i[1:])
+ if j.__class__.__name__ == i:
+ tests.append(j)
+ else:
+ tests = available_tests
+
+ if len(notTests):
+ for i in available_tests:
+ if i.__class__.__name__ not in notTests:
+ tests.append(i)
+
+ results = [[0, 0] for x in range(len(tests))]
+
+ # Set up for test run
+ numFiles = 0
+ totalErrors = 0
+ totalWarnings = 0
+
+ # Iterate through all files given as arguments, testing each file
+ # against the final list of tests
+ for i in args:
+ fn = extractFilename(i)
+ ins = open(i, "r")
+ numFiles += 1
+ (hasError, hasWarning) = runTests(tests,results,ins)
+ totalErrors += hasError
+ totalWarnings += hasWarning
+ showStatus(options,tests,formatter,fn)
+
+ # Show totals, if options allow it
+ if options['showTotal']:
+ formatter.section(formatter.div("Summary for all " + str(numFiles) + " " + options['testMode'] + "(s) checked", "#errors/warns"))
+ for i in xrange(len(tests)):
+ l = len(tests[i].getDesc())
+ formatter.line(formatter.div(tests[i].getDesc(), ": %3d / %3d" % (results[i][0], results[i][1])))
+ formatter.line(formatter.div("Total number of ebuilds with errors", \
+ "%3d (%3d%%)" % (totalErrors, totalErrors*100/numFiles)))
+ formatter.line(formatter.div("Total number of ebuilds with warnings", \
+ "%3d (%3d%%)" % (totalWarnings, totalWarnings*100/numFiles)))
+ if totalErrors:
+ sys.exit(1)
+
+if __name__ == "__main__":
+ main()
+
diff --git a/deprecated/lintool/lintool/__init__.py b/deprecated/lintool/lintool/__init__.py
new file mode 100644
index 0000000..4d2e3a6
--- /dev/null
+++ b/deprecated/lintool/lintool/__init__.py
@@ -0,0 +1,3 @@
+import ebuild
+import changelog
+import digest
diff --git a/deprecated/lintool/lintool/changelog.py b/deprecated/lintool/lintool/changelog.py
new file mode 100644
index 0000000..1dad779
--- /dev/null
+++ b/deprecated/lintool/lintool/changelog.py
@@ -0,0 +1,105 @@
+# Copyright 2002 Gentoo Technologies, Inc
+# Distributed under the terms of the GNU General Public License v2.0
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+
+from test import Test, Regex
+import re
+
+class TestHeaders(Test):
+ def __init__(self, formatter,options):
+ Test.__init__(self,formatter,options)
+ self.desc = "Testing for malformed headers"
+ self.re = [ (1, # append result of regex match
+ re.compile("^(# Copyright 1999-(2000|2001).*)"),
+ "Suspect copyright year"),
+ (1,
+ re.compile("^(# /home.*)"),
+ "Suspect path in header"),
+ (0, # don't append result of regex match
+ re.compile("^(# Author.*)"),
+ "Use of Author field in the header is deprecated. Put name in ChangeLog"),
+ (0,
+ re.compile("^(# Maintainer.*)"),
+ "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"),
+ (1,
+ re.compile("^(# /space.*)"),
+ "Suspect path in header")]
+
+ def checkLine(self, s, ln):
+ for i in self.re:
+ k = i[1].match(s)
+ if k and i[0]:
+ self.warnings.append(i[2] + ": " + k.groups()[0] )
+ elif k and not i[0]:
+ self.warnings.append(i[2])
+
+ def report(self):
+ if len(self.warnings):
+ self.formatter.subwarn("Has illegal or suspect headers:")
+ for i in self.warnings:
+ self.formatter.subsub(i)
+
+class TestConstructPresence(Test):
+
+ def __init__(self, formatter,options):
+ Test.__init__(self,formatter,options)
+ self.desc = "Testing for presence of required constructs"
+ self.required = [ ["# ChangeLog for " + Regex.category + "/" + Regex.PN,
+ None,
+ None,
+ "proper ChangeLog line"
+ ],
+
+ ["\*" + Regex.P + " \([0-9]+ [A-Z][a-z][a-z] 2002\).*",
+ None,
+ None,
+ "proper release entry on the form *package-1.0.0 (01 Apr 2000)"
+ ],
+
+ [" [0-9]+ [A-Z][a-z][a-z] 2002; .* <.*@.*> .*:",
+ None,
+ None,
+ "proper changelog entry"
+ ]
+ ]
+
+ for i in self.required:
+ i[1] = re.compile("^(" + i[0] + ")")
+
+ def checkLine(self, s, ln):
+ for i in self.required:
+ k = i[1].match(s)
+ if k:
+ i[2] = 1
+
+ def report(self):
+ for i in self.required:
+ if not i[2]:
+ self.formatter.suberr("Missing " + i[3])
+
+ def hasErrors(self):
+ for i in self.required:
+ if not i[2]:
+ return 1
+
+class TestIndentation(Test):
+
+ def __init__(self, formatter,options):
+ Test.__init__(self,formatter,options)
+ self.desc = "Testing for proper indentation"
+ self.re = re.compile("^( |[#*].|\n).*")
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if not k:
+ self.errors.append(s)
+
+ def report(self):
+ for i in self.errors:
+ print i.replace(' ','%')
+
+def getTests(formatter,options):
+ return [ TestHeaders(formatter,options),
+ TestConstructPresence(formatter,options),
+ TestIndentation(formatter,options)
+ ]
diff --git a/deprecated/lintool/lintool/digest.py b/deprecated/lintool/lintool/digest.py
new file mode 100644
index 0000000..5f174ae
--- /dev/null
+++ b/deprecated/lintool/lintool/digest.py
@@ -0,0 +1,28 @@
+# Copyright 2002 Gentoo Technologies, Inc
+# Distributed under the terms of the GNU General Public License v2.0
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+
+from test import Test
+import re
+
+class TestSyntax(Test):
+
+ def __init__(self,formatter,options):
+ Test.__init__(self,formatter,options)
+ self.desc = "Testing for correct syntax"
+ self.re = [ re.compile("^(MD5 [a-z0-9]+ [a-zA-Z0-9_+.-]+ [0-9]+)") ]
+ self.errors = []
+
+ def checkLine(self, s, ln):
+ for i in self.re:
+ k = i.match(s)
+ if not k:
+ self.errors.append("Invalid line in digest\n |" + s)
+
+ def report(self):
+ for i in self.errors:
+ self.formatter.suberr(i)
+
+
+def getTests(formatter,options):
+ return [ TestSyntax(formatter,options) ]
diff --git a/deprecated/lintool/lintool/ebuild.py b/deprecated/lintool/lintool/ebuild.py
new file mode 100644
index 0000000..c8df0a2
--- /dev/null
+++ b/deprecated/lintool/lintool/ebuild.py
@@ -0,0 +1,349 @@
+# Copyright 2002 Gentoo Technologies, Inc
+# Distributed under the terms of the GNU General Public License v2.0
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+
+from test import Test
+import re
+import os
+import os.path
+
+class TestSpaces(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self, formatter, options)
+ self.desc = "Testing for correct formatting"
+ self.re_spaces = [ re.compile("^([ ][ ]*)([a-zA-Z\.].*)"),
+ re.compile("(.*)([ \t]+)\n") ]
+ self.re_backslash = re.compile("([^#]*\S)((\s\s+|\t))\\\\")
+ self.reset()
+
+ def checkLine(self, s, ln):
+ for r in self.re_spaces:
+ k = r.match(s)
+ if k:
+ spcs = k.groups()[1]
+ rest = k.groups()[0]
+ self.spaces.append((ln, spcs.replace(" ", "%").replace("\t","%") + rest))
+ else:
+ k = self.re_backslash.match(s)
+ if k:
+ head = k.group(1)
+ spcs = k.group(2)
+ tail = "\\"
+ self.backslashes.append((ln, head + len(spcs) * "%" + tail))
+
+ def hasErrors(self):
+ return 0
+ def hasWarnings(self):
+ return len(self.spaces) + len(self.backslashes)
+
+ def reset(self):
+ self.spaces = []
+ self.backslashes = []
+
+ def report(self):
+ if len(self.spaces):
+ self.formatter.subwarn("Has illegal space characters (marked by %):")
+ for i in self.spaces:
+ self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1])
+ if len(self.backslashes):
+ self.formatter.subwarn("Has illegal white space (marked by %), only one space character allowed:")
+ for i in self.backslashes:
+ self.formatter.subsub("[line " + str(i[0]) + "]:" + i[1])
+
+class TestHeaders(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for malformed headers"
+ self.want = [ [ 0, # count
+ re.compile("^(# Copyright .*2002.*)"),
+ "Copyright statement" ],
+ [ 0, # count
+ re.compile("^(# " + "\$" + "Header:.*" + "\$)"), # Don't want CVS to fix this
+ "$" + "Header:" + "$" ], # Don't want CVS to fix this either
+ [ 0, # count
+ re.compile("^(# Distributed under the terms of the GNU General Public License.*)"),
+ "GPL license" ] ]
+ self.dontwant = [ (1, # append result of regex match
+ re.compile("^(# Copyright 1999-(2000|2001).*)"),
+ "Suspect copyright year"),
+ (1,
+ re.compile("^(# /home.*)"),
+ "Suspect path in header"),
+ (0, # don't append result of regex match
+ re.compile("^(# Author.*)"),
+ "Use of Author field in the header is deprecated. Put name in ChangeLog"),
+ (0,
+ re.compile("^(# Maintainer.*)"),
+ "Use of Maintainer field in the header is deprecated. Put name in ChangeLog"),
+ (1,
+ re.compile("^(# /space.*)"),
+ "Suspect path in header")]
+
+ def reset(self):
+ for i in self.want:
+ i[0] = 0
+ self.errors = []
+ self.warnings = []
+
+ def hasErrors(self):
+ num_error = 0
+ for i in self.want:
+ if i[0] == 0:
+ num_error += 1
+ return num_error
+
+ def checkLine(self, s, ln):
+ for i in self.dontwant:
+ k = i[1].match(s)
+ if k and i[0]:
+ self.warnings.append(i[2] + ": " + k.groups()[0] )
+ elif k and not i[0]:
+ self.warnings.append(i[2])
+ for i in self.want:
+ k = i[1].match(s)
+ if k:
+ i[0] += 1
+
+ def report(self):
+ illegal_headers = len(self.warnings)
+ for i in self.want:
+ if i[0] == 0:
+ illegal_headers += 1
+ if illegal_headers:
+ self.formatter.subwarn("Has illegal or suspect headers:")
+ for i in self.warnings:
+ self.formatter.subwarn(i)
+ for i in self.want:
+ if i[0] == 0:
+ self.formatter.suberr("Missing " + i[2])
+
+class TestTry(Test):
+
+ def __init__(self,formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for occurence of deprecated try"
+ self.re = [ re.compile("^([ \t][ \t]*try.*)"),
+ re.compile("(.*=.* try .*)") ]
+
+ def checkLine(self, s, ln):
+ for i in self.re:
+ k = i.match(s)
+ if k:
+ self.errors.append(k.groups()[0])
+
+ def report(self):
+ if len(self.errors):
+ self.formatter.suberr("Uses try, which is deprecated")
+ for i in self.errors:
+ self.formatter.subsub(i)
+
+class TestA(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for superfluous A=${P}.tar.gz"
+ self.re = re.compile("(^A=.*)")
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ self.errors.append(k.groups()[0])
+
+ def report(self):
+ if len(self.errors):
+ self.formatter.suberr("Contains superfluous " + self.errors[0])
+
+class TestDepend(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for empty DEPEND"
+ self.re = re.compile("DEPEND=\"\"")
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ self.warnings.append("")
+
+ def report(self):
+ if len(self.warnings):
+ self.formatter.subwarn("DEPEND is suspiciously empty")
+
+class TestHomepage(Test):
+
+ def __init__(self, formatter,options):
+ Test.__init__(self,formatter,options)
+ self.desc = "Testing for empty HOMEPAGE"
+ self.re = re.compile("HOMEPAGE=\"\"")
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ self.warnings.append("")
+
+ def report(self):
+ if len(self.warnings):
+ self.formatter.subwarn("Is HOMEPAGE really supposed to be empty ?")
+
+class TestDescription(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for empty DESCRIPTION"
+ self.re = re.compile("DESCRIPTION=\"\"")
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ self.errors.append("")
+
+ def report(self):
+ if len(self.errors):
+ self.formatter.suberr("DESCRIPTION must not be empty")
+
+class TestEnvVarPresence(Test):
+
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for presence of env vars"
+ self.re = []
+ self.found = []
+ self.required = [ ("SRC_URI", "See 2.4"),
+ ("DESCRIPTION", "See policy, 2.8"),
+ ("HOMEPAGE", "See policy, 2.8"),
+ ("DEPEND", "See policy, 2.2"),
+ ("LICENSE", "See policy, 2.6"),
+ ("SLOT", "See policy, 2.5"),
+ ("KEYWORDS", "See policy, 2.3"),
+ ("IUSE", "See policy, 2.7")
+ ]
+ self.desired = [ ("RDEPEND", "Is RDEPEND == DEPEND ? See policy, 2.2") ]
+
+
+ for i in self.required:
+ self.re.append(re.compile("^(" + i[0] + ")="))
+ for i in self.desired:
+ self.re.append(re.compile("^(" + i[0] + ")="))
+
+ def checkLine(self, s, ln):
+ for i in self.re:
+ k = i.match(s)
+ if k:
+ self.found.append(k.group(1))
+
+ def report(self):
+ for i in self.required:
+ if i[0] not in self.found:
+ self.formatter.suberr("Missing " + i[0] + ". " + i[1])
+ for i in self.desired:
+ if i[0] not in self.found:
+ self.formatter.subwarn("Missing " + i[0] + ". " + i[1])
+
+ def hasWarnings(self):
+ for i in self.desired:
+ if i[0] not in self.found:
+ return 1
+
+ def hasErrors(self):
+ for i in self.required:
+ if i[0] not in self.found:
+ return 1
+
+class TestLicense(Test):
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for proper LICENSE"
+ self.re = re.compile("^LICENSE=\"(.*)\"")
+ self.license_dirs = options['licenseDirs']
+ self.licenses = self.loadLicenses()
+
+ def loadLicenses(self):
+ licenses = []
+ for i in self.license_dirs:
+ try:
+ candidates = os.listdir(i)
+ except:
+ self.formatter.line("!!! License directory '" + i + "' does not exist")
+ continue
+ for j in candidates:
+ if os.path.isfile(i + "/" + j):
+ licenses.append(j)
+ return licenses
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ print k.group(1)
+ licenses = k.group(1).split(" ")
+ for i in licenses:
+ if i not in self.licenses:
+ self.errors.append("License '" + i + "' not known")
+
+ def report(self):
+ for i in self.errors:
+ self.formatter.suberr(i)
+
+class TestUseFlags(Test):
+ def __init__(self, formatter, options):
+ Test.__init__(self,formatter, options)
+ self.desc = "Testing for sane USE flag usage"
+ self.re = re.compile("[^#]*use ([a-z0-9\+]+).*")
+ self.useflags = self.loadUseFlags()
+
+ def loadUseFlags(self):
+ ins = open("/usr/portage/profiles/use.desc")
+ rex = re.compile("^([a-z0-9]+)[ \t]+-.*");
+ useflags = []
+ for i in ins.readlines():
+ k = rex.match(i)
+ if k:
+ useflags.append(k.group(1))
+ return useflags
+
+ def checkLine(self, s, ln):
+ k = self.re.match(s)
+ if k:
+ flag = k.group(1)
+ if flag not in self.useflags:
+ l = k.start(1)
+ # We want to try and figure pretty exactly if we've hit a real instnce
+ # of the use command or just some random mumbling inside a string
+ numApostrophes = 0
+ numBackticks = 0
+ numTicks = 0
+ for i in xrange(l,0,-1):
+ if s[i] == '\"' and (i == 0 or (i > 0 and s[i-1] != '\\')):
+ numApostrophes += 1
+ if s[i] == '\'' and (i == 0 or (i > 0 and s[i-1] != '\\')):
+ numTicks += 1
+ if s[i] == '`' and (i == 0 or (i > 0 and s[i-1] != '\\')):
+ numBackticks += 1
+
+ if numApostrophes % 2 == 0:
+ foundError = 1
+ elif numBackticks % 2 and numTicks % 2 == 0:
+ foundError = 1
+ else:
+ foundError = 0
+
+ if foundError:
+ self.errors.append("Unknown USE flag '" + flag + "'")
+
+ def report(self):
+ for i in self.errors:
+ self.formatter.suberr(i)
+
+
+def getTests(formatter,options):
+ return [ TestSpaces(formatter,options),
+ TestHeaders(formatter,options),
+ TestTry(formatter,options),
+ TestA(formatter,options),
+ TestDepend(formatter,options),
+ TestHomepage(formatter,options),
+ TestDescription(formatter,options),
+ TestEnvVarPresence(formatter,options),
+ TestUseFlags(formatter,options),
+ TestLicense(formatter,options) ]
diff --git a/deprecated/lintool/lintool/test.py b/deprecated/lintool/lintool/test.py
new file mode 100644
index 0000000..0cc56ff
--- /dev/null
+++ b/deprecated/lintool/lintool/test.py
@@ -0,0 +1,30 @@
+# Copyright 2002 Gentoo Technologies, Inc
+# Distributed under the terms of the GNU General Public License v2.0
+# Author Karl Trygve Kalleberg <karltk@gentoo.org>
+
+class Test:
+ def __init__(self, formatter,options=None):
+ self.formatter = formatter
+ self.errors = []
+ self.warnings = []
+ def reset(self):
+ self.errors = []
+ self.warnings = []
+ def hasWarnings(self):
+ return len(self.warnings)
+ def hasErrors(self):
+ return len(self.errors)
+ def getDesc(self):
+ return self.desc
+ def getStatus(self):
+ if self.hasErrors():
+ return "failed"
+ else:
+ return "passed"
+
+class Regex:
+ PN = "[a-zA-Z_.-]+"
+ PV = "[a-z0-9A-Z_.-]+"
+ P = PN + "-" + PV + "(-r[0-9]+)?"
+ category = "[a-z0-9]+-[a-z0-9]+"
+ full = category + "/" + P
diff --git a/deprecated/moo/AUTHORS b/deprecated/moo/AUTHORS
new file mode 100644
index 0000000..fe436cb
--- /dev/null
+++ b/deprecated/moo/AUTHORS
@@ -0,0 +1 @@
+Karl Trygve Kalleberg <karltk@gentoo.org>
diff --git a/deprecated/moo/README b/deprecated/moo/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/moo/README
diff --git a/deprecated/moo/TODO b/deprecated/moo/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/moo/TODO
diff --git a/deprecated/moo/moo b/deprecated/moo/moo
new file mode 100755
index 0000000..828df08
--- /dev/null
+++ b/deprecated/moo/moo
@@ -0,0 +1,244 @@
+#! /usr/bin/env python2.2
+
+import os
+import sys
+import time
+import signal
+
+CONFDIR="/tmp/moo"
+
+class Config:
+ pass
+
+def die(code, msg):
+ sys.stdout.write(msg + "\n")
+ sys.edit(code)
+
+def printUsage():
+ print "Usage: moo <options> [command] <command-options>\n" + \
+ "Where [command] is one of:\n" + \
+ "scan - scan for available networks\n" + \
+ "list - list available profiles\n"+ \
+ "select - select a particular profile\n"
+
+def scanNetworks():
+ pass
+
+def runCmd(cmd):
+ if Config.verbosity > 5:
+ print "Executing \"" + cmd + "\""
+ v = os.system(cmd)
+ if Config.verbosity > 5:
+ print "Result: " + str(v)
+ return v
+
+class ProfileHandler:
+ def __init__(self):
+ self.profiles = {}
+ self._loadProfiles()
+ def _loadProfiles(self):
+ for x in os.listdir(CONFDIR+"/profiles"):
+ if x[-1] != "~" and x[0] != ".":
+ self.profiles[x] = Profile(CONFDIR+"/profiles/"+x)
+ def listProfiles(self,detailed=0):
+ for x in self.profiles.keys():
+ if detailed:
+ print x + ":"
+ self.profiles[x].dump()
+ else:
+ print x + " [" + self.profiles[x].description + "]"
+ def getProfileNames(self):
+ return self.profiles.keys()
+ def getProfile(self,name):
+ return self.profiles[name]
+
+
+class Profile:
+ def __init__(self, filename):
+ self._loadFromFile(filename)
+ def _loadFromFile(self,filename):
+ self.desc = ""
+ self.ifaceName = ""
+ self.ip = ""
+ self.broadcast = ""
+ self.gateway = ""
+ self.exclusive = "no"
+ self.netmask = ""
+ self.nameserver = ""
+
+ ins = open(filename)
+ for s in ins.readlines():
+ for x in ["description","ifaceName","ip","broadcast",
+ "gateway","exclusive","nameserver","wepkey"]:
+ if s.find(x+"=") == 0:
+ val=s.replace(x+"=","").strip()
+ self.__dict__[x] = val
+ def dump(self):
+ print "description = " + self.description + "\n" + \
+ "iface = " + self.ifaceName + "\n" + \
+ "ip = " + self.ip + "\n" + \
+ "broadcast = " + self.broadcast + "\n" + \
+ "gateway = " + self.gateway + "\n" + \
+ "gateway = " + self.nameserver + "\n" + \
+ "exclusive = " + self.exclusive + "\n"
+
+class Interface:
+ def __init__(self, name):
+ self.name = name
+ self.netmask = ""
+ self.broadcast = ""
+ self.ip = ""
+ self.gateway = ""
+ self.nameserver = ""
+ self.wepkey = ""
+ self._loadIPV4Info()
+ def _loadIPV4Info(self):
+ pass
+ def getNameserver(self):
+ return self.nameserver
+ def getNetmask(self):
+ return self.netmask
+ def getName(self):
+ return self.name
+ def getBroadcast(self):
+ return self.broadcast
+ def getWEPKey(self):
+ return self.wepkey
+ def getGateway(self):
+ return self.gateway
+ def setNameserver(self,nameserver):
+ self.nameserver = nameserver
+ def setIP(self, ip):
+ self.ip = ip
+ def setWEPKey(self,key):
+ self.wepkey = key
+ def setGateway(self,gw):
+ self.gateway = gw
+ def setBroadcast(self,broadcast):
+ self.broadcast = broadcast
+ def setNetmask(self,netmask):
+ self.netmask = netmask
+ def runDHCP(self):
+ runCmd("dhcpcd " + self.name)
+ def down(self):
+ runCmd("ifconfig " + self.name + " down")
+ pidFile = "/var/run/dhcpcd-" + self.name + ".pid"
+ if os.path.exists(pidFile):
+ ins = open(pidFile)
+ pid = int(ins.readline())
+ os.kill(pid,signal.SIGTERM)
+ time.sleep(1)
+ def up(self):
+ options = ""
+
+ if self.wepkey:
+ if runCmd("iwconfig eth1 key " + self.wepkey):
+ die(4, "Failed to set WEP key for " + self.name)
+
+ if self.ip:
+ options += self.ip + " "
+ if self.broadcast:
+ options += "broadcast " + self.broadcast + " "
+ if self.netmask:
+ options += "netmask " + self.netmask + " "
+
+ if runCmd("ifconfig " + self.name + " " + options + " up"):
+ die(2, "Failed to bring up " + self.name)
+
+ if self.gateway:
+ if runCmd("route add default gw " + self.gateway + " " + self.name):
+ die(3, "Failed to set default gateway for " + self.name)
+
+ if self.nameserver:
+ if Config.verbosity > 5:
+ print("Using nameserver " + self.nameserver)
+ try:
+ ous = open("/etc/resolv.conf","w")
+ ous.write("nameserver " + self.nameserver)
+ ous.close()
+ except OSError:
+ die("Failed to set nameserver")
+ if Config.verbosity > 3:
+ print "Brough interface " + self.name + " up"
+
+class InterfaceHandler:
+ def __init__(self):
+ self.ifaces = {}
+ self._loadAllInterfaces()
+ def _loadAllInterfaces(self):
+ ins=open("/proc/net/dev")
+ for line in ins.readlines():
+ tokens = line.split(":")
+ if len(tokens) > 1:
+ ifaceName = tokens[0].strip()
+ iface = Interface(ifaceName)
+ self.ifaces[ifaceName] = iface
+ def getInterface(self,ifaceName):
+ return self.ifaces[ifaceName]
+ def downAll(self):
+ for x in self.ifaces.values():
+ if x.getName() != "lo":
+ x.down()
+
+class Moo:
+ def __init__(self):
+ self.profileHandler = ProfileHandler()
+ self.ifaceHandler = InterfaceHandler()
+
+ def selectProfile(self,profile):
+ prof = self.profileHandler.getProfile(profile)
+
+ if prof.exclusive == "yes":
+ self.ifaceHandler.downAll()
+
+ iface = self.ifaceHandler.getInterface(prof.ifaceName)
+
+ if prof.ip == "dhcp":
+ iface.runDHCP()
+ else:
+ iface.setIP(prof.ip)
+ iface.setBroadcast(prof.broadcast)
+ iface.setNetmask(prof.netmask)
+ iface.setGateway(prof.gateway)
+ iface.setNameserver(prof.nameserver)
+ iface.up()
+
+ def listProfiles(self,detailed=0):
+ self.profileHandler.listProfiles(detailed)
+
+def initConfig():
+ Config.verbosity = 3
+
+def main():
+
+ initConfig()
+
+ if len(sys.argv) < 2:
+ printUsage()
+ sys.exit(1)
+
+ moo = Moo()
+
+ for i in xrange(len(sys.argv)):
+ if sys.argv[i] == "list":
+ detailed = 0
+ for x in sys.argv[i:]:
+ if x == "--detailed":
+ detailed = 1
+ moo.listProfiles(detailed)
+
+ elif sys.argv[i] == "select":
+ moo.selectProfile(sys.argv[2])
+
+if __name__ == "__main__":
+ main()
+
+
+# TODO
+# - automatically create profile
+# - specify wireless network name
+# - specify wep key
+# - specify access point
+# - specify pre_run/post_run commands
+# - with parameters
+#
diff --git a/deprecated/moo/moo.1 b/deprecated/moo/moo.1
new file mode 100644
index 0000000..534aa0c
--- /dev/null
+++ b/deprecated/moo/moo.1
@@ -0,0 +1,12 @@
+.TH moo "1" "Nov 2003" "gentoolkit"
+.SH NAME
+moo \- Gentoo: Configuration Update Utility
+.SH SYNOPSIS
+.B moo
+.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>.
+
diff --git a/deprecated/old-scripts/Makefile b/deprecated/old-scripts/Makefile
new file mode 100644
index 0000000..8f61cb5
--- /dev/null
+++ b/deprecated/old-scripts/Makefile
@@ -0,0 +1,32 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+all:
+ echo "BOTOLPHS Huge benign tumors which archdeacons and old chemistry teachers affect to wear on the sides of their noses."
+
+dist:
+ mkdir -p ../../$(distdir)/src/old-scripts/
+ cp Makefile ../../$(distdir)/src/old-scripts/
+ cp dep-clean dep-clean.1 ../../$(distdir)/src/old-scripts/
+ cp pkg-clean pkg-clean.1 ../../$(distdir)/src/old-scripts/
+ cp ewhich ewhich.1 ../../$(distdir)/src/old-scripts/
+ cp mkebuild mkebuild.1 ../../$(distdir)/src/old-scripts/
+ cp pkg-size pkg-size.1 ../../$(distdir)/src/old-scripts/
+
+install:
+ install -m 0755 dep-clean $(bindir)/
+ install -m 0755 pkg-clean $(sbindir)/
+ install -m 0755 ewhich $(bindir)/
+ install -m 0755 mkebuild $(sbindir)/
+ install -m 0755 pkg-size $(bindir)/
+
+ install -m 0644 dep-clean.1 $(mandir)/
+ install -m 0644 pkg-clean.1 $(mandir)/
+ install -m 0644 ewhich.1 $(mandir)/
+ install -m 0644 mkebuild.1 $(mandir)/
+ install -m 0644 pkg-size.1 $(mandir)/
diff --git a/deprecated/old-scripts/dep-clean b/deprecated/old-scripts/dep-clean
new file mode 100644
index 0000000..89c6364
--- /dev/null
+++ b/deprecated/old-scripts/dep-clean
@@ -0,0 +1,272 @@
+#!/bin/bash
+#Shows unrequired packages and missing dependencies.
+#Author/Maintainer: Brandon Low <lostlogic@gentoo.org>
+#Author: Jerry Haltom <ssrit@larvalstage.net>
+
+echo
+echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated."
+echo -e "!!!\x1b[0;0m Please refer to 'emerge clean' and 'emerge depclean' for replacements."
+echo
+
+PROG=`basename ${0}`
+
+tmp="/tmp/$$"
+
+#Get PORTDIR and PORTDIR_OVERLAY from portage
+PORTDIR_OVERLAY="$(/usr/lib/portage/bin/portageq portdir_overlay)"
+PORTDIR="$(/usr/lib/portage/bin/portageq portdir)"
+
+rm -rf ${tmp} > /dev/null 2>&1
+mkdir ${tmp} > /dev/null 2>&1
+
+declare -i i
+
+set -- `getopt -n ${PROG} -o N,R,U,I,v,q,C,h -l needed,removed,unneeded,interactive,verbose,quiet,nocolor,help -- ${*/ --/};[ $? != 0 ] && echo "y"`
+
+while [ ${#} -gt 0 ]
+do
+ a=${1}
+ shift
+ case "${a}" in
+
+ -I|--interactive)
+ interactive=y
+ ;;
+
+ -N|--needed)
+ needed=y
+ ;;
+
+ -U|--unneeded)
+ unneeded=y
+ ;;
+
+ -R|--removed)
+ removed=y
+ ;;
+
+ -v|--verbose)
+ verb=y
+ ;;
+
+ -q|--quiet)
+ quiet=y
+ ;;
+
+ -C|--nocolor)
+ nocolor=y
+ ;;
+
+ -h|--help)
+ usage=y
+ ;;
+
+ --)
+ [ ${1} ] && usage=y && broke=y
+ break
+ ;;
+
+ *)
+ usage=y
+ broke=y
+ echo "FIXME - OPTION PARSING - ${a}"
+ break
+ ;;
+
+ esac
+done
+
+if [ ! ${needed} ] && [ ! ${unneeded} ] && [ ! ${removed} ]; then
+ needed=y
+ unneeded=y
+ removed=y
+fi
+
+#Set up colors
+if [ ! "${nocolor}" ]; then
+ NO="\x1b[0;0m"
+ BR="\x1b[0;01m"
+ CY="\x1b[36;01m"
+ GR="\x1b[32;01m"
+ RD="\x1b[31;01m"
+ YL="\x1b[33;01m"
+ BL="\x1b[34;01m"
+elif [ ${quiet} ] && (
+ ( [ ${needed} ] && [ ${unneeded} ] ) ||
+ ( [ ${unneeded} ] && [ ${removed} ] ) ||
+ ( [ ${removed} ] && [ ${needed} ] )
+ ); then
+ NEED=" N"
+ UNNE=" U"
+ REMO=" R"
+fi
+
+if [ ${usage} ]; then
+ echo -e "${BR}GenToolKit's Dependency Checker!
+${NO}Displays packages that are installed but which none
+of the packages in world or system depend on, and
+displays packages which are depended on by world or
+system, but are not currently installed.
+
+${BR}USAGE:
+ ${BL}${PROG}${YL} [${NO}options${YL}]${NO}
+ ${BL}${PROG}${GR} --help${NO}
+
+${BR}OPTIONS:
+ ${GR}-U, --unneeded${NO} display unneeded packages that are installed (${GR}green${NO})
+ ${GR}-N, --needed${NO} display needed packages that are not installed (${RD}red${NO})
+ ${GR}-R, --removed${NO} display installed packages not in portage (${YL}yellow${NO})
+
+ ${GR}-I, --interactive${NO} interactively modify world file before proceeding
+ ${GR}-C, --nocolor${NO} output without color, if necessary, package types are
+ noted with ${GR}U, N${NO} and ${GR}R${NO} respectively
+ ${GR}-v, --verbose${NO} be more verbose
+ ${GR}-q, --quiet${NO} be quiet (just output the packages, no extra info)
+
+${BR}NOTES:
+ ${GR}*${NO} If this script is run on a system that is not up-to-date or which hasn't
+ been cleaned (with '${BL}emerge -c${NO}') recently, the output may be deceptive.
+ ${GR}*${NO} If the same package name appears in all three categories, then it is
+ definitely time to update that package and then run '${BL}emerge -c${NO}'.
+ ${GR}*${NO} The ${GR}-U, -N${NO} and ${GR}-R${NO} options may be combined, defaults to ${GR}-UNR${NO}"
+ rm -rf ${tmp} > /dev/null 2>&1
+ [ ${broke} ] && exit 1 || exit 0
+fi
+
+X="\([^/]*\)"
+
+#Retrieve currently merged packages.
+if [ ${verb} ];then
+ echo -e "${CY}Retrieving currently merged packages.${NO}"
+fi
+find /var/db/pkg/ -name '*.ebuild' | \
+ sed -e "s:/var/db/pkg/::" \
+ -e "s:${X}/${X}/${X}:\1/\2:" | \
+ sort -u >> ${tmp}/current
+
+if [ ${verb} ]; then
+ echo -e "${CY}"`cat ${tmp}/current | wc -l` "currently merged packages.${NO}"
+ echo -e
+fi
+
+#Retrieve system packages and add to image.
+if [ ${verb} ];then
+ echo -e "${CY}Retrieving system packages.${NO}"
+fi
+emerge system -ep | \
+ sed -e "/ebuild/s:^.*] \([^ ]*\) *:\1:p;d" | \
+ sort -u \
+ > ${tmp}/system
+
+if [ ${verb} ]; then
+ echo -e "${CY}"`cat ${tmp}/system | wc -l 2> /dev/null` "packages contained in system.${NO}"
+ echo -e
+ echo -e "${CY}Preparing world file.${NO}"
+fi
+
+#Create local copy of world and ask user to verify it.
+cp /var/cache/edb/world ${tmp}/world
+
+if [ ${interactive} ]; then
+ ${EDITOR} ${tmp}/world
+fi
+
+#Retrieve world packages and dependencies and add to image.
+if [ ${verb} ]; then
+ echo -e
+ echo -e "${CY}Preparing list of installed world packages.${NO}"
+ echo -e
+fi
+
+cat ${tmp}/current | grep -f ${tmp}/world | sort > ${tmp}/world.inst
+find ${PORTDIR} ${PORTDIR_OVERLAY} -iname '*.ebuild' | \
+ awk -F'/' '{printf("%s/%s\n", $(NF-2), $NF)}' | \
+ sed -e 's:\.ebuild::' > ${tmp}/ebuilds
+grep -xf ${tmp}/world.inst ${tmp}/ebuilds >> ${tmp}/world.new
+
+if [ ${verb} ]; then
+ echo -e "${CY}"`cat ${tmp}/ebuilds | wc -l`"\tebuilds available.${NO}"
+ echo -e "${CY}"`cat ${tmp}/world.new | wc -l`"\tpackages contained in final world file.${NO}"
+ echo -e
+ echo -e "${CY}List prepared, checking dependencies with emerge -ep${NO}"
+fi
+
+sort ${tmp}/world.new |sed -e 's:^:\\\=:' | uniq | xargs emerge -ep | \
+ tee ${tmp}/log | sed -e '/ebuild/s:^.*] \([^ ]*\) *$:\1:p;d' > ${tmp}/image.unsorted
+
+depends=`cat ${tmp}/image.unsorted|wc -l`
+
+if [ ${depends} -lt "2" ]; then
+ echo -e "${RD}There appears to be an unresolved dependency in your world file."
+ echo -e "Please check for masking errors or other world file issues,"
+ echo -e "and then try again."
+ echo -e
+ echo -e "The following is the emerge output for your reference:${NO}"
+ cat ${tmp}/log
+ rm -rf ${tmp} > /dev/null 2>&1
+ exit 1
+fi
+
+cat ${tmp}/system >> ${tmp}/image.unsorted
+
+#Cleanup image
+sort -u ${tmp}/image.unsorted > ${tmp}/image
+
+if [ ${verb} ];then
+ echo -e "${CY}"`cat ${tmp}/image | wc -l` "packages contained in final image.${NO}"
+ echo -e
+fi
+
+#Determine packages that exist in current but not in image.
+#These packages are safe to clean up.
+if [ ${unneeded} ]; then
+ if [ ! ${quiet} ]; then
+ echo -e "${CY}These packages have no other packages depending on them.${NO}"
+ fi
+
+ grep -vxf ${tmp}/image ${tmp}/current > ${tmp}/unneeded
+ for line in `cat ${tmp}/unneeded`;do
+ echo -e "${GR}${line}${CY}${UNNE}${NO}"
+ done
+
+ if [ ! ${quiet} ];then
+ echo -e "${CY}Total of"`cat ${tmp}/unneeded|wc -l` "unneeded packages.${NO}"
+ fi
+fi
+
+#Determine packages that exist in image but not in current.
+#These packages should be added.
+if [ ${needed} ]; then
+ if [ ! ${quiet} ];then
+ echo -e
+ echo -e "${CY}These packages are depended upon but are not present on the system.${NO}"
+ fi
+
+ grep -vxf ${tmp}/current ${tmp}/image > ${tmp}/needed
+ for line in `cat ${tmp}/needed`;do
+ echo -e "${RD}${line}${CY}${NEED}${NO}"
+ done
+
+ if [ ! ${quiet} ];then
+ echo -e "${CY}Total of"`cat ${tmp}/needed|wc -l` "needed packages.${NO}"
+ fi
+fi
+
+#Determine packages that are installed but not currently in portage
+if [ ${removed} ]; then
+ if [ ! ${quiet} ];then
+ echo -e
+ echo -e "${CY}These packages are installed but not in the portage tree.${NO}"
+ fi
+ grep -xf ${tmp}/current ${tmp}/ebuilds > ${tmp}/hascurrent
+ grep -vxf ${tmp}/hascurrent ${tmp}/current > ${tmp}/removed
+ for line in `cat ${tmp}/removed`;do
+ echo -e "${YL}${line}${CY}${REMO}${NO}"
+ done
+
+ if [ ! ${quiet} ];then
+ echo -e "${CY}Total of"`cat ${tmp}/removed|wc -l` "removed packages.${NO}"
+ fi
+fi
+
+rm -rf ${tmp} > /dev/null 2>&1
diff --git a/deprecated/old-scripts/dep-clean.1 b/deprecated/old-scripts/dep-clean.1
new file mode 100644
index 0000000..9747ce4
--- /dev/null
+++ b/deprecated/old-scripts/dep-clean.1
@@ -0,0 +1,190 @@
+.\" 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 \- Gentoo: 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
+.IX Item "-N, --needed"
+Display needed packages that are not installed. (red) (default)
+.Ip "\-R, \-\-removed" 4
+.IX Item "-R, --removed"
+Display installed packages not in portage. (yellow) (default)
+.Ip "\-U, \-\-unneeded" 4
+.IX Item "-U, --unneeded"
+Display unneeded packages that are installed. (green) (default)
+.Ip "\-I, \-\-interactive" 4
+.IX Item "-I, --interactive"
+Interactively modify world file before proceeding.
+.Ip "\-C, \-\-nocolor" 4
+.IX Item "-C, --nocolor"
+Output without color. Package types will be noted with R, U and N.
+.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)
diff --git a/deprecated/old-scripts/ewhich b/deprecated/old-scripts/ewhich
new file mode 100755
index 0000000..345ec34
--- /dev/null
+++ b/deprecated/old-scripts/ewhich
@@ -0,0 +1,44 @@
+#!/usr/bin/python
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+#
+# Author: Marius Mauch <genone@gentoo.org>
+#
+# ewhich is a tool to get the ebuild filename for a given package name
+
+import portage,sys,os
+from output import *
+
+sys.stderr.write("\n" + red("!!!") + " As of Gentoolkit 0.2.0 this tool is deprecated\n")
+sys.stderr.write(red("!!!") + " Refer to 'equery which' for a replacement\n\n")
+
+def print_help():
+ print
+ print fuscia(os.path.basename(sys.argv[0])), "is a tool to get the filename of the ebuild for a given package"
+ print ' '*len(os.path.basename(sys.argv[0])), "that would be used by portage with the current configuration"
+ print
+ print yellow("Syntax:"), os.path.basename(sys.argv[0]), teal("<package>")
+ print
+ print teal("<package>"), "is either a simple package name (like "+green("xfree")+"),"
+ print " a package name with category (like "+green("x11-base/xfree")+")"
+ print " or a DEPEND style atom as defined in ebuild(5) (like "+green(">=x11-base/xfree-4.3.0")+")"
+ print
+
+if len(sys.argv) <= 1 or sys.argv[1] == "-h" or sys.argv[1] == "--help":
+ print_help()
+ sys.exit(0)
+
+p = portage.db[portage.root]["porttree"].dbapi.xmatch("bestmatch-visible", sys.argv[1])
+if len(p) <= 1:
+ print
+ print red("*"), "\""+sys.argv[1]+"\" is not a valid package name or a masked package"
+ print
+ sys.exit(1)
+pv = portage.catpkgsplit(p)
+ebuild = "/"+pv[0]+"/"+pv[1]+"/"+p.split("/")[1]+".ebuild"
+for ov in portage.settings["PORTDIR_OVERLAY"].split():
+ if os.path.exists(ov+ebuild):
+ print os.path.normpath(ov+ebuild)
+ sys.exit(0)
+print os.path.normpath(portage.settings["PORTDIR"]+ebuild)
diff --git a/deprecated/old-scripts/ewhich.1 b/deprecated/old-scripts/ewhich.1
new file mode 100644
index 0000000..4bc5459
--- /dev/null
+++ b/deprecated/old-scripts/ewhich.1
@@ -0,0 +1,24 @@
+.TH ewhich 1 "October 19, 2003" "ewhich"
+
+.SH NAME
+ewhich \- Gentoo: program for resolving ebuild names
+
+.SH SYNOPSIS
+.B ewhich
+[ -h | --help ] <package>
+
+.SH DESCRIPTION
+.B ewhich
+is a little tool to find the actual ebuild file for a given package name.
+It can use simple package names (like xfree), package names with category
+(like x11-base/xfree) or DEPEND atoms (like >=x11-base/xfree-4.3.0).
+
+.SH BUGS
+.B ewhich
+No known bugs
+
+.SH SEE ALSO
+emerge(1), make.conf(5), ebuild(5)
+
+.SH AUTHOR
+Marius Mauch <genone@gentoo.org>
diff --git a/deprecated/old-scripts/mkebuild b/deprecated/old-scripts/mkebuild
new file mode 100644
index 0000000..9ee0ce1
--- /dev/null
+++ b/deprecated/old-scripts/mkebuild
@@ -0,0 +1,216 @@
+#!/bin/bash
+
+# Copyright (c) 2002
+# John Stalker
+# Department of Mathematics
+# Princeton University
+
+echo
+echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated"
+echo -e "!!!\x1b[0;0m Refer to app-portage/ebuilder for a replacement."
+echo
+
+CONFIG_FILE=${HOME}/.mkebuild
+if [ -e $CONFIG_FILE ]
+then
+ source $CONFIG_FILE
+else
+ echo This appears to be the first time you have used mkebuild.
+ echo I am going to make some guesses. If any of these are wrong
+ echo you should edit the file ${CONFIG_FILE}.
+ echo
+ MY_NAME=`awk -F":" '/^'${USER}:'/ { print $5 }' /etc/passwd`
+ echo Your name is ${MY_NAME}.
+ echo 'MY_NAME="'${MY_NAME}'"' >${CONFIG_FILE}
+ COPYRIGHT="Gentoo Technologies, Inc."
+ echo You wish to asign copyright to ${COPYRIGHT}
+ echo 'COPYRIGHT="'${COPYRIGHT}'"' >>${CONFIG_FILE}
+ MY_EMAIL=${USER}"@"${HOSTNAME}
+ echo Your email address is ${MY_EMAIL}.
+ echo 'MY_EMAIL='${MY_EMAIL} >>$CONFIG_FILE
+ LICENSE="the GNU General Public License, v2"
+ echo Your preferred license is ${LICENSE}.
+ echo 'LICENSE="'${LICENSE}'"' >>${CONFIG_FILE}
+ LOCAL_SOURCE=${HOME}
+ echo You download sources to ${LOCAL_SOURCE}.
+ echo LOCAL_SOURCE=${LOCAL_SOURCE} >>${CONFIG_FILE}
+ BUILD_DIRECTORY=${HOME}
+ echo You build packages in ${BUILD_DIRECTORY}.
+ echo 'BUILD_DIRECTORY='${BUILD_DIRECTORY} >>${CONFIG_FILE}
+ echo
+fi
+FILE_NAME=`basename $1`
+SOURCE_LOCATION=`dirname $1`
+PACKAGE_NAME=${FILE_NAME%.*}
+FILE_EXTENSION=${FILE_NAME##*.}
+if [ "${PACKAGE_NAME##*.}" = "tar" ]
+then
+ FILE_EXTENSION=tar.${FILE_EXTENSION}
+ PACKAGE_NAME=${PACKAGE_NAME%.tar}
+fi
+EBUILD_FILE=${PWD}/${PACKAGE_NAME}.ebuild
+echo "# Copyright" `date +"%Y"` ${COPYRIGHT} >${EBUILD_FILE}
+echo "# Distributed under the terms of" ${LICENSE} >>${EBUILD_FILE}
+#echo "# Author" ${MY_NAME} '<'${MY_EMAIL}'>' >>${EBUILD_FILE}
+echo "# \$Header$" >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo 'DESCRIPTION=""' >>${EBUILD_FILE}
+echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE}
+echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE}
+echo 'LICENSE=""' >>${EBUILD_FILE}
+echo 'SLOT="0"' >>${EBUILD_FILE}
+echo 'KEYWORDS="~x86"' >>${EBUILD_FILE}
+echo 'IUSE=""' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo 'DEPEND=""' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo '#RDEPEND=""' >>${EBUILD_FILE}
+echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo 'src_unpack() {' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo -e "\t"'unpack ${A}' >>${EBUILD_FILE}
+echo -e "\t"'cd ${S}' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo '}' >>${EBUILD_FILE}
+if [ -e ${LOCAL_SOURCE}/${FILE_NAME} ]
+then
+ echo I am assuming that $1 really
+ echo exists and that ${LOCAL_SOURCE}/${FILE_NAME}
+ echo is a faithful copy.
+else
+ echo I didn\'t find ${LOCAL_SOURCE}/${FILE_NAME} so I will fetch
+ echo $1.
+ cd ${LOCAL_SOURCE}
+ wget $1
+fi
+if [ -e ${BUILD_DIRECTORY}/${PACKAGE_NAME} ]
+then
+ echo
+ echo I am assuming that ${BUILD_DIRECTORY}/${PACKAGE_NAME} \
+ is the unpacked
+ echo version of ${LOCAL_SOURCE}/${FILE_NAME}.
+else
+ cd ${BUILD_DIRECTORY}
+ if [ $? -ne 0 ]
+ then
+ echo
+ echo I was unable to enter the directory ${BUILD_DIRECTORY}.
+ exit 1
+ fi
+ case "${FILE_EXTENSION}" in
+ tar.gz|tgz)
+ tar xzf ${LOCAL_SOURCE}/${FILE_NAME}
+ ;;
+ tar.bz2|tbz2)
+ tar xjf ${LOCAL_SOURCE}/${FILE_NAME}
+ ;;
+ tar.Z|tar.z)
+ unzip ${LOCAL_SOURCE}/${FILE_NAME}
+ tar xf ${PACKAGE_NAME}.tar
+ ;;
+ *)
+ echo
+ echo I can\'t figure out how to uncompress
+ echo ${LOCAL_SOURCE}/${FILE_NAME}
+ exit 1
+ esac
+ if [ $? -ne 0 ]
+ then
+ echo
+ echo I was unable to uncompress ${LOCAL_SOURCE}/${FILE_NAME}.
+ exit 1
+ fi
+fi
+cd ${BUILD_DIRECTORY}/${PACKAGE_NAME}
+if [ $? -ne 0 ]
+then
+ echo
+ echo I could not change directory to ${BUILD_DIRECTORY}/${PACKAGE_NAME}
+ exit 1
+fi
+echo
+echo You might want to look at the following files for configuration and
+echo dependency information:
+find ${PWD} -name README -print
+find ${PWD} -name README.txt -print
+find ${PWD} -name INSTALL -print
+find ${PWD} -name INSTALL.txt -print
+find ${PWD} -name Changes -print
+find ${PWD} -name CHANGES.txt -print
+find ${PWD} -name FAQ.txt
+find ${PWD} -name ChangeLog -print
+find ${PWD} -name NEWS -print
+echo >>${EBUILD_FILE}
+echo 'src_compile() {' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo
+if [ -e Imakefile ]
+then
+ echo I found an Imakefile. I am assuming that we should use xmkmf.
+ echo I don\'t really understand xmkmf so you will have to configure
+ echo things on your own.
+ echo
+ echo -e "\t"'xmkmf || die' >>${EBUILD_FILE}
+ echo -e "\tmake Makefiles" >>${EBUILD_FILE}
+ echo -e "\tmake includes" >>${EBUILD_FILE}
+ echo -e "\tmake depend" >>${EBUILD_FILES}
+elif [ -e configure ]
+then
+ echo I found a configure file. I am assuming that we are using autoconf
+.
+ echo I will take care of setting the most commonly used options. I am
+ echo including a list of all the available options to confiigure, commen
+ted
+ echo out. You might want to look it over to see if I have missed anythi
+ng.
+ echo
+ ./configure --help >.config.options
+ echo -e "\t./configure \\" >>${EBUILD_FILE}
+ awk '/--prefix/ { print "\t\t--prefix=/usr \\"}' \
+ .config.options >>${EBUILD_FILE}
+ awk '/--infodir/ { print "\t\t--infodir=/usr/share/info \\"}' \
+ .config.options >>${EBUILD_FILE}
+ awk '/--mandir/ { print "\t\t--mandir=/usr/share/man \\"}' \
+ .config.options >>${EBUILD_FILE}
+ echo -e "\t\t"'|| die "./configure failed"' >>${EBUILD_FILE}
+ echo -e "#\tAvailable options to configure:" >>${EBUILD_FILE}
+ awk '/--/ { print "#" $0 }' .config.options >>${EBUILD_FILE}
+ echo -e "\t"'emake || die' >>${EBUILD_FILE}
+elif [ -e Makefile ]
+then
+ echo I found a Makefile. You should look at it and possibly prepare
+ echo a patch.
+ echo
+ echo -e "\temake || die" >>${EBUILD_FILE}
+else
+ echo I couldn\'t find a Imakefile, configure script, or Makefile for
+ echo this package. You will have to figure out what to do on your
+ echo own.
+ echo
+fi
+echo '}' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo 'src_install () {' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo -e "\t"'make DESTDIR=${D} install || die' >>${EBUILD_FILE}
+echo '}' >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo >>${EBUILD_FILE}
+echo I couldn\'t supply a package description for the ebuild file
+echo because I don\'t know what ${PACKAGE_NAME} does.
+echo
+echo I am assume the hompage for this package is ${SOURCE_LOCATION}/.
+echo If that is not correct you will need to edit that portion of
+echo the ebuild file as well.
+echo
+echo I don\'t understand dependencies yet. You will have to add any
+echo dependencies you know of by hand. Then try your ebuild script
+echo out to see if there are any dependencies you don\'t know of.
+echo
+echo I am assuming that this package comes with a well-behaved Makefile
+echo which does not install anything outside of '${DESTDIR}'. You will
+echo need to check this by looking at the portion of the Makefile
+echo beginning with the line '"install:"'.
+
diff --git a/deprecated/old-scripts/mkebuild.1 b/deprecated/old-scripts/mkebuild.1
new file mode 100644
index 0000000..e800d4d
--- /dev/null
+++ b/deprecated/old-scripts/mkebuild.1
@@ -0,0 +1,20 @@
+.TH mkebuild "1" "Nov 2003" "gentoolkit"
+.SH NAME
+mkebuild \- Gentoo: Interactive ebuild generator
+.SH SYNOPSIS
+.B mkebuild
+.SH BUGS
+This tool is obsolete, as of gentoolkit 0.2.0.
+Use ebuilder [app\-portage/ebuilder] instead.
+.SH SEE ALSO
+.BR ebuilder(1)
+.br
+.BR /usr/sbin/ebuilder
+.br
+.BR /usr/sbin/mkebuild
+
+.SH AUTHORS
+This informative man page was written by Karl Trygve Kalleberg
+<karltk@gentoo.org> and expanded by Katerina Barone\-Adesi
+<katerinab@gmail.com>.
+
diff --git a/deprecated/old-scripts/pkg-clean b/deprecated/old-scripts/pkg-clean
new file mode 100644
index 0000000..9b07337
--- /dev/null
+++ b/deprecated/old-scripts/pkg-clean
@@ -0,0 +1,107 @@
+#!/usr/bin/python
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+# Author: Leo Lipelis <aeoo@gentoo.org>
+# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
+
+import commands
+import re
+import sys
+import time
+import os
+from output import *
+
+print
+print red("!!! As of Gentoolkit 0.2.0, this tool is deprecated")
+print red("!!!") + " Refer to 'emerge clean' and 'emerge depclean' for replacements."
+print
+
+time.sleep(4)
+
+# constants for package tuples that are stored in pkg_hash
+PKG_TIME = 0 # number of seconds for ctime function
+PKG = 1 # package full path as accepted by ebuild
+PKG_NAME = 2 # package name as accepted by emerge
+
+(status, pkg_files) = commands.getstatusoutput(
+ "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n")
+
+pkg_file_list = pkg_files.splitlines()
+
+pkg_hash = {}
+for time_pkg_pair in pkg_file_list:
+ (pkg_time, pkg) = time_pkg_pair.split()
+ pkg_time = int(pkg_time)
+ # This covers developer trees with not-accepted categories
+ tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg)
+ if not tmp_name: continue
+ pkg_name = tmp_name.group(1)
+ tmp_core = re.match(r'(.*)-\d.*', pkg_name)
+ if not tmp_core: continue
+ pkg_core = tmp_core.group(1)
+ if pkg_hash.has_key(pkg_core):
+ pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name))
+ else:
+ pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)]
+
+total_len = len(pkg_hash.keys())
+curpkg = 0
+tmpname = os.tmpnam()
+assume_yes = 0
+
+if len(sys.argv) > 1:
+ if sys.argv[1] in ["-y", "--yes"]:
+ assume_yes = 1
+ elif sys.argv[1] in ["-h", "--help"]:
+ print """pkg-clean [options]
+
+-y, --yes Don't ask for individual confirmation before unmerging; assume yes.
+"""
+ sys.exit(0)
+
+for pkg_core in pkg_hash.keys():
+ print "Examining %s:" % (pkg_core)
+ if len(pkg_hash[pkg_core]) < 2:
+ continue
+ unmerged_indexes = []
+
+ curpkg += 1
+ choices = ""
+ idx = 1
+ for pkg_tuple in pkg_hash[pkg_core]:
+ choices += " %d \"%s %s\" 0" % \
+ (idx, time.ctime(pkg_tuple[PKG_TIME]),
+ pkg_tuple[PKG_NAME])
+ idx += 1
+
+ params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len)
+ params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices
+ res = os.system(params + " 2> " + tmpname)
+ if res:
+ sys.exit(0)
+
+ ins = open(tmpname)
+ for j in ins.readlines():
+ idx = int(j)
+ if idx == 0:
+ break
+
+ full_path = pkg_hash[pkg_core][idx-1][PKG]
+ ebuild = full_path.replace('/var/db/pkg','')
+
+ if not assume_yes:
+ params = "dialog --backtitle \"" + ebuild + "\" " + \
+ "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70"
+ res = os.system(params)
+ else:
+ res = 0
+
+ if res == 0:
+ (status, unmerge_out) = commands.getstatusoutput(
+ "ebuild %s unmerge" % (full_path))
+ print unmerge_out
+ time.sleep(2)
+ if status != 0:
+ sys.exit(status)
+ ins.close()
diff --git a/deprecated/old-scripts/pkg-clean.1 b/deprecated/old-scripts/pkg-clean.1
new file mode 100644
index 0000000..7a295f3
--- /dev/null
+++ b/deprecated/old-scripts/pkg-clean.1
@@ -0,0 +1,20 @@
+.TH pkg\-clean "1" "Nov 2003" "gentoolkit"
+.SH NAME
+pkg\-clean \- Gentoo: Clean obsolete packages
+.SH SYNOPSIS
+.B pkg\-clean
+.SH BUGS
+This tool is obsolete, as of gentoolkit 0.2.0.
+Use 'emerge clean' or 'emerge depclean' (with caution; read the man page)
+instead.
+
+.SH SEE ALSO
+.BR emerge(1)
+.br
+.BR /usr/sbin/pkg\-clean
+
+.SH AUTHORS
+This informative man page was written by Karl Trygve Kalleberg
+<karltk@gentoo.org> and expanded by Katerina Barone\-Adesi
+<katerinab@gmail.com>.
+
diff --git a/deprecated/old-scripts/pkg-size b/deprecated/old-scripts/pkg-size
new file mode 100644
index 0000000..8770db7
--- /dev/null
+++ b/deprecated/old-scripts/pkg-size
@@ -0,0 +1,63 @@
+#!/bin/sh
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
+
+echo
+echo -e "\x1b[31;01m!!! As of Gentoolkit 0.2.0, this tool is deprecated."
+echo -e "!!!\x1b[0;0m Refer to 'equery size' for a replacement."
+echo
+
+spec=$1
+
+if [ -z "$spec" ] ; then
+ echo "Usage: pkg-size package"
+ exit 1
+fi
+
+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::"`
+
+totals=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /" | xargs du -scb | grep total | cut -f 1`
+
+size=0
+for i in $totals ; do
+ size=$[size+i]
+done
+
+echo "$pkgname $size ($[size/1024]KB)"
+
diff --git a/deprecated/old-scripts/pkg-size.1 b/deprecated/old-scripts/pkg-size.1
new file mode 100644
index 0000000..b195412
--- /dev/null
+++ b/deprecated/old-scripts/pkg-size.1
@@ -0,0 +1,11 @@
+.TH pkg-size "1" "Nov 2003" "gentoolkit"
+.SH NAME
+pkg-size \- Gentoo: Package size calculator
+.SH SYNOPSIS
+.B pkg-size
+\fIpackage\fR
+.SH DESCRIPTION
+Calculate size of \fIpackage\fR.
+.SH AUTHORS
+\fBpkg-size\fR was written by Karl Trygve Kalleberg <karltk@gentoo.org>.
+
diff --git a/deprecated/pkg-clean/AUTHORS b/deprecated/pkg-clean/AUTHORS
new file mode 100644
index 0000000..f126a36
--- /dev/null
+++ b/deprecated/pkg-clean/AUTHORS
@@ -0,0 +1,5 @@
+Maintainer:
+Karl Trygve Kalleberg <karltk@gentoo.org>
+
+Authors:
+Leo Lipelis <aeoo@gentoo.org> (original author)
diff --git a/deprecated/pkg-clean/ChangeLog b/deprecated/pkg-clean/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/pkg-clean/ChangeLog
diff --git a/deprecated/pkg-clean/README b/deprecated/pkg-clean/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/pkg-clean/README
diff --git a/deprecated/pkg-clean/pkg-clean b/deprecated/pkg-clean/pkg-clean
new file mode 100644
index 0000000..abe0159
--- /dev/null
+++ b/deprecated/pkg-clean/pkg-clean
@@ -0,0 +1,99 @@
+#!/usr/bin/python
+# Copyright 1999-2003 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+# $Header$
+# Author: Leo Lipelis <aeoo@gentoo.org>
+# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
+
+import commands
+import re
+import sys
+import time
+import os
+
+# constants for package tuples that are stored in pkg_hash
+PKG_TIME = 0 # number of seconds for ctime function
+PKG = 1 # package full path as accepted by ebuild
+PKG_NAME = 2 # package name as accepted by emerge
+
+(status, pkg_files) = commands.getstatusoutput(
+ "find /var/db/pkg -iname '*.ebuild' -printf '%T@ %p\n' | sort -n")
+
+pkg_file_list = pkg_files.splitlines()
+
+pkg_hash = {}
+for time_pkg_pair in pkg_file_list:
+ (pkg_time, pkg) = time_pkg_pair.split()
+ pkg_time = int(pkg_time)
+ # This covers developer trees with not-accepted categories
+ tmp_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg)
+ if not tmp_name: continue
+ pkg_name = tmp_name.group(1)
+ tmp_core = re.match(r'(.*)-\d.*', pkg_name)
+ if not tmp_core: continue
+ pkg_core = tmp_core.group(1)
+ if pkg_hash.has_key(pkg_core):
+ pkg_hash[pkg_core].append((pkg_time, pkg, pkg_name))
+ else:
+ pkg_hash[pkg_core] = [(pkg_time, pkg, pkg_name)]
+
+total_len = len(pkg_hash.keys())
+curpkg = 0
+tmpname = os.tmpnam()
+assume_yes = 0
+
+if len(sys.argv) > 1:
+ if sys.argv[1] in ["-y", "--yes"]:
+ assume_yes = 1
+ elif sys.argv[1] in ["-h", "--help"]:
+ print """pkg-clean [options]
+
+-y, --yes Don't ask for individual confirmation before unmerging; assume yes.
+"""
+ sys.exit(0)
+
+for pkg_core in pkg_hash.keys():
+ print "Examining %s:" % (pkg_core)
+ if len(pkg_hash[pkg_core]) < 2:
+ continue
+ unmerged_indexes = []
+
+ curpkg += 1
+ choices = ""
+ idx = 1
+ for pkg_tuple in pkg_hash[pkg_core]:
+ choices += " %d \"%s %s\" 0" % \
+ (idx, time.ctime(pkg_tuple[PKG_TIME]),
+ pkg_tuple[PKG_NAME])
+ idx += 1
+
+ params = "dialog --separate-output --backtitle \"pkg-clean processing package %d of %d\" " % ( curpkg, total_len)
+ params += "--checklist \"Select which package(s) to unmerge\" 20 70 12" + choices
+ res = os.system(params + " 2> " + tmpname)
+ if res:
+ sys.exit(0)
+
+ ins = open(tmpname)
+ for j in ins.readlines():
+ idx = int(j)
+ if idx == 0:
+ break
+
+ full_path = pkg_hash[pkg_core][idx-1][PKG]
+ ebuild = full_path.replace("/var/db/pkg/", "")
+
+ if not assume_yes:
+ params = "dialog --backtitle \"" + ebuild + "\" " + \
+ "--yesno \"Are you sure you want to unmerge " + ebuild + " ?\" 20 70"
+ res = os.system(params)
+ else:
+ res = 0
+
+ if res == 0:
+ (status, unmerge_out) = commands.getstatusoutput(
+ "ebuild %s unmerge" % (full_path))
+ print unmerge_out
+ time.sleep(2)
+ if status != 0:
+ sys.exit(status)
+ ins.close()
diff --git a/deprecated/pkg-clean/pkg-clean.1 b/deprecated/pkg-clean/pkg-clean.1
new file mode 100644
index 0000000..7a295f3
--- /dev/null
+++ b/deprecated/pkg-clean/pkg-clean.1
@@ -0,0 +1,20 @@
+.TH pkg\-clean "1" "Nov 2003" "gentoolkit"
+.SH NAME
+pkg\-clean \- Gentoo: Clean obsolete packages
+.SH SYNOPSIS
+.B pkg\-clean
+.SH BUGS
+This tool is obsolete, as of gentoolkit 0.2.0.
+Use 'emerge clean' or 'emerge depclean' (with caution; read the man page)
+instead.
+
+.SH SEE ALSO
+.BR emerge(1)
+.br
+.BR /usr/sbin/pkg\-clean
+
+.SH AUTHORS
+This informative man page was written by Karl Trygve Kalleberg
+<karltk@gentoo.org> and expanded by Katerina Barone\-Adesi
+<katerinab@gmail.com>.
+
diff --git a/deprecated/pkg-size/pkg-size b/deprecated/pkg-size/pkg-size
new file mode 100644
index 0000000..84dd7df
--- /dev/null
+++ b/deprecated/pkg-size/pkg-size
@@ -0,0 +1,66 @@
+#! /usr/bin/python
+#
+# $Header$
+#
+# Distributed under the terms of the GNU General Public License v2
+# Copyright (c) 2003 Karl Trygve Kalleberg
+
+import portage
+import pprint
+import sys
+import os
+
+__author__ = "Karl Trygve Kalleberg"
+__email__ = "karltk@gentoo.org"
+__version__ = "0.1.0"
+__productname__ = "pkg-size"
+__description__ = "Portage package size calculator"
+
+def find(name):
+ return portage.portdb.match(name)
+
+def print_size(cpv):
+ scpv=portage.catpkgsplit(cpv)
+ cat = scpv[0]
+ pnv = scpv[1]+"-"+scpv[2]
+ if scpv[3] != "r0":
+ pnv +="-"+scpv[3]
+ db=portage.dblink(cat,pnv,"")
+ size=0
+ uncounted = 0
+ if not os.path.exists(db.getpath()):
+ return
+ k=db.getcontents()
+ if not k:
+ return
+ for i in k:
+ try:
+ size += os.stat(i).st_size
+ except OSError:
+ uncounted += 1
+ s = cpv + ": " + str(size) + " bytes (" + str((size+512)/1024) + "KB)"
+ if uncounted > 0:
+ s += " (" + str(uncounted) + " file(s) not accessible)"
+ print s
+
+
+def main():
+ # parse parameters
+ if len(sys.argv) < 2:
+ print "No arguments!"
+ return
+ name = sys.argv[1]
+ candidates = find(name)
+ if len(candidates) == 0:
+ print "No candidate packages found!"
+ return
+
+ for i in candidates:
+ print_size(i)
+
+if __name__ == "__main__":
+ try:
+ main()
+ except KeyboardInterrupt:
+ print "Operation Aborted!"
+
diff --git a/deprecated/qpkg/AUTHORS b/deprecated/qpkg/AUTHORS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/qpkg/AUTHORS
diff --git a/deprecated/qpkg/ChangeLog b/deprecated/qpkg/ChangeLog
new file mode 100644
index 0000000..b25fd25
--- /dev/null
+++ b/deprecated/qpkg/ChangeLog
@@ -0,0 +1,5 @@
+2004-02-18 Brandon Low <lostlogic@gentoo.org>
+ * Fix a reported security issue, have a TMP location that is process specific
+
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Added Makefile
diff --git a/deprecated/qpkg/Makefile b/deprecated/qpkg/Makefile
new file mode 100644
index 0000000..cccdee0
--- /dev/null
+++ b/deprecated/qpkg/Makefile
@@ -0,0 +1,19 @@
+# Copyright 2004 Karl Trygve Kalleberg <karltk@gentoo.org>
+# Copyright 2004 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License v2
+#
+# $Header$
+
+include ../../makedefs.mak
+
+all:
+ echo "HATHERSAGE (n.) The tiny snippets of beard which coat the inside of a washbasin after shaving in it."
+
+dist:
+ mkdir -p ../../${distdir}/src/qpkg
+ cp Makefile README AUTHORS ChangeLog TODO qpkg qpkg.1 ../../${distdir}/src/qpkg/
+
+install:
+ install -d $(docdir)/deprecated/qpkg
+ install -m 0755 qpkg $(docdir)/deprecated/qpkg/
+ install -m 0644 qpkg.1 README AUTHORS ChangeLog $(docdir)/deprecated/qpkg/
diff --git a/deprecated/qpkg/README b/deprecated/qpkg/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/qpkg/README
diff --git a/deprecated/qpkg/TODO b/deprecated/qpkg/TODO
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/qpkg/TODO
diff --git a/deprecated/qpkg/qpkg b/deprecated/qpkg/qpkg
new file mode 100644
index 0000000..dd8344b
--- /dev/null
+++ b/deprecated/qpkg/qpkg
@@ -0,0 +1,581 @@
+#!/bin/bash
+#
+# qpkg - query portage package system for various information
+#
+# Copyright (c) Vitaly Kushneriuk <vitaly_kushneriuk@yahoo.com>
+# This program is distributed under the terms of GPL version 2.
+#
+# Maintainer: Brandon Low <lostlogic@gentoo.org>
+# Additional code thanks to:
+# Josh Goebel <dreamer@firesedge.org>
+#
+# $Header$
+ID='$Id$'
+VERSION=0.`echo ${ID} | cut -d\ -f3`
+
+umask 0077
+
+TMP="$(mktemp -d -t qpkg-XXXXXX)"
+rm -rf ${TMP}
+mkdir -p ${TMP}
+
+PROG=`basename ${0}`
+
+# Parse args
+verb=0
+group="*"
+params=${#}
+while [ ${#} -gt 0 ]
+do
+ a=${1}
+ shift
+ case "${a}" in
+
+ -h|--help)
+ usage=y
+ break
+ ;;
+
+ -i|--info)
+ info=y
+ ;;
+
+ -d|--dups)
+ dups=y
+ inst=y
+ ;;
+
+ -q|--query-deps)
+ query=y
+ ;;
+
+ -s|--slot)
+ slot=y
+ ;;
+
+ -f|--find-file)
+ ffind=y
+ inst=y
+ ;;
+
+ -fp|--find-pattern)
+ ffind=y
+ fpat=y
+ inst=y
+ ;;
+
+ -I|--installed)
+ inst=y
+ ;;
+
+ -m|--masked)
+ grepmask="-L"
+ ;;
+
+ -n|--non-masked)
+ grepmask="-l"
+ ;;
+
+ -U|--uninstalled)
+ uninst=y
+ ;;
+
+ -g|--group)
+ group=$1
+ shift
+ ;;
+
+ -l|--list)
+ list=y
+ inst=y
+ ;;
+
+ -ct|--check-time|-tc|--time-check)
+ tcheck=y
+ inst=y
+ ;;
+
+ -cm|--check-md5|-mc|--md5-check)
+ mcheck=y
+ inst=y
+ ;;
+
+ -c|--check)
+ mcheck=y
+ tcheck=y
+ inst=y
+ ;;
+
+ -v|--verbose)
+ let $((verb++))
+ ;;
+
+ -vv)
+ let $((verb++))
+ let $((verb++))
+ ;;
+
+ -nc|--no-color|--nocolor|--no-colors|--nocolors)
+ nocolor=y
+ ;;
+
+ -*)
+ echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2
+ usage=y
+ break
+ ;;
+ *)
+ if [ -n "${arg}" ]; then
+ echo -e ${CY}${PROG}: ${YL}Only one argument supported
+ usage=y
+ break
+ fi
+ arg=$a
+ ;;
+
+ esac
+done
+
+#This is a dumb way to handle things, take it out next time
+T="\t"
+
+#Set up colors
+if [ ! "${nocolor}" ]; then
+ NO="\x1b[0;0m"
+ BR="\x1b[0;01m"
+ CY="\x1b[36;01m"
+ RD="\x1b[31;01m"
+ GR="\x1b[32;01m"
+ YL="\x1b[33;01m"
+ BL="\x1b[34;01m"
+ STAR=" *"
+elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then
+ STAR=" *"
+fi
+
+
+# check for option conflicts
+if [ "${inst}" -a "${uninst}" \
+ -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \
+ -a "${uninst}" ]; then
+ echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO}
+ usage=y
+fi
+
+if [ "${usage}" ]; then
+ echo -e "${CY}${PROG} v. ${VERSION}${NO}
+
+${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can
+find packages owning files on your filesystem, check the integrity
+of installed packages, and do other queries against installed or
+uninstalled packages.
+
+NOTICE: This tool will be phased out at some point in the
+ future, please use equery instead.
+ Bugs are still fixed but new features won't be added.
+
+${BR}Usage:
+${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} <file>${NO}|${BL}-fp${YL} <pattern>${NO}]
+${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}]
+${T}${CY}${PROG}${NO} ${BL}--help${NO}
+
+${BR}Duplicate Locating:
+ ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed
+ ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT
+
+${BR}Package Selection:
+ ${BL}-f, --find-file${NO}${T}finds package that owns file <file>
+ ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching *<pattern>*
+ ${BL}-m, --masked${NO}${T}${T}Include${YL} only${NO} masked packages
+ ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages
+ ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages
+ ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages
+ ${BL}-g, --group${NO}${T}${T}Find by group (can be combined with other searches)
+
+${BR}Information Selection:
+ ${BL}-l, --list${NO}${T}${T}List package content
+ ${BL}-i, --info${NO}${T}${T}Get package description and home page.
+ ${BL}-ct, --check-time${NO}
+ ${BL}-tc, --time-check${NO}${T}Verify package files timestamps
+ ${BL}-cm, --check-md5${NO}
+ ${BL}-mc, --md5-check${NO}${T}Verify package files md5
+ ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5.
+ ${BL}-q, --query-deps${NO}${T}display all installed packages
+${T}${T}${T}depending on selected packages
+
+${BR}Operation Modifiers:
+ ${BL}-nc, --no-color${NO}${T}don't use colors
+ ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twice ]
+ ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO}
+
+${YL}Notes${NO}:
+${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages.
+${YL}*${NO} Short options may not be combined on the command-line, yet.
+${YL}*${NO} The operation of some flags has been changed by the
+ stripping of version numbers from some output to see
+ the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}.
+${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only
+ matching files will be displayed, unless ${BL}-v${NO} is doubled,
+ (yet more verbose) or ${BL}-vv${NO} is used.
+
+
+${YL}Examples${NO}:
+ ${PROG} --dups print duplicates oldest first
+ ${PROG} --dups -v .. with versions
+ ${PROG} print list of installed packages
+ ${PROG} porta -I print versions of installed portage
+ ${PROG} porta -i .. + versions in portage tree + descriptions
+ and homepages
+ ${PROG} gawk -c -v check integrity of all installed versions of gawk
+ the older ones will have \"damaged\" files.
+ ${PROG} -f /bin/ls print package(s) that own /bin/ls
+"
+ rm -rf ${TMP}
+ exit
+fi
+
+#For the --dups switch only
+if [ "${dups}" ]; then
+if [ "${grepmask}" ]; then
+ mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null`
+ echo -e "Currently accepted keywords: ${BL}${mask}${NO}"
+ echo -e
+ mask=`echo ${mask} | perl -pe 's/\s+/|/'`
+fi
+
+ #First dig out the list of packages with duplicates
+ find /var/db/pkg/ -iname "*${arg}*.ebuild" 2> /dev/null > ${TMP}qpkg.lst
+ dups=`cat ${TMP}qpkg.lst | cut -f7 -d/ |
+ sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' |
+ sort |
+ uniq -d`
+
+ #Next get all the exact versions
+ duppak=`cat ${TMP}qpkg.lst | fgrep "${dups}"`
+
+ #Now cut that down to the directory name so we can be smart
+ dirs=`sed -e 's:/[^/]*$::' ${TMP}qpkg.lst`
+
+ #Go through each package's DB and create a sortable file
+ #to play with
+ declare -i defcount=`cat /var/cache/edb/counter`
+ for DIR in ${dirs}
+ do #Package COUNTER
+ NUM=`cat "${DIR}/COUNTER" 2> /dev/null`
+ [ -z "${NUM}" ] && NUM=defcount
+ #Package slot if requested
+ [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"`
+ #Package fullname
+ PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"`
+ #Package basename
+ NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'`
+ echo "${NUM} ${PKG} ${NAME}${SLOT}"
+ #Finish loop, and sort that nice sortable file based on
+ #installation order, and then based on package basename
+ #bash hates me so I decided to use a temp file
+ done |sort -t" " -k3 -k1g,2|uniq -D -f2 > ${TMP}qpkg.lst
+ duppak=`cat ${TMP}qpkg.lst`
+ rm ${TMP}qpkg.lst
+
+ #If max verbosity is set output with full path to each ebuild
+ if [ "${verb}" -gt 1 ]; then
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:^:${BL}/var/db/pkg/${BR}:" \
+ -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:"
+
+ #If normal verbosity output package group, package name and package version
+ elif [ "${verb}" -gt 0 ]; then
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:"
+
+ #Otherwise just output package group and package name
+ else
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:-r[0-9]\+$::" \
+ -e "s:-[0-9].*$::" \
+ -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq
+ fi
+ rm -rf ${TMP}
+ exit
+fi
+
+# get list of ebuilds to work on
+if [ "${ffind}" ]; then
+ # file find mode - list all ebuilds for
+ # package/CONTENTS containing <arg>
+ if [ "${fpat}" ]; then
+ dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
+ | xargs grep -l "${arg} " \
+ | xargs --no-run-if-empty -n 1 dirname`
+ else
+ # if the user didnt specify a full path assume they
+ # want to check in the working dir #17331
+ [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}"
+
+ dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
+ | xargs grep -Fl " ${arg} " \
+ | xargs --no-run-if-empty -n 1 dirname`
+ fi
+ ipak=`(
+ for d in ${dirs} -;do
+ [ "-" = "$d" ] && break
+ ls ${d}/*.ebuild
+ done)`
+else
+ # normal mode - list ebuilds for ebuild name containing <arg>
+
+ # installed packages
+ if [ ! "${uninst}" ]; then
+ ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null`
+ if [[ ${group} != "*" ]]; then
+ ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}`
+ fi
+ if [ ${arg} ]; then
+ # avoid ${arg}="db" from pulling in every installed package
+ temp="/var/db/pkg/.*${arg}"
+ ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep -i ${temp}`
+ fi
+ if [ -n "${mask}" ]; then
+ ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
+ fi
+ fi
+ # not installed packages (yet:-)
+ if [ ! "${inst}" ]; then
+ upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"`
+ if [[ ${group} != "*" ]]; then
+ upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}`
+ fi
+ if [ ${arg} ]; then
+ upak=`echo ${upak}|sed -e "s: :\n:g"|grep -i ${arg}`
+ fi
+ if [ -n "${mask}" ]; then
+ upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
+ fi
+ fi
+fi
+
+X="\([^/]*\)"
+
+for p in ${ipak} ${upak} -;do
+ [ "${p}" = "-" ] && break
+
+ # cut common prefix from ebuild name and mark installed/uninstalled packages
+ # Note: iii/uuu will be replaced by the pipe at the end
+ n=${p%.ebuild}
+ var_db_pkg="/var/db/pkg/"
+ n=${n/${var_db_pkg}/iii }
+ usr_portage="/usr/portage/"
+ n=${n/${usr_portage}/uuu }
+ n=${n/\/*\//\/}
+
+ d=${p%\/*.ebuild} # faster d=`dirname ${p}`
+ echo ${n}
+
+ # if we have no passed parameters then
+ # we can skip the extra conditional checks
+ [[ ${params} == 0 ]] && continue;
+
+ if [ "${mask}" ]; then
+ keywords=`grep KEYWORDS ${p}| cut -d\" -f2`
+ echo -e "${T}Keywords: ${BL}${keywords}${NO}"
+ fi
+
+ if [ ${verb} -gt 1 ];then
+ echo "vvv ${p}"
+ fi
+
+ if [ "${info}" ]; then
+ source ${p} 2> /dev/null
+ home="${HOMEPAGE}"
+ desc="${DESCRIPTION}"
+ #home=`grep HOMEPAGE ${p}| cut -d\" -f2`
+ #desc=`grep DESCRIPTION ${p}|cut -d= -f2-|cat`
+ echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]"
+ if [ ${verb} -gt 0 ]; then
+ pdir=${p/$(basename ${p})/}
+ if [[ -r ${pdir}/USE && -r ${pdir}/IUSE ]]; then
+ echo -n "Compiled with USE Flags: "
+ for flag in $(<${pdir}/IUSE)
+ do
+ use=$(grep -o ${flag} ${pdir}/USE | tr -d '\n')
+ if [[ "${use}" == "" ]]; then
+ echo -n "-"
+ fi
+ echo -n "${flag} "
+ done
+ echo
+ fi
+ fi
+ fi
+
+ if [ "${query}" ]; then
+ echo -e "${BL}DEPENDED ON BY:${NO}"
+ package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \
+ -e 's:-[0-9].*$::' \
+ -e 's:^iii ::' \
+ -e 's:^uuu ::'`"
+ place="`echo ${n}|cut -f1 -d' '`"
+ [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}"
+
+ if [[ ${place} == "iii" ]]; then
+ for deppkg in $(grep -R "${package}" /var/db/pkg/*/*/RDEPEND | sed 's/RDEPEND.*$//')
+ do
+ rdepend=$(< ${deppkg}/RDEPEND)
+
+ for flag in $(< ${deppkg}/USE)
+ do
+ if [[ "${flag:0:1}" == "-" ]]; then
+ rdepend="$(echo ${rdepend} | sed 's/${flag:1}? ( [[:alnum:][:punct:]]* )//')"
+ fi
+ done
+
+ if [[ $(echo ${rdepend} | grep -o ${package}) == ${package} ]]; then
+ echo $'\t'$(< ${deppkg}/PF)
+ fi
+ done
+ else
+ grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \
+ cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort -u
+ fi
+ if [[ $(grep -R "*${package}" /etc/make.profile/packages) != "" ]]; then
+ echo -e "\t${color}SYSTEM PROFILE${NO}"
+ fi
+ fi
+
+ # cat package content, remove obj/sym/dir, md5 and mtime when not verbose
+ # display only match in file-find mode unless extra verbose
+ if [ "${list}" ]; then
+ echo -e ${BL}CONTENTS:${NO}
+
+ if [ ${verb} -gt 1 ]; then
+ cat ${d}/CONTENTS
+ else
+ if [ "${ffind}" ]; then
+ if [ "${fpat}" ]; then
+ grep "${arg}[:blank:]" $d/CONTENTS
+ else
+ grep " ${arg}\( .*\)*$" $d/CONTENTS
+ fi
+ else
+ cat $d/CONTENTS
+ fi |
+ if [ ${verb} -gt 0 ]; then
+ cat
+ else
+ sed -e "s:\(^obj \)\(.*\)\( .*\)\{2\}$:\1${BR}\2${NO}:;
+ s:\(^sym \)\(.*\)\( -> \)\(.*\)\( .*\)\{2\}$:\1${CY}\2${NO}\3\4:;
+ s:\(^dir \)\(.*\)$:\1${YL}\2${NO}:"
+ fi
+ fi
+
+ echo
+
+ # check files mtime and md5, display summary at the end
+ elif [ "${tcheck}" -o "${mcheck}" ]; then
+ # counters
+ fe=0
+ fs=0
+ # read the CONTENTS file and check md5 and mtime if needed
+ # process only matching files in find-file mode unless extra verbose
+ cat ${d}/CONTENTS |
+ if [ "${ffind}" -a ${verb} -lt 2 ];then
+ if [ "${fpat}" ]; then
+ grep "${arg}"
+ else
+ grep " ${arg} "
+ fi
+ else
+ cat
+ fi |
+ (
+ while read -a line
+ do
+ fs=$((fs + 1))
+
+ unset md5
+ unset _md5
+ unset mtime
+ unset _mtime
+ unset err
+ unset len
+
+ len="${#line[*]}"
+ if [ "${line[0]}" = "obj" ]; then
+ name=
+ for i in `seq 1 $((${len}-3))`; do
+ [ "${name}" ] && name="${name} ${line[${i}]}" || name="${line[${i}]}"
+ done
+ else
+ name="${line[1]}"
+ fi
+
+ missing=
+ [ ! -e "${name}" ] && missing=1
+
+ # colorize name and compute mtime/md5
+ if [ "obj" = "${line[0]}" ]; then
+ [ -e "${name}" ] && {
+ [ "${tcheck}" ] && mtime="${line[$((${len}-1))]}"
+ [ "${tcheck}" ] && _mtime=`date -r "${name}" +%s`
+
+ [ "${mcheck}" ] && md5=${line[$((${len}-2))]}
+ [ "${mcheck}" ] && _md5=`md5sum "${name}"|cut -f1 -d" "`
+ }
+
+ name="${BR}${name}${NO}"
+
+ elif [ "sym" = "${line[0]}" ]; then
+ name="${CY}${name}${NO}"
+
+ elif [ "dir" = "${line[0]}" ]; then
+ name="${YL}${name}${NO}"
+ fi
+
+ # compare
+ if [ "${missing}" ]; then
+ err=1
+ name="${name} ${RD}!not exist!${NO}"
+ fi
+ if [ "${md5}" != "${_md5}" ]; then
+ #If the md5 fails the first time check it with
+ #everything changed to lowercase :-D
+ md5="$(echo ${md5}|tr A-Z a-z)"
+ if [ "${md5}" != "${_md5}" ]; then
+ err=1
+ name="${name} ${RD}!md5!${NO}"
+ fi
+ fi
+ if [ "${mtime}" != "${_mtime}" ]; then
+ err=1
+ name="${name} ${RD}!mtime!${NO}"
+ fi
+
+ [ "${verb}" -gt 1 ] && echo -e "${name}"
+ [[ "${verb}" -eq 1 ]] && [[ "${err}" -eq 1 ]] && echo -e "${name}"
+
+ fe=$((fe + err))
+ done
+ if [ "${fe}" = "0" ]; then
+ echo -e "${YL}${fe}${CY}/${fs}${NO}"
+ else
+ echo -e "${RD}${fe}${CY}/${fs}${NO}"
+ fi
+ echo
+ )
+ fi
+
+done | (
+ if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then
+ sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1
+ elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then
+ sort -k2|uniq -f1
+ else
+ cat
+ fi | sed \
+ -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \
+ -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \
+ -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \
+ -e "s:^obj ::;s:^sym ::;s:^dir ::"
+
+)
+rm -rf ${TMP}
diff --git a/deprecated/qpkg/qpkg.1 b/deprecated/qpkg/qpkg.1
new file mode 100644
index 0000000..6d45a93
--- /dev/null
+++ b/deprecated/qpkg/qpkg.1
@@ -0,0 +1,112 @@
+.TH "qpkg" "1" "1.6" "gentoolkit 0.1.11-r1" ""
+.SH "NAME"
+qpkg \- Gentoo: query package tool
+.SH "SYNOPSIS"
+.LP
+.B qpkg\fR [\fIoptions\fR] [\fIpkgname\fR] [\fI\-g group\fR]
+.br
+ [\fI\-f <file>\fR|\fI\-fp <pattern>\fR]
+.TP
+.B qpkg \fI\-\-dups\fR [\fI\-\-slot\fR]
+.TP
+.B qpkg \fI\-\-help\fR
+.SH "DESCRIPTION"
+qpkg is GenToolKit's "query package" tool, using it, you can find packages owning files on your filesystem, check the integrity of installed packages, and do other queries against installed or uninstalled packages.
+.SH "OPTIONS "
+.LP
+.I Duplicate Locating:
+.LP
+.B \-d, \-\-dups\fR print packages that have multiple
+.br
+ versions installed
+.br
+.B \-s, \-\-slot\fR make \-d SLOT only print dups of the
+.br
+ same SLOT
+.LP
+.I Package Selection:
+.LP
+.B \-f, \-\-find\-file\fR Finds package that owns file <file>
+.br
+.B \-fp, \-\-find\-pattern\fR Finds to package that owns file
+.br
+ matching *<pattern>*
+.br
+.B \-I, \-\-installed\fR Include only installed packages
+.br
+.B \-U, \-\-uninstalled\fR Include only uninstalled packages
+.br
+.B \-g, \-\-group\fR Find by group (can be combined with
+.br
+ other searches)
+.LP
+.I Information Selection:
+.LP
+.B \-l, \-\-list\fR List package content
+.br
+.B \-i, \-\-info\fR Get package description and home page.
+.br
+.B \-ct, \-\-check\-time
+.br
+.B \-tc, \-\-time\-check\fR Verify package files timestamps
+.br
+.B \-cm, \-\-check\-md5
+.br
+.B \-mc, \-\-md5\-check\fR Verify package files md5
+.br
+.B \-c, \-\-check\fR Verify mtimes and md5.
+.br
+.B \-q, \-\-query\-deps\fR display all installed packages
+.br
+\fR depending on selected packages
+.LP
+.I Operation Modifiers:
+.LP
+.B \-nc, \-\-no\-color\fR Don't use colors
+.br
+.B \-v, \-\-verbose\fR Be more verbose [2 levels]
+.br
+.B \-vv\fR Same as \-v \-v
+.SH "NOTES"
+\fI\-f, \-fp, \-d, \-l, \-ct, \-cm, \fRand \fI\-c\fR apply only to installed packages.
+.br
+.TP
+Short options may not be combined on the command\-line, yet.
+.TP
+The operation of some flags has been changed in version 1.6 by the stripping of version numbers from some output to see the version numbers play with \fI\-v\fR and \fI\-vv\fR.
+.TP
+When using \fI\-f\fR with \fI\-l\fR or \fI\-\-check.. \-v\fR options, only matching files will be displayed, unless \fI\-v\fR is doubled, (yet more verbose), equivalent to \fI\-vv\fR.
+.TP
+When using \fI\-q\fR, it is important to note that the querying of deps checks package names only, because qpkg is not advanced enough (nor can it reasonably made so) to check complete deps with versions. Please use \fBdepclean\fR or \fBemerge --dep-clean\fR to more completely check the dependency sanity of your system.
+.SH "EXAMPLES"
+.LP
+.B qpkg \fI\-\-dups\fR print duplicates oldest first
+.br
+.B qpkg \fI\-\-dups \-v\fR.. with versions
+.br
+.B qpkg\fR print list of packages
+.br
+.B qpkg\fR porta \fI\-I\fR print versions of installed portage
+.br
+.B qpkg porta \fI\-i\fR .. + versions in portage tree +
+.br
+ descriptions and homepages
+.br
+.B qpkg gawk \fI\-c \-v\fR check integrity all installed versions
+.br
+ of gawk the older versions will have
+.br
+ "damaged" files.
+.br
+.B qpkg \fI\-f\fR /bin/ls print package(s) that own /bin/ls
+.SH "AUTHORS"
+Vitaly Kushneriuk <vitaly@gentoo.org>, 2002: qpkg
+.br
+Karl Trygve Kalleberg <karltk@gentoo.org>, 2002: man page
+.br
+Brandon Low <lostlogic@gentoo.org>, 2002: maintainance
+.SH "SEE ALSO"
+ebuild(5)
+.TP
+The \fI/usr/sbin/qpkg\fR script.
+.TP
diff --git a/deprecated/qpkg/qpkg.sh b/deprecated/qpkg/qpkg.sh
new file mode 100644
index 0000000..cdbe3c7
--- /dev/null
+++ b/deprecated/qpkg/qpkg.sh
@@ -0,0 +1,520 @@
+#!/bin/bash
+#
+# qpkg - query portage package system for various information
+#
+# Copyright (c) Vitaly Kushneriuk <vitaly_kushneriuk@yahoo.com>
+# This program is distributed under the terms of GPL version 2.
+#
+# Maintainer: Brandon Low <lostlogic@gentoo.org>
+# Additional code thanks to:
+# Josh Goebel <dreamer@firesedge.org>
+#
+# $Header$
+ID='$Id$'
+VERSION=0.`echo ${ID} | cut -d\ -f3`
+
+PROG=`basename ${0}`
+
+# Parse args
+verb=0
+group="*"
+params=${#}
+while [ ${#} -gt 0 ]
+do
+ a=${1}
+ shift
+ case "${a}" in
+
+ -h|--help)
+ usage=y
+ break
+ ;;
+
+ -i|--info)
+ info=y
+ ;;
+
+ -d|--dups)
+ dups=y
+ inst=y
+ ;;
+
+ -q|--query-deps)
+ query=y
+ ;;
+
+ -s|--slot)
+ slot=y
+ ;;
+
+ -f|--find-file)
+ ffind=y
+ inst=y
+ ;;
+
+ -fp|--find-pattern)
+ ffind=y
+ fpat=y
+ inst=y
+ ;;
+
+ -I|--installed)
+ inst=y
+ ;;
+
+ -m|--masked)
+ grepmask="-L"
+ ;;
+
+ -n|--non-masked)
+ grepmask="-l"
+ ;;
+
+ -U|--uninstalled)
+ uninst=y
+ ;;
+
+ -g|--group)
+ group=$1
+ shift
+ ;;
+
+ -l|--list)
+ list=y
+ inst=y
+ ;;
+
+ -ct|--check-time|-tc|--time-check)
+ tcheck=y
+ inst=y
+ ;;
+
+ -cm|--check-md5|-mc|--md5-check)
+ mcheck=y
+ inst=y
+ ;;
+
+ -c|--check)
+ mcheck=y
+ tcheck=y
+ inst=y
+ ;;
+
+ -v|--verbose)
+ let $((verb++))
+ ;;
+
+ -vv)
+ let $((verb++))
+ let $((verb++))
+ ;;
+
+ -nc|--no-color|--nocolor|--no-colors|--nocolors)
+ nocolor=y
+ ;;
+
+ -*)
+ echo -e ${CY}${PROG}${NO}:${YL} Invalid option ${RD}$a 1>&2
+ usage=y
+ break
+ ;;
+ *)
+ if [ -n "${arg}" ]; then
+ echo -e ${CY}${PROG}: ${YL}Only one argument supported
+ usage=y
+ break
+ fi
+ arg=$a
+ ;;
+
+ esac
+done
+
+#This is a dumb way to handle things, take it out next time
+T="\t"
+
+#Set up colors
+if [ ! "${nocolor}" ]; then
+ NO="\x1b[0;0m"
+ BR="\x1b[0;01m"
+ CY="\x1b[36;01m"
+ RD="\x1b[31;01m"
+ GR="\x1b[32;01m"
+ YL="\x1b[33;01m"
+ BL="\x1b[34;01m"
+ STAR=" *"
+elif [ ! "${inst}" ] && [ ! "${uninst}" ]; then
+ STAR=" *"
+fi
+
+
+# check for option conflicts
+if [ "${inst}" -a "${uninst}" \
+ -o \( "${ffind}" -o "${list}" -o "${tcheck}" -o "${mcheck}" \) \
+ -a "${uninst}" ]; then
+ echo -e ${CY}${PROG}${NO}:${YL} conflicting options/modes${NO}
+ usage=y
+fi
+
+if [ "${usage}" ]; then
+ echo -e "${CY}${PROG} v. ${VERSION}${NO}
+
+${CY}${PROG}${NO} is GenToolKit's \"query package\" tool, using it, you can
+find packages owning files on your filesystem, check the integrity
+of installed packages, and do other queries against installed or
+uninstalled packages.
+
+${BR}Usage:
+${T}${CY}${PROG}${NO} [${BR}options${NO}] [${YL}pkgname${NO}] [${BL}-g${YL} group${NO}] [${BL}-f${YL} <file>${NO}|${BL}-fp${YL} <patern>${NO}]
+${T}${CY}${PROG}${NO} ${BL}--dups${NO} [${BL}--slot${NO}]
+${T}${CY}${PROG}${NO} ${BL}--help${NO}
+
+${BR}Duplicate Locating:
+ ${BL}-d, --dups${NO}${T}${T}print packages that have multiple versions installed
+ ${BL}-s, --slot${NO}${T}${T}make ${BL}-d${NO} SLOT only print dups of the same SLOT
+
+${BR}Package Selection:
+ ${BL}-f, --find-file${NO}${T}finds package that owns file <file>
+ ${BL}-fp, --find-pattern${NO}${T}finds to package that owns file matching *<pattern>*
+ ${BL}-m, --masked${NO}${T}Include${YL} only${NO} masked packages
+ ${BL}-n, --non-masked${NO}${T}Include${YL} only${NO} non-masked packages
+ ${BL}-I, --installed${NO}${T}Include${YL} only${NO} installed packages
+ ${BL}-U, --uninstalled${NO}${T}Include${YL} only${NO} uninstalled packages
+ ${BL}-g, --group${NO}${T}${T}Find by goup (can be combined with other searches)
+
+${BR}Information Selection:
+ ${BL}-l, --list${NO}${T}${T}List package content
+ ${BL}-i, --info${NO}${T}${T}Get package description and home page.
+ ${BL}-ct, --check-time${NO}
+ ${BL}-tc, --time-check${NO}${T}Verify package files timestamps
+ ${BL}-cm, --check-md5${NO}
+ ${BL}-mc, --md5-check${NO}${T}Verify package files md5
+ ${BL}-c, --check${NO}${T}${T}Verify mtimes${YL} and${NO} md5.
+ ${BL}-q, --query-deps${NO}${T}display all installed packages
+${T}${T}${T}depending on selected packages
+
+${BR}Operation Modifiers:
+ ${BL}-nc, --no-color${NO}${T}don't use colors
+ ${BL}-v, --verbose${NO}${T}Be more verbose [ can be repeated twise ]
+ ${BL}-vv${NO}${T}${T}${T}Same as ${BL}-v -v${NO}
+
+${YL}Notes${NO}:
+${YL}*${NO} ${BL}-f${NO}, ${BL}-fp, ${BL}-d${NO}, ${BL}-l${NO}, ${BL}-ct${NO}, ${BL}-cm${NO}, and ${BL}-c${NO} apply only to installed packages.
+${YL}*${NO} Short options may not be combined on the command-line, yet.
+${YL}*${NO} The operation of some flags has been changed by the
+ stripping of version numbers from some output to see
+ the version numbers play with ${BL}-v${NO} and ${BL}-vv${NO}.
+${YL}*${NO} When using${BL} -f${NO} with ${BL}-l${NO} or ${BL}--check.. -v${NO} options, only
+ matching files will be displayed, unless ${BL}-v${NO} is doubled,
+ (yet more verbose) or ${BL}-vv${NO} is used.
+
+
+${YL}Examples${NO}:
+ ${PROG} --dups print duplicates oldest first
+ ${PROG} --dups -v .. with versions
+ ${PROG} print list of installed packages
+ ${PROG} porta -I print versions of installed portage
+ ${PROG} porta -i .. + versions in portage tree + descriptions
+ and homepages
+ ${PROG} gawk -c -v check integrity all installed versions of gawk
+ the older will have \"damaged\" files.
+ ${PROG} -f /bin/ls print package(s) that own /bin/ls
+"
+ exit
+fi
+
+#For the --dups switch only
+if [ "${dups}" ]; then
+if [ "${grepmask}" ]; then
+ mask=`python -c 'import portage; print portage.settings["ACCEPT_KEYWORDS"];' 2> /dev/null`
+ echo -e "Currently accepted keywords: ${BL}${mask}${NO}"
+ echo -e
+ mask=`echo ${mask} | perl -pe 's/\s+/|/'`
+fi
+
+ #First dig out the list of packages with duplicates
+ find /var/db/pkg -iname "*${arg}*.ebuild" 2> /dev/null > /tmp/qpkg.lst
+ dups=`cat /tmp/qpkg.lst | cut -f7 -d/ |
+ sed -e 's:\.ebuild$::; s:-r[0-9]*$::; s:-[^-]*$::; /^$/d' |
+ sort |
+ uniq -d`
+
+ #Next get all the exact versions
+ duppak=`cat /tmp/qpkg.lst | fgrep "${dups}"`
+
+ #Now cut that down to the directory name so we can be smart
+ dirs=`sed -e 's:/[^/]*$::' /tmp/qpkg.lst`
+
+ #Go through each package's DB and create a sortable file
+ #to play with
+ declare -i defcount=`cat /var/cache/edb/counter`
+ for DIR in ${dirs}
+ do #Package COUNTER
+ NUM=`cat "${DIR}/COUNTER" 2> /dev/null`
+ [ -z "${NUM}" ] && NUM=defcount
+ #Package slot if requested
+ [ ${slot} ] && SLOT=`cat "${DIR}/SLOT"`
+ #Package fullname
+ PKG=`ls --color=no -1 ${DIR}/*.ebuild|cut -f5,7 -d"/"`
+ #Package basename
+ NAME=`echo "${PKG}"|sed -e 's:\.ebuild$::; s:-r[0-9]\+$::; s:-[0-9].*$::'`
+ echo "${NUM} ${PKG} ${NAME}${SLOT}"
+ #Finish loop, and sort that nice sortable file based on
+ #installation order, and then based on package basename
+ #bash hates me so I decided to use a temp file
+ done |sort -t" " -k3 -k1g,2|uniq -D -f2 > /tmp/qpkg.lst
+ duppak=`cat /tmp/qpkg.lst`
+ rm /tmp/qpkg.lst
+
+ #If max verbosity is set output with full path to each ebuild
+ if [ "${verb}" -gt 1 ]; then
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:^:${BL}/var/db/pkg/${BR}:" \
+ -e "s:\(/\)\([^/]*\)\(.ebuild\):\1${CY}\2${NO}\1\2\3:"
+
+ #If normal verbosity output package group, package name and package version
+ elif [ "${verb}" -gt 0 ]; then
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:\(^[^/]*/\)\(.*\)\(\.ebuild\):${BR}\1${CY}\2${NO}:"
+
+ #Otherwise just output package group and package name
+ else
+ echo -n "${duppak}"|cut -f2 -d" "| \
+ sed -e "s:-r[0-9]\+$::" \
+ -e "s:-[0-9].*$::" \
+ -e "s:\(^[^/]*/\)\(.*\):${BR}\1${CY}\2${NO}:"|uniq
+ fi
+ exit
+fi
+
+# get list of ebuilds to work on
+if [ "${ffind}" ]; then
+ # file find mode - list all ebuilds for
+ # package/CONTENTS containing <arg>
+ if [ "${fpat}" ]; then
+ dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
+ | xargs grep -l "${arg}" \
+ | xargs --no-run-if-empty -n 1 dirname`
+ else
+ # if the user didnt specify a full path assume they
+ # want to check in the working dir #17331
+ [ "${arg:0:1}" != "/" ] && arg="${PWD}/${arg}"
+
+ dirs=`ls /var/db/pkg/${group}/*/CONTENTS \
+ | xargs grep -l " ${arg}\( .*\)*$" \
+ | xargs --no-run-if-empty -n 1 dirname`
+ fi
+ ipak=`(
+ for d in ${dirs} -;do
+ [ "-" = "$d" ] && break
+ ls ${d}/*.ebuild
+ done)`
+else
+ # normal mode - list ebuilds for ebuild name containing <arg>
+
+ # installed packages
+ if [ ! "${uninst}" ]; then
+ ipak=`find /var/db/pkg/ -iname "*.ebuild" 2>/dev/null`
+ if [[ ${group} != "*" ]]; then
+ ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${group}`
+ fi
+ if [ ${arg} ]; then
+ # avoid ${arg}="db" from pulling in every installed package
+ temp="/var/db/pkg/.*${arg}"
+ ipak=`echo ${ipak}|sed -e "s: :\n:g"|grep ${temp}`
+ fi
+ if [ -n "${mask}" ]; then
+ ipak=`echo ${ipak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
+ fi
+ fi
+ # not installed packages (yet:-)
+ if [ ! "${inst}" ]; then
+ upak=`find /usr/portage/ -iname "*.ebuild" 2>/dev/null|grep -v --regex="/usr/portage/[^/]*\.ebuild"`
+ if [[ ${group} != "*" ]]; then
+ upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${group}`
+ fi
+ if [ ${arg} ]; then
+ upak=`echo ${upak}|sed -e "s: :\n:g"|grep ${arg}`
+ fi
+ if [ -n "${mask}" ]; then
+ upak=`echo ${upak}|xargs -r egrep ${grepmask} "^KEYWORDS=.*[[:space:]\"\'](${mask})[[:space:]\"\']"`
+ fi
+ fi
+fi
+
+X="\([^/]*\)"
+
+for p in ${ipak} ${upak} -;do
+ [ "${p}" = "-" ] && break
+
+ # cut common prefix from ebuild name and mark installed/uninstalled packages
+ # Note: iii/uuu will be replaced by the pipe at the end
+ n=${p%.ebuild}
+ var_db_pkg="/var/db/pkg/"
+ n=${n/${var_db_pkg}/iii }
+ usr_portage="/usr/portage/"
+ n=${n/${usr_portage}/uuu }
+ n=${n/\/*\//\/}
+
+ d=${p%\/*.ebuild} # faster d=`dirname ${p}`
+ echo ${n}
+
+ # if we have no passed parameters then
+ # we can skip the extra conditional checks
+ [[ ${params} == 0 ]] && continue;
+
+ if [ "${mask}" ]; then
+ keywords=`grep KEYWORDS ${p}| cut -d\" -f2`
+ echo -e "${T}Keywords: ${BL}${keywords}${NO}"
+ fi
+
+ if [ ${verb} -gt 1 ];then
+ echo "vvv ${p}"
+ fi
+
+ if [ "${info}" ]; then
+ home=`grep HOMEPAGE ${p}| cut -d\" -f2`
+ desc=`grep DESCRIPTION ${p}| cut -d\" -f2`
+ echo -e "${T}${BL}${desc}${NO} [ ${YL}${home}${NO} ]"
+ fi
+
+ if [ "${query}" ]; then
+ echo -e "${BL}DEPENDED ON BY:${NO}"
+ package="`echo ${n}|sed -e 's:-r[0-9]\+$::' \
+ -e 's:-[0-9].*$::' \
+ -e 's:^iii ::' \
+ -e 's:^uuu ::'`"
+ place="`echo ${n}|cut -f1 -d' '`"
+ [[ "${place}" == "iii" ]] && color="${GR}" || color="${RD}"
+ grep -R "${package}" /var/db/pkg/*/*/RDEPEND | \
+ cut -f5,6 -d"/" | sed -e "s:^:\t${color}:;s:$:${NO}:" | sort | uniq
+# gawk -F "/" '{printf("${place}\n\t%s/%s${NO}",$5,$6)}' | sort | uniq
+ fi
+
+ # cat package content, remove obj/sym/dir, md5 and mtime when not verbose
+ # display only match in file-find mode unless extra verbose
+ if [ "${list}" ]; then
+ echo -e ${BL}CONTENTS:${NO}
+
+ if [ ${verb} -gt 1 ]; then
+ cat ${d}/CONTENTS
+ else
+ if [ "${ffind}" ]; then
+ if [ "${fpat}" ]; then
+ grep "${arg}" $d/CONTENTS
+ else
+ grep " ${arg}\( .*\)*$" $d/CONTENTS
+ fi
+ else
+ cat $d/CONTENTS
+ fi |
+ if [ ${verb} -gt 0 ]; then
+ cat
+ else
+ sed -e "s:\(^obj \)\([^ ]*\)\(.*$\):\1${BR}\2${NO}:;
+ s:\(^sym \)\([^ ]*\)\( -> \)\([^ ]*\)\(.*$\):\1${CY}\2${NO}\3\4:;
+ s:\(^dir \)\([^ ]*\)\(.*$\):\1${YL}\2${NO}:"
+ fi
+ fi
+
+ echo
+
+ # check files mtime and md5, display summary at the end
+ elif [ "${tcheck}" -o "${mcheck}" ]; then
+ # counters
+ fe=0
+ fs=0
+ # read the CONTENTS file and check md5 and mtime if needed
+ # process only matching files in find-file mode unless extra verbose
+ cat ${d}/CONTENTS |
+ if [ "${ffind}" -a ${verb} -lt 2 ];then
+ if [ "${fpat}" ]; then
+ grep "${arg}"
+ else
+ grep " ${arg} "
+ fi
+ else
+ cat
+ fi |
+ (
+ while read -a line
+ do
+ fs=$((fs + 1))
+
+ unset md5
+ unset _md5
+ unset mtime
+ unset _mtime
+ unset err
+
+ name=${line[1]}
+
+ missing=
+ [ ! -e ${name} ] && missing=1
+
+ # colorize name and compute mtime/md5
+ if [ "obj" = ${line[0]} ]; then
+ [ -e ${name} ] && {
+ [ "${tcheck}" ] && mtime=${line[3]}
+ [ "${tcheck}" ] && _mtime=`date -r ${name} +%s`
+
+ [ "${mcheck}" ] && md5=${line[2]}
+ [ "${mcheck}" ] && _md5=`md5sum ${name}|cut -f1 -d" "`
+ }
+
+ name=${BR}${name}${NO}
+
+ elif [ "sym" = ${line[0]} ]; then
+ name=${CY}${name}${NO}
+
+ elif [ "dir" = ${line[0]} ]; then
+ name=${YL}${name}${NO}
+ fi
+
+ # compare
+ if [ "$missing" ]; then
+ err=1
+ name="${name} ${RD}!not exist!${NO}"
+ fi
+ if [ "${md5}" != "${_md5}" ]; then
+ #If the md5 fails the first time check it with
+ #everything changed to lowercase :-D
+ md5=`echo "${md5}"|tr A-Z a-z`
+ if [ "${md5}" != "${_md5}" ]; then
+ err=1
+ name="${name} ${RD}!md5!${NO}"
+ fi
+ fi
+ if [ "${mtime}" != "${_mtime}" ]; then
+ err=1
+ name="${name} ${RD}!mtime!${NO}"
+ fi
+
+ [ ${verb} -gt 1 ] && echo -e ${name}
+ [[ ${verb} -eq 1 ]] && [[ $err -eq 1 ]] && echo -e ${name}
+
+ fe=$((fe + err))
+ done
+ if [ "$fe" = "0" ]; then
+ echo -e ${YL}$fe${CY}/$fs${NO}
+ else
+ echo -e ${RD}$fe${CY}/$fs${NO}
+ fi
+ echo
+ )
+ fi
+
+done | (
+ if [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -gt 0 \) ]; then
+ sed -e "s:-r[0-9]\+$::" -e "s:-[0-9][^-]*$::"|sort -k2|uniq -f1
+ elif [ ! \( "${tcheck}" -o "${mcheck}" -o "${info}" -o "${list}" -o "${query}" -o "${mask}" -o ${verb} -lt 2 \) ]; then
+ sort -k2|uniq -f1
+ else
+ cat
+ fi | sed \
+ -e "s:^iii ${X}/${X}:${BR}\1/${CY}\2${STAR}${NO}:" \
+ -e "s:^uuu ${X}/${X}:${BR}\1/${YL}\2${NO}:" \
+ -e "s:^vvv \(.*\)$:${BL}\1${NO}:" \
+ -e "s:^obj ::;s:^sym ::;s:^dir ::"
+
+)
diff --git a/deprecated/useflag/AUTHORS b/deprecated/useflag/AUTHORS
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/useflag/AUTHORS
diff --git a/deprecated/useflag/ChangeLog b/deprecated/useflag/ChangeLog
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/useflag/ChangeLog
diff --git a/deprecated/useflag/README b/deprecated/useflag/README
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/deprecated/useflag/README
diff --git a/deprecated/useflag/useflag b/deprecated/useflag/useflag
new file mode 100644
index 0000000..fd4cc08
--- /dev/null
+++ b/deprecated/useflag/useflag
@@ -0,0 +1,610 @@
+#!/bin/bash
+# useflag v0.3.1
+# Script to help users manage USE flags in Gentoo Linux
+#
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Author: Michael Thompson <psionix@grandecom.net>, (c) 2002
+
+run_name=`basename $0`
+use_desc="/usr/portage/profiles/use.desc"
+make_conf_dir="/etc"
+make_conf="${make_conf_dir}/make.conf"
+# Home directory was chosen as the use of /tmp allows for symlink attacks
+make_temp="${HOME}/use.make.conf.tmp"
+use_cache_parent="/var/cache"
+use_cache_dir="${use_cache_parent}/use_desc"
+use_cache="${use_cache_dir}/use.cache"
+lock_cache="${use_cache_dir}/lock.cache"
+changes="0"
+
+
+# Get flag description
+# parm1 = Use flag to get description of
+do_get_desc() {
+ local parm1=$1
+ # Strip the comments and find the flag.
+ local out_get_desc=`grep -v "#" ${use_desc} | grep -w -e "${parm1} -"`
+ if [ "${out_get_desc}" = "" ]; then
+ local lcl_avail=`grep -v "#" ${use_desc} | cut -d ' ' -f1 | \
+ grep -w -e "${parm1}"`
+ if [ "${lcl_avail}" != "" ]; then
+ echo "${parm1} - No description available."
+ else
+ echo "!!! ${parm1} does not exist."
+ fi
+ else
+ echo "${out_get_desc}"
+ fi
+}
+
+# Get the contents of the USE variable
+# parm1 controls whether or not to include the '-' with each flag
+do_get_make() {
+ local parm1=$1
+ # Get the USE flags from make.conf
+ # using `source` now instead of brain-damaged grepping
+ source ${make_conf}
+ local get_make_out=${USE}
+ # If called with "nodashes", then strip the leading dashes
+ if [ "${parm1}" = "nodashes" ]; then
+ for tr_sucks in ${get_make_out}; do
+ if [ "${tr_sucks:0:1}" = "-" ]; then
+ local tr_out="${tr_out} ${tr_sucks:1}"
+ else
+ local tr_out="${tr_out} ${tr_sucks}"
+ fi
+ done
+ get_make_out="${tr_out}"
+ fi
+ echo "${get_make_out}"
+}
+
+# Yes, it's pointless. But it could be used more than once in the future
+# so it's a function.
+# Gets the master list of available USE flags from use.desc
+do_get_avail() {
+ grep -v "#" ${use_desc} | cut -d " " -f1 | tr '\n' ' '
+}
+
+# Get deprecated flags.
+# parm1 = flag to check for deprecation
+# parm2 = list of available flags
+do_get_depr() {
+ local parm1=$1
+ local parm2=${@:2}
+ # This next var can't be local
+ get_depr_tmp=`echo "${parm2}" | tr ' ' '\n' | grep -x -e "${parm1}"`
+ local ret_code=$?
+ if [ "${ret_code}" != "0" ]; then
+ echo "${parm1}" | tr '\n' ' '
+ fi
+}
+
+# Removes a USE flag from make.conf
+# parm1 = flag to remove
+# use_rm_out = list of available flags
+do_use_rm() {
+ local parm1=$1
+ local use_rm_out=${@:2}
+ # Strip matching USE flags. Yes, this is ugly, I know.
+ use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \
+ grep -x -v -e "${parm1}" | tr '\n' ' '`
+ # Also strip the inverse. Even uglier...
+ if [ "${parm1:0:1}" = "-" ]; then
+ use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \
+ grep -x -v -e "${parm1:1}" | tr '\n' ' '`
+ else
+ use_rm_out=`echo "${use_rm_out}" | tr ' ' '\n' | \
+ grep -x -v -e "-${parm1}" | tr '\n' ' '`
+ fi
+ echo "${use_rm_out}"
+}
+
+# Adds a USE flag to make.conf
+# parm1 = flag to add
+# use_add_out = list of available flags
+do_use_add() {
+ local parm1=$1
+ local use_add_out=${@:2}
+ # First strip existing flags (matching or inverse), then add.
+ # This is not the best way to do this. Better would be to replace a
+ # flag if it already exists. That turned out to be a real PITA.
+ # Maybe in a later version...
+ use_add_out=`do_use_rm ${parm1} ${use_add_out}`
+ use_add_out="${use_add_out} ${parm1}"
+ echo "${use_add_out}"
+}
+
+# Adds a flag to the locked flag cache
+# Pass list of flags to lock as parameter.
+do_lock_flags() {
+ local flag_list=$@
+ # Merge the new list of flags flags that are already locked.
+ if [ -r ${lock_cache} ]; then
+ local lock_old=`cat ${lock_cache}`
+ fi
+ flag_list="${lock_old} ${flag_list}"
+ # Remove duplicates.
+ echo "${flag_list}" | tr ' ' '\n' | sort | uniq | tr '\n' ' '
+}
+
+# Writes the list of locked flags to the cache file
+# Pass list of flags to write as parameter.
+do_write_lock() {
+ local write_flags=$@
+ if [ -r ${make_conf} ]; then
+ local make_prune=`do_get_make nodashes`
+ else
+ do_report_err ${make_conf} read
+ fi
+ # Be sure and remove any locked flags that no longer exist in USE.
+ for prune in ${write_flags}; do
+ local prune_test=`do_get_depr ${prune} ${make_prune}`
+ if [ "$prune_test" = "" ]; then
+ local new_cache="${prune} ${new_cache}"
+ fi
+ done
+ if [ -w ${use_cache_parent} ]; then
+ mkdir -p ${use_cache_dir}
+ chmod 700 ${use_cache_dir}
+ echo "${new_cache}" > ${lock_cache}
+ chmod 600 ${lock_cache}
+ else
+ do_report_err ${lock_cache} write
+ fi
+}
+
+# Writes new USE variable to make.conf
+# Pass new list of USE flags as parameter.
+do_write_make() {
+ local use_write="USE=\"$@\""
+ local old_use="USE=\"`do_get_make dashes`\""
+ if [ -w ${make_conf} ] && [ -w ${make_conf_dir} ]; then
+ local use_write="USE=\"$@\""
+ local old_use=`grep "USE=\"" ${make_conf} | grep -v "#"`
+ local start_line=`grep -n "USE=\"" ${make_conf} | \
+ grep -v "#" | cut -d ":" -f1`
+ if [ "${old_use:0-1}" != "\\" ]; then
+ sed -e "s/${old_use}/${use_write}/" ${make_conf} > \
+ ${make_temp}
+ else
+ sed -e "s/${old_use}\\/${use_write}/" ${make_conf} > \
+ ${make_temp}
+ fi
+ let start_line="${start_line} + 1"
+ if [ "${old_use:0-1}" != "\"" ]; then
+ del_line=`head -n ${start_line} ${make_temp} | \
+ tail -n 1`
+ until [ "${del_line:0-1}" != "\\" ]; do
+ let del_length="${#del_line} - 1"
+ del_line="${del_line:0:${del_length}}"
+ grep -v -w "${del_line}" ${make_temp} > \
+ ${make_temp}.2
+ mv ${make_temp}.2 ${make_temp}
+ del_line=`head -n ${start_line} \
+ ${make_temp} | tail -n 1`
+ done
+ let del_length="${#del_line} - 1"
+ del_line="${del_line:0:${del_length}}"
+ grep -v -x "${del_line}\"" ${make_temp} > \
+ ${make_temp}.2
+ mv ${make_temp}.2 ${make_temp}
+ fi
+ mv ${make_temp} ${make_conf}
+ else
+ do_report_err ${make_conf} write
+ fi
+}
+
+# Reports a read/write error and exits
+# parm1 = File to report on
+# parm2 = read, write, etc
+do_report_err() {
+ local parm1=$1
+ local parm2=$2
+ if [ "${parm2}" = "read" ]; then
+ echo "!!! Could not read ${parm1}"
+ echo -n "!!! Verify that file exists and that you have "
+ echo "appropriate permissions."
+ elif [ "${parm2}" = "write" ]; then
+ echo "!!! Could not write ${parm1}"
+ echo "!!! Got root?"
+ elif [ "${parm2}" = "nolock" ]; then
+ echo "!!! Could not read ${parm1}"
+ echo -n "!!! You have no locked flags or you have "
+ echo "insufficient permissions."
+ fi
+ exit 1
+}
+
+
+# The main section of the script
+# desc:
+# This is the feature for getting USE descriptions.
+if [ "$1" = "desc" ] || [ "$1" = "-i" ]; then
+ if [ -r ${use_desc} ]; then
+ for flag in ${@:2}; do
+ do_get_desc ${flag}
+ done
+ else
+ do_report_err ${use_desc} read
+ fi
+
+# show:
+# This is the feature for showing the contents of the USE variable.
+elif [ "$1" = "show" ] || [ "$1" = "-s" ]; then
+ if [ -r ${make_conf} ]; then
+ do_get_make dashes
+ else
+ do_report_err ${make_conf} read
+ fi
+
+# del:
+# This is the feature for removing a USE flag.
+elif [ "$1" = "del" ] || [ "$1" = "-d" ]; then
+ if [ -r ${make_conf} ]; then
+ make_use=`do_get_make dashes`
+ else
+ do_report_err ${make_conf} read
+ fi
+ for flag in ${@:2}; do
+ # Strip leading dashes.
+ if [ "${flag:0:1}" = "-" ]; then
+ flag="${flag:1}"
+ fi
+ del_test1=`do_get_depr ${flag} ${make_use}`
+ del_test2=`do_get_depr -${flag} ${make_use}`
+ if [ "${del_test1}" = "" ] || [ "${del_test2}" = "" ]; then
+ changes="1"
+ make_use=`do_use_rm ${flag} ${make_use}`
+ else
+ echo "!!! ${flag} is not in your USE variable."
+ fi
+ done
+ if [ "${changes}" != "0" ]; then
+ do_write_make ${make_use}
+ # Prune deleted USE flags from lock cache
+ lock_flags=`do_lock_flags $2`
+ do_write_lock ${lock_flags}
+ fi
+
+# add:
+# This is the feature for explicitly enabling or disabling a USE flag.
+elif [ "$1" = "add" ] || [ "$1" = "-a" ]; then
+ if [ -r ${make_conf} ]; then
+ make_use=`do_get_make dashes`
+ else
+ do_report_err ${make_conf} read
+ fi
+ for flag in ${@:2}; do
+ changes="1"
+ make_use=`do_use_add ${flag} ${make_use}`
+ done
+ if [ "${changes}" != "0" ]; then
+ do_write_make ${make_use}
+ fi
+
+# lock:
+# This is the feature to lock a deprecated USE flag to prevent removal
+elif [ "$1" = "lock" ] || [ "$1" = "-l" ]; then
+ if [ -r ${make_conf} ]; then
+ make_use=`do_get_make nodashes`
+ else
+ do_report_err ${make_conf} read
+ fi
+ for flag in ${@:2}; do
+ # Strip leading dashes.
+ if [ "${flag:0:1}" = "-" ]; then
+ flag="${flag:1}"
+ fi
+ lock_test=`do_get_depr ${flag} ${make_use}`
+ if [ "${lock_test}" = "" ]; then
+ lock_flags="${lock_flags} ${flag}"
+ else
+ echo "!!! ${flag} is not in your USE variable."
+ fi
+ done
+ lock_out=`do_lock_flags ${lock_flags}`
+ do_write_lock ${lock_out}
+
+# unlock:
+# This is the feature to unlock a deprecated USE flag to allow removal
+elif [ "$1" = "unlock" ] || [ "$1" = "-k" ]; then
+ if [ -r ${lock_cache} ]; then
+ lock_out=`cat ${lock_cache}`
+ else
+ do_report_err nolock
+ fi
+ for flag in ${@:2}; do
+ # Strip leading dashes.
+ if [ "${flag:0:1}" = "-" ]; then
+ flag="${flag:1}"
+ fi
+ lock_flag_check=`do_get_depr ${flag} ${lock_out}`
+ if [ "${lock_flag_check}" = "" ]; then
+ lock_out=`do_use_rm ${flag} ${lock_out}`
+ else
+ echo "!!! ${flag} is not a locked flag."
+ fi
+ done
+ do_write_lock ${lock_out}
+
+# showlock:
+# This feature prints a list of USE flags that have been locked
+elif [ "$1" = "showlock" ] || [ "$1" = "-w" ]; then
+ if [ -r ${lock_cache} ]; then
+ cat ${lock_cache}
+ else
+ do_report_err nolock
+ fi
+
+# update:
+# This is the feature to update your USE by removing deprecated flags and
+# handling new flags.
+elif [ "$1" = "update" ] || [ "$1" = "-u" ]; then
+ if [ -r ${make_conf} ]; then
+ # Get our USE but strip leading dashes
+ make_use=`do_get_make nodashes`
+ else
+ do_report_err ${make_conf} read
+ fi
+ # Get available USE flags from use.desc
+ if [ -r ${use_desc} ]; then
+ use_avail=`do_get_avail`
+ else
+ do_report_err ${use_desc} read
+ fi
+ # First we check for deprecated flags.
+ echo "Your USE variable currently looks like this:"
+ echo
+ echo `do_get_make dashes`
+ echo
+ # Print the list of locked flags if any exist.
+ if [ -r ${lock_cache} ]; then
+ lock_test=`cat ${lock_cache} | tr -d ' '`
+ if [ "${lock_test}" != "" ]; then
+ echo "The following flags are locked:"
+ cat ${lock_cache}
+ echo
+ fi
+ fi
+ echo
+ echo "*** Checking for deprecated USE flags ..."
+ echo
+ for check_flag in ${make_use}; do
+ depr_ret=`do_get_depr ${check_flag} ${use_avail}`
+ flag_depr="${flag_depr}${depr_ret}"
+ done
+ # Filter out locked flags
+ if [ -r ${lock_cache} ] && [ "${lock_test}" != "" ]; then
+ lock_list=`cat ${lock_cache}`
+ for check_locks in ${flag_depr}; do
+ lock_ret=`do_get_depr ${check_locks} ${lock_list}`
+ lock_out="${lock_out}${lock_ret}"
+ done
+ flag_depr="${lock_out}"
+ fi
+ make_use=`do_get_make dashes`
+ if [ "${flag_depr}" = "" ]; then
+ echo "!!! No deprecated flags were found."
+ else
+ echo "The following USE flags appear to be deprecated:"
+ echo "${flag_depr}"
+ echo
+ echo "How would you like to handle them?"
+ echo "1) Handle them individually"
+ echo "2) Remove all deprecated flags"
+ echo "3) Don't remove any deprecated flags"
+ echo "4) Lock all deprecated flags"
+ echo
+ echo -n "Type (1, 2, 3, or 4): "
+ while [ "${luser_input}" = "" ]; do
+ read luser_input
+ case ${luser_input} in
+ "2")
+ changes="1"
+ for flag in ${flag_depr}; do
+ make_use=`do_use_rm \
+ ${flag} ${make_use}`
+ done
+ echo
+ echo -n "*** All deprecated flags were "
+ echo "removed."
+ ;;
+ "3")
+ echo
+ echo "*** No flags were removed."
+ ;;
+ "1")
+ for flag in ${flag_depr}; do
+ echo -n "${flag} appears to be "
+ echo -n "deprecated. Remove it? "
+ echo -n "[Y]es/[N]o/[L]ock : "
+ luser_yn=""
+ while [ "${luser_yn}" = "" ]; do
+ read luser_yn
+ case ${luser_yn} in
+ "y" | "Y")
+ changes="1"
+ make_use=`do_use_rm \
+ ${flag} \
+ ${make_use}`
+ ;;
+ "n" | "N")
+ ;;
+ "l" | "L")
+ wlk="${flag} ${wlk}"
+ ;;
+ *)
+ luser_yn=""
+ ;;
+ esac
+ done
+ done
+ echo
+ echo -n "*** All deprecated flags "
+ echo "processed."
+ ;;
+ "4")
+ wlk="${flag_depr}"
+ echo
+ echo "*** All deprecated flags were locked."
+ ;;
+ *)
+ luser_input=""
+ ;;
+ esac
+ done
+ fi
+ if [ "${wlk}" != "" ]; then
+ do_write_lock ${wlk}
+ fi
+ # Now we check for new flags.
+ echo
+ echo
+ echo "*** Checking for new USE flags ..."
+ echo
+ # Load up our cached USE flags for comparison with use.desc
+ # Create the cache if it does not exist
+ if [ -w ${use_cache} ]; then
+ use_old=`cat ${use_cache}`
+ echo "${use_avail}" > ${use_cache}
+ chmod 600 ${use_cache}
+ elif [ -w ${use_cache_parent} ]; then
+ mkdir -p ${use_cache_dir}
+ chmod 700 ${use_cache_dir}
+ echo "${use_avail}" > ${use_cache}
+ chmod 600 ${use_cache}
+ use_old=""
+ else
+ do_report_err ${use_cache} write
+ fi
+ # Grab the contents of the USE variable.
+ make_cand=`do_get_make nodashes`
+ # Build a list of flags that do not exist in the USE variable.
+ for flag in ${use_avail}; do
+ new_cand="${new_cand}`do_get_depr ${flag} ${make_cand}`"
+ done
+ # Filter that list through the cached master list of flags.
+ for flag in ${new_cand}; do
+ new_flags="${new_flags}`do_get_depr ${flag} ${use_old}`"
+ done
+ if [ "${new_flags}" = "" ]; then
+ echo "!!! No new USE flags are available."
+ else
+ echo "The following new USE flags are available:"
+ echo "${new_flags}"
+ echo
+ echo "How would you like to handle them?"
+ echo "1) Handle them individually"
+ echo "2) Use Portage defaults (do not add to USE)"
+ echo "3) Explicitly enable all new flags"
+ echo "4) Explicitly disable all new flags"
+ echo
+ echo -n "Type (1, 2, 3, or 4): "
+ luser_input=""
+ while [ "${luser_input}" = "" ]; do
+ read luser_input
+ case ${luser_input} in
+ "1")
+ for h_flag in ${new_flags}; do
+ do_get_desc ${h_flag}
+ echo -n "How would you like to handle "
+ echo -n "${h_flag}? [e]nable, "
+ echo -n "[d]isable, [u]se default : "
+ luser_handle=""
+ while [ "${luser_handle}" = "" ]; do
+ read luser_handle
+ case ${luser_handle} in
+ "e" | "E")
+ changes="1"
+ make_use=`do_use_add \
+ ${h_flag} \
+ ${make_use}`
+ echo
+ ;;
+ "d" | "D")
+ changes="1"
+ make_use=`do_use_add \
+ "-${h_flag}" \
+ ${make_use}`
+ echo
+ ;;
+ "u" | "U")
+ echo
+ ;;
+ *)
+ luser_handle=""
+ ;;
+ esac
+ done
+ done
+ echo -n "*** All new flags have been "
+ echo "processed."
+ ;;
+ "2")
+ echo
+ echo -n "*** No new flags were added to "
+ echo "your USE."
+ ;;
+ "3")
+ changes="1"
+ for h_flag in ${new_flags}; do
+ make_use=`do_use_add ${h_flag} \
+ ${make_use}`
+ done
+ echo
+ echo -n "*** All new flags were enabled in "
+ echo "your USE."
+ ;;
+ "4")
+ changes="1"
+ for h_flag in ${new_flags}; do
+ make_use=`do_use_add \
+ "-${h_flag}" ${make_use}`
+ done
+ echo
+ echo -n "*** All new flags were disabled in "
+ echo "your USE."
+ ;;
+ *)
+ luser_input=""
+ ;;
+ esac
+ done
+ fi
+ # Write the changes if necessary.
+ if [ "${changes}" != "0" ]; then
+ do_write_make ${make_use}
+ # Prune any locked flags that do not exist in the USE variable
+ lock_prot=`do_lock_flags fakeflag`
+ do_write_lock ${lock_prot}
+ fi
+ echo
+ echo
+ echo "*** Script finished ..."
+
+# Display USAGE statement for unhandled parameters
+else
+ echo "Usage:"
+ echo " ${run_name} action [flag] [...]"
+ echo
+ echo "Actions:"
+ echo "-s, show Displays the contents of the USE variable."
+ echo "-i, desc Displays a description of one or more USE flags."
+ echo -n "-a, add Adds the specified flag(s) to the USE "
+ echo "variable."
+ echo -n "-d, del Deletes the specified flag(s) from "
+ echo "the USE variable."
+ echo "-l, lock Locks the specified flag(s) to prevent deprecation."
+ echo -n "-k, unlock Unlocks the specified flags to allow "
+ echo "deprecation."
+ echo "-w, showlock Displays a list of locked flags."
+ echo -n "-u, update Interactively updates the USE variable to "
+ echo "reflect changes"
+ echo " to use.desc."
+ echo
+ exit 1
+fi
+exit 0
+
diff --git a/deprecated/useflag/useflag.1 b/deprecated/useflag/useflag.1
new file mode 100644
index 0000000..d321861
--- /dev/null
+++ b/deprecated/useflag/useflag.1
@@ -0,0 +1,69 @@
+.TH useflag "1" "May 2002" "gentoolkit"
+.SH NAME
+useflag \- manage and update Gentoo Linux USE flags
+.SH SYNOPSIS
+.B useflag
+\fIaction\fR [\fIflag\fR] [\fI...\fR]
+.SH DESCRIPTION
+The \fBuseflag\fR utility allows the user to manage Gentoo Linux USE flags through a simple command-line interface. It allows quick and easy, single-command manipulation of the USE variable defined in \fI/etc/make.conf\fR. It also simplifies the process of handling changes to the master list of USE flags defined in \fI/usr/portage/profile/use.desc\fR.
+.br
+
+It is important to note that a USE variable must exist in \fImake.conf\fR for this utility to work. Be sure that the USE variable is uncommented. It is OK for the USE variable to be empty. Please be sure to back up \fImake.conf\fR before using this utility for the first time.
+.PP
+.SH ACTIONS
+.TP
+\fBshow, -s\fR
+Displays the raw contents of the USE variable as defined in \fImake.conf\fR. The output contains only the flags themselves.
+.TP
+\fBdesc, -i [flag] ...\fR
+Displays a description of one or more USE flags specified on the command line. The flags should be seperated by spaces and should not contain leading dashes. Specifying a flag that does not exist returns a non-fatal error.
+.TP
+\fBadd, -a [[\-]flag] ...\fR
+Adds one or more specified flags to the USE variable defined in \fImake.conf\fR. The flags are appended to the USE variable exactly as they appear on the command line. If a specified flag already exists in the USE variable, it is removed before the new set of flags is appended. The utility removes existing flags regardless of whether they are in an enabled or disabled state, allowing the user to enable or disable a flag with a single command. The user may add flags that are not defined in the \fIuse.desc\fR master list.
+.TP
+\fBdel, -d [flag] ...\fR
+Deletes one or more specified flags from the USE variable defined in \fImake.conf\fR. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored. Attempting to delete a flag that is not in the USE variable returns a non-fatal error. When a flag is deleted from the USE variable using this utility, it is automatically unlocked.
+.TP
+\fBlock, -l [flag] ...\fR
+Locks one or more specified flags that exist in the USE variable defined in \fImake.conf\fR. Locked flags are not considered to be deprecated by the update function of this utility. This allows the user to avoid being queried by the utility about deprecated, undocumented, or custom flags that the user wishes to preserve when performing an update. A flag must exist in the USE variable in order to be locked. The enabled/disabled state of a flag in the USE variable as well as any dashes prepended to flags on the command line is ignored.
+.TP
+\fBunlock, -k [flag] ...\fR
+Unlocks one or more specified USE flags. This allows the update function to consider a flag deprecated if it no longer exists in the master list defined in \fIuse.desc\fR. Any dashes prepended to flags on the command line are ignored. Attempting to unlock flags that are not locked returns a non-fatal error.
+.TP
+\fBshowlock, -w\fR
+Displays the raw list of locked flags, seperated by spaces.
+.TP
+\fBupdate, -u\fR
+Interactively updates the USE variable defined in \fImake.conf\fR to reflect changes to the master list of USE flags defined in \fI use.desc\fR.
+.br
+
+First, the user is presented with the current raw contents of the USE variable. The user is also shown the list of locked flags if any exist.
+.br
+
+Next, the USE variable is searched for flags that do not appear in the master list. If any are found and they are not locked, then they are considered to be deprecated and are displayed to the user along with a list of options for handling them. The user may choose to remove all of the flags, remove none of the flags, lock all of the flags, or handle each flag individually.
+.br
+
+Last, the master list is searched for any new flags that have become available since the last time the update function was run, and these are displayed to the user. If this is the first time, then all flags not currently defined in the USE variable will be displayed. The user will then be presented with a list of options for handling these flags. The user may choose to add all of the new flags to the USE variable as enabled, add all of the new flags as disabled, use Portage defaults for all of the flags, or handle each flag individually.
+.SH FILES
+.TP
+\fI/etc/make.conf\fR
+Contains the USE variable that Portage uses to control build-time functionality.
+.TP
+\fI/usr/portage/profile/use.desc\fR
+Contains a master list of all documented USE flags along with their descriptions.
+.TP
+\fI/var/cache/use_desc/use.cache\fR
+Contains a cached list of flags from \fIuse.desc\fR. This prevents the user from being repeatedly queried about flags that exist in \fIuse.desc\fR but not in the USE variable. DO NOT EDIT THIS FILE MANUALLY.
+.TP
+\fI/var/cache/use_desc/lock.cache\fR
+Contains a list of USE flags that have been locked. DO NOT EDIT THIS FILE MANUALLY.
+.SH AUTHOR
+Michael Thompson <psionix@grandecom.net>, 2002
+.SH SEE ALSO
+ebuild(1), ebuild(5), emerge(1), make.conf(5).
+.TP
+See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
+.SH TIPS
+.TP
+Deleting \fI/var/cache/use_desc/use.cache\fR will allow the utility to query about all flags not currently defined in the USE variable.
+