More build system updates; renamed gentool to equery
authorkarltk <karltk@gentoo.org>
Wed, 7 Jan 2004 13:21:01 +0000 (13:21 -0000)
committerkarltk <karltk@gentoo.org>
Wed, 7 Jan 2004 13:21:01 +0000 (13:21 -0000)
svn path=/; revision=49

29 files changed:
trunk/ChangeLog
trunk/Makefile
trunk/TODO
trunk/makedefs.mak
trunk/src/echangelog/ChangeLog [new file with mode: 0644]
trunk/src/echangelog/TODO [moved from trunk/src/gentool/TODO with 100% similarity]
trunk/src/ekeyword/ChangeLog [new file with mode: 0644]
trunk/src/ekeyword/Makefile
trunk/src/ekeyword/TODO [moved from trunk/src/gentool/README with 100% similarity]
trunk/src/equery/AUTHORS [moved from trunk/src/gentool/AUTHORS with 100% similarity]
trunk/src/equery/ChangeLog [moved from trunk/src/gentool/ChangeLog with 81% similarity]
trunk/src/equery/Makefile [moved from trunk/src/gentool/Makefile with 100% similarity]
trunk/src/equery/README [new file with mode: 0644]
trunk/src/equery/TODO [new file with mode: 0644]
trunk/src/equery/equery [moved from trunk/src/gentool/gentool with 99% similarity]
trunk/src/equery/equery.1 [moved from trunk/src/gentool/gentool.1 with 72% similarity]
trunk/src/etcat/ChangeLog
trunk/src/etcat/etcat.1
trunk/src/euse/ChangeLog
trunk/src/gentool/gentool-bump-revision [deleted file]
trunk/src/gentool/gentool-bump-revision.1 [deleted file]
trunk/src/gentool/gentool-package-count [deleted file]
trunk/src/gentool/gentool-package-count.1 [deleted file]
trunk/src/gentool/gentool-package-size [deleted file]
trunk/src/gentool/gentool-package-size.1 [deleted file]
trunk/src/qpkg/ChangeLog
trunk/src/qpkg/qpkg
trunk/src/qpkg/qpkg.1
trunk/src/revdep-rebuild/Makefile

index e8daca537693a4b82e63e86f606fa82d2063d4af..6868ef04fd6fea4e19f628748b69f172207848ce 100644 (file)
@@ -1,7 +1,8 @@
 
 2003-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
-        * Added new build system
-        * Added src/old-scripts, the scripts from app-portage/gentoolkit
+       * Added new build system
+       * Added src/old-scripts, the scripts from app-portage/gentoolkit
+       * Renamed gentool to equery
         
 2003-12-08 Karl Trygve Kalleberg <karltk@gentoo.org>
        * Removed emerge-rsync, emerge-webrsync
index 8e9160cf8f651ce915e40d585a08a82422f69715..ef1074a56eace1d2d92c008970827355834644de 100644 (file)
@@ -18,22 +18,36 @@ all:
 
 dist:
        echo "Err0r: Must use either dist-gentoolkit or dist-gentoolkit-dev"
+       exit 1
 
 dist-gentoolkit-dev:
-       echo "You wish..."
+       mkdir -p release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)
+       for x in ekeyword echangelog ; do \
+               ( cd src/$$x ; make distdir=release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG) dist ) \
+       done
+       cp {Makefile,AUTHORS,README,README.Developer,TODO,COPYING,NEWS,ChangeLog} release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/
+       cat makedefs.mak | \
+               sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \
+               sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" | \
+               sed "s:^docdir=.*:docdir=\$$(DESTDIR)/usr/share/doc/gentoolkit-dev-\$$(VERSION)\$$(RELEASE_TAG):" \
+               > release/gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/makedefs.mak
+       ( cd release ; tar zcf gentoolkit-dev-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-dev-$(VERSION)$(RELEASE_TAG)/ )
 
 dist-gentoolkit:
-       mkdir -p dist/gentoolkit-$(VERSION)
-       for x in gentool etcat euse qpkg revdep-rebuild old-scripts ; do \
-               ( cd src/$$x ; make distdir=dist/gentoolkit-$(VERSION) dist ) \
+       mkdir -p release/gentoolkit-$(VERSION)$(RELEASE_TAG)
+       for x in equery etcat euse qpkg revdep-rebuild old-scripts ; do \
+               ( cd src/$$x ; make distdir=release/gentoolkit-$(VERSION)$(RELEASE_TAG) dist ) \
        done
-       cp {Makefile,AUTHORS,README,TODO,COPYING,NEWS,ChangeLog} dist/gentoolkit-$(VERSION)/
-       cat makedefs.mak | sed "s/^VERSION=.*/VERSION=$(VERSION)/" > dist/gentoolkit-$(VERSION)/makedefs.mak
-       ( cd dist ; tar zcf gentoolkit-$(VERSION).tar.gz gentoolkit-$(VERSION)/ )
+       cp {Makefile,AUTHORS,README,TODO,COPYING,NEWS,ChangeLog} release/gentoolkit-$(VERSION)$(RELEASE_TAG)/
+       cat makedefs.mak | \
+               sed "s/^VERSION=.*/VERSION=$(VERSION)/" | \
+               sed "s/^RELEASE_TAG=.*/RELEASE_TAG=$(RELEASE_TAG)/" \
+               > release/gentoolkit-$(VERSION)$(RELEASE_TAG)/makedefs.mak
+       ( cd release ; tar zcf gentoolkit-$(VERSION)$(RELEASE_TAG).tar.gz gentoolkit-$(VERSION)$(RELEASE_TAG)/ )
 
 install:
        echo "Err0r: Must use either install-gentoolkit or install-gentoolkit-dev"
-
+       exit 1
 
 install-gentoolkit:
 
@@ -44,21 +58,20 @@ install-gentoolkit:
 
        install -m 0644 {AUTHORS,ChangeLog,COPYING,NEWS,README,TODO} $(docdir)/
 
-       for x in gentool etcat euse qpkg revdep-rebuild old-scripts ; do \
+       for x in equery etcat euse qpkg revdep-rebuild old-scripts ; do \
                ( cd src/$$x ; make DESTDIR=$(DESTDIR) install )  \
        done
 
+# FIXME: If run from the CVS tree, the documentation will be installed in
+#        $(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION), not gentoolkit-dev-$(VERSION)
 install-gentoolkit-dev:
 
-# FIXME: we override the docdir for the -dev package, should be prettier
-       docdir=$(DESTDIR)/usr/share/doc/gentoolkit-dev-$(VERSION)
-
        install -d $(docdir)
        install -d $(bindir)
-       install -d $(sbindir)
        install -d $(mandir)
 
        install -m 0644 {AUTHORS,ChangeLog,COPYING,NEWS,README,README.Developer,TODO} $(docdir)/
 
-       for x in ekeyword echangelog ; do
-               ( cd src/$(x) ; make DESTDIR=$(DESTDIR) install ) 
+       for x in ekeyword echangelog ; do \
+               ( cd src/$$x ; make DESTDIR=$(DESTDIR) install ) \
+       done
index 44714e17faf054e6fc7c5110e81843df35ae7817..548a3b744352cc313d69a8ae701bb7eb5ac28129 100644 (file)
@@ -1,5 +1,4 @@
-- add dist to Makefile
-- gentool:
+- equery:
  - add --overlay, --portdir to uses
  - add glsa pkgspec
   - query for current GLSAs on installed package(s)
@@ -9,26 +8,22 @@
   - check md5 and timestamps (optionally also in CONFIG_PROTECT dirs)
  - add which
   - as ewhich
-- merge dep-clean and pkg-clean to use gentoolkit
+- fully deprecate dep-clean and pkg-clean
 - rewrite ekeywords and echangelog to use gentoolkit
-- add deep depends to etcat
-- rewrite qpkg to use gentoolkit
-- rewrite epm to use gentoolkit
-- merge emerge-rsync and emerge-webrsync
-- drop pkg-size (callfwd to etcat size)
+- add deep depends to equery
+- fully deprecate qpkg 
+- fully deprecate pkg-size
 - merge change and echangelog
 - merge useflag and euse, have _one_ command line tool
   - update ufed to rely on the CLI tool
   - update ufed to rely on generate-use
   - merge generate-use and ufed?
 - rewrite revdep-rebuild to use gentoolkit
+ - drop qpkg dependency; use equery instead
 - rewrite distfiles-clean to use gentoolkit
-- rewrite etc-update to use gentoolkit, add UI
-- add genlop
 - look through forums.gentoo.org for additional scripts
 - write a Gentoolkit Guide
 - write efeatures for turning on/off FEATURES in make.conf
 - look at ekeys, ewatch
 
 + check esearch, eupdatedb: separate package for now
-+ extract helper code from etcat
index 2e1d56b6acf0220d6f257e3c3cf81dcb6ef9650e..98155a55892b5fdbc4f5d8842a2cbfdbd7fc8369 100644 (file)
@@ -7,10 +7,11 @@
 # Override this on command line when making a release, ie 'dist'
 
 VERSION=9.9.9
+RELEASE_TAG=
 PYVERSION="`python-config | sed 's/-l//' | sed 's/ -lm.*//'`"
 DESTDIR=
 
-docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)
+docdir=$(DESTDIR)/usr/share/doc/gentoolkit-$(VERSION)$(RELEASE_TAG)
 bindir=$(DESTDIR)/usr/bin
 sbindir=$(DESTDIR)/usr/sbin
 mandir=$(DESTDIR)/usr/share/man/man1
diff --git a/trunk/src/echangelog/ChangeLog b/trunk/src/echangelog/ChangeLog
new file mode 100644 (file)
index 0000000..6cdc211
--- /dev/null
@@ -0,0 +1,2 @@
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Added Makefile
diff --git a/trunk/src/ekeyword/ChangeLog b/trunk/src/ekeyword/ChangeLog
new file mode 100644 (file)
index 0000000..6cdc211
--- /dev/null
@@ -0,0 +1,2 @@
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Added Makefile
index ad793bb7559e320c27305f2a1f2384d104a3d8a7..487930f420dd3fc7e9d00788c8afc4988d9de1f4 100644 (file)
@@ -4,7 +4,7 @@
 #
 # $Header$
 
-include ../../makdefs.mak
+include ../../makedefs.mak
 
 all:
        echo "ALBACETE (AL-ba-seet n.) A single surprisingly long hair growing in the middle of nowhere."
similarity index 81%
rename from trunk/src/gentool/ChangeLog
rename to trunk/src/equery/ChangeLog
index 94dfaafd5999c13e2b5289d04cf384e932e61112..708cbcf30aad520164c7fac71920d981778b625f 100644 (file)
@@ -1,3 +1,7 @@
+2003-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Renamed to equery
+       * Added Makefile
+       
 2003-12-31 Karl Trygve Kalleberg <karltk@gentoo.org>
        * Added which command
        * Added check command (not finished)
diff --git a/trunk/src/equery/README b/trunk/src/equery/README
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/trunk/src/equery/TODO b/trunk/src/equery/TODO
new file mode 100644 (file)
index 0000000..e69de29
similarity index 99%
rename from trunk/src/gentool/gentool
rename to trunk/src/equery/equery
index 34128afe4288576d5653003cf1d9a29f46e1bc74..40b2e10f26220918a3f1fc5347f125dfb6ace53b 100755 (executable)
@@ -10,7 +10,7 @@
 __author__ = "Karl Trygve Kalleberg"
 __email__ = "karltk@gentoo.org"
 __version__ = "0.1.0"
-__productname__ = "gentool"
+__productname__ = "equery"
 __description__ = "Gentoo Package Query Tool"
 
 import re
@@ -61,7 +61,7 @@ class Command:
     def __init__(self):
         pass
     def shortHelp(self):
-        return "short help description"
+        return " - not implemented yet"
     def longHelp(self):
         return "help for syntax and options"
     def perform(self, args):
@@ -845,7 +845,7 @@ def printVersion():
     print "Author(s): " + __author__
     
 def printUsage():
-    print white("Usage: ") + turquoise("gentool") + yellow(" <global-opts> ") + green("command") + yellow(" <local-opts>")
+    print white("Usage: ") + turquoise(__productname__) + yellow(" <global-opts> ") + green("command") + yellow(" <local-opts>")
     print "where " + yellow("<global-opts>") + " is one of"
     print yellow(" -q, --quiet") + "   - minimal output"
     print yellow(" -C, --nocolor") + " - turn off colours"
similarity index 72%
rename from trunk/src/gentool/gentool.1
rename to trunk/src/equery/equery.1
index 0f52b7fcd57c49f0674f70b59f69c26b5dee28c9..6e921af184697d93c9ca8c9162b51d192ed01c3b 100644 (file)
@@ -1,8 +1,8 @@
-.TH gentool "1" "Nov 2003" "gentoolkit"
+.TH equery "1" "Jan 2004" "gentoolkit"
 .SH NAME
-gentool \- Gentoo: Package Query Tool
+equery \- Gentoo: Package Query Tool
 .SH SYNOPSIS
-.B gentool
+.B equery
 .SH BUGS
 This tool does not yet have a man page. Feel free to submit a bug about it to
 http://bugs.gentoo.org
index 6e3e3f7f35a3daabc59537692cdc14059842ea27..57d90f35a9de0ed558f03c357307a472dd3c63eb 100644 (file)
@@ -1,3 +1,9 @@
+
+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
index b8f3328980fd1f067bfe9922a8470a00891e70bf..6704f3be77ac6e989ebd18b58b32654ec860e365 100644 (file)
@@ -1,7 +1,7 @@
 .TH "etcat" "1" "0.1.4" "Alastair Tse <liquidx@gentoo.org>" "Gentoo Administration"
 .SH "NAME"
 .LP 
-etcat \- Gentoo Portage Information Extractor
+etcat \- Gentoo: Portage Information Extractor
 .SH "SYNTAX"
 .LP 
 etcat [\fIoption\fP|command] <\fIquery|package\fP>
index 1aa2a6b9bde6760e218598ed2cfbc957cbd8f570..cb50dbb300194720fec823fdfb4bee9a02bde892 100644 (file)
@@ -1,5 +1,9 @@
-*euse-0.1.0 (09 May 2003)
 
-  09 May 2003; Arun Bhanu <codebear@gentoo.org>
-  Initial commit to gentoolkit. 
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Added Makefile
+       * Updated from app-portage/gentoolkit
+       * Reformatted ChangeLog
+       
+2003-05-09 Arun Bhanu <codebear@gentoo.org>
+       * Initial commit to gentoolkit. 
    
diff --git a/trunk/src/gentool/gentool-bump-revision b/trunk/src/gentool/gentool-bump-revision
deleted file mode 100755 (executable)
index 234b83c..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-# Copyright 2002-2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-# $Header$
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-
-if [ ! -f $HOME/.gentoo/gentool-env ] ; then
-       echo "You must make a $HOME/.gentoo/gentool-env file that contains"
-       echo "AUTHORNAME=\"Your name\""
-       echo "AUTHOREMAIL=\"Your @gentoo.org mail address\""
-fi
-
-. $HOME/.gentoo/gentool-env
-
-dn="`dirname $1`"
-bn="`basename $1`"
-ebuild=`echo $bn | sed "s/\.ebuild//"`
-
-ver=`echo $ebuild | sed "s/\(.*\)-\([0-9].*\)/\2/"`
-name=`echo $ebuild | sed "s/\(.*\)-\([0-9].*\)/\1/"`
-rev=`echo $ver | grep "\-r[0-9]*" | sed "s/.*-r\([0-9]*\)/\1/"`
-basever=`echo $ver | sed "s/-r[0-9]*//"`
-
-oldver=$ebuild
-newver=""
-if [ -z "$rev" ] ; then 
-       newver=${ebuild}-r1
-else 
-       newrev=$[rev + 1]
-       newver=${name}-${basever}-r${newrev}
-fi
-
-echo "# Directory   : $dn"
-echo "# Old version : $oldver"
-echo "# New version : $newver"
-echo
-
-cd ${dn}
-
-echo "Updating revisions for ebuilds digests"
-mv ${oldver}.ebuild ${newver}.ebuild
-mv files/digest-${oldver} files/digest-${newver}
-
-#echo "Removing old revisions from CVS"
-#cvs remove -f ${oldver}.ebuild
-#cvs remove -f files/digest-${oldver}
-
-echo "Adding new revisions to CVS"
-cvs add ${newver}.ebuild
-cvs add files/digest-${newver}
-
-if [ ! -f ChangeLog ] ; then
-       echo "!!! Cannot fix ChangeLog, does not exist" > /dev/stderr
-       exit -1
-fi
-
-echo "Adding new entry in ChangeLog"
-
-lns=`cat ChangeLog | wc -l | tr -d ' '`
-mv ChangeLog ChangeLog.orig
-(head -n 3 ChangeLog.orig ; 
-       echo ""
-       echo "*$newver (`date +\"%d %b %Y\"`)" ;
-       echo "" ;
-       echo "  `date +\"%d %b %Y\"`; $AUTHORNAME <$AUTHOREMAIL> ${newver}.ebuild files/digest-${newver}:" ;
-       echo "" ;
-       echo "  # INSERT COMMENT HERE" ;
-       echo "" ;
-       echo "  Removed ${oldver}.ebuild files/digest-${oldver}" ;
-       echo "" ; 
-       tail -n $[lns-4] ChangeLog.orig
-) > ChangeLog
diff --git a/trunk/src/gentool/gentool-bump-revision.1 b/trunk/src/gentool/gentool-bump-revision.1
deleted file mode 100644 (file)
index b7efc47..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-.TH gentool-bump-revision "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-bump-revision \- Bumps the revision number of a given package
-.SH SYNOPSIS
-.B gentool-bump-revision 
-\fIebuild\fR
-.SH DESCRIPTION
-The \fBgentool-bump-revision\fR utility bumps the revision of an existing
-ebuild in the Portage tree. It does this by copying the specified ebuild
-file to a new filename with an increased revision number. It takes care 
-of the digest file, adding both to CVS, and it also adds an entry in the 
-ChangeLog for you to fill in. After the revision bump, should always make
-certain any auxiliary files like scripts, etc, are installed properly.
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-change(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
diff --git a/trunk/src/gentool/gentool-package-count b/trunk/src/gentool/gentool-package-count
deleted file mode 100755 (executable)
index f7e02e4..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#! /bin/sh
-
-pcnt=`find /usr/portage/ -type f -name "*.ebuild" | sed "s/-[0-9].*//" | sort | uniq | wc -l`
-numebuilds=`find /usr/portage/ -type f -name "*.ebuild" | wc -l`
-numcat=`find /usr/portage/ -type d -name "*-*" -maxdepth 1 | wc -l`
-
-echo "Number of categories : $numcat"
-echo "Number of ebuilds    : $numebuilds"
-echo "Unique packages      : $pcnt"
diff --git a/trunk/src/gentool/gentool-package-count.1 b/trunk/src/gentool/gentool-package-count.1
deleted file mode 100644 (file)
index ad27479..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-.TH gentool-package-count "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-package-count\- Counts the number of packages available in the tree.
-.SH SYNOPSIS
-.B gentool-package-revision 
-.SH DESCRIPTION
-The \fBgentool-package-count\fR utility counts the number of packages
-available for installation in your local Portage tree. It will inform of
-total package count, total category count, and total unique packages. It 
-is completely useless.
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-gentool-package-size(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
diff --git a/trunk/src/gentool/gentool-package-size b/trunk/src/gentool/gentool-package-size
deleted file mode 100755 (executable)
index 7209a9a..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-#! /usr/bin/env python
-#
-# Copyright(c) 2002, Gentoo Technologies, Inc
-# Copyright(c) 2002, Karl Trygve Kalleberg <karltk@gentoo.org>
-# Distributed under the terms of the GNU General Public License v2
-#
-
-import sys
-import string
-import os
-import os.path
-
-base = "/var/db/pkg"
-
-def getdirs(path):
-    files = os.listdir(path)
-    dirs = []
-    for i in files:
-        if os.path.isdir(path + "/" + i):
-            dirs.append(i)
-    return dirs
-
-def findContentFile(spec):
-    k = string.split(spec,"/")
-
-    if len(k) == 2:
-        cat = k[0]
-        pnm = k[1]
-    else:
-        cat = ""
-        pnm = k[0]
-
-    if cat:
-        dirlist = os.listdir(base + "/" + cat)
-        for pkg in dirlist:
-            if string.find(pkg, pnm) == 0:
-                return (cat, pkg, base + "/" + cat + "/" + pkg + "/CONTENTS")
-    else:
-        cats = getdirs(base)
-        for cat in cats:
-            pkgs = getdirs(base + "/" + cat)
-            for pkg in pkgs:
-                if string.find(pkg, pnm) == 0:
-                    return (cat, pkg, base + "/" + cat + "/" + pkg + "/CONTENTS")
-    return None
-
-def main():
-    spec=sys.argv[1]
-
-    try:
-        (cat, pkg, contents) = findContentFile(spec)
-    except:
-        print "No package resembling '" + spec + "' found"
-        sys.exit(-1)
-        
-    ins = open(contents)
-    
-    files = []
-    inaccurate = 0
-    total = 0
-    for i in ins.readlines():
-        k = string.split(i)
-        if len(k) and k[0] == "obj":
-            files.append(k[1])
-    for i in files:
-        try:
-            total+=os.path.getsize(i)
-        except os.error:
-            inaccurate=1
-    k = str(total) + " (" + str(total/1024) + "kiB)"
-    if inaccurate:
-        k += " ~"
-    print cat + "/" + pkg + " " + k
-            
-if __name__ == "__main__":
-    main()
-
-"""
-#!/bin/sh
-
-# Copyright(c) 2002, Gentoo Technologies, Inc
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-
-spec=$1
-
-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::"`
-
-filelist=`cat $file|grep "obj"|awk '{ print $2 }' | sed "s/ /\\ /"`
-
-size=0
-for i in $filelist ; do
-    if [ -e $i ] ; then
-       s=`du -s $i | cut -f1`
-       size=$[size + s]
-    fi
-done
-#size=0
-#for i in $totals ; do 
-#      size=$[size+i]
-#done
-
-echo "$pkgname $size ($[size/1024]KB)"
-
-"""
diff --git a/trunk/src/gentool/gentool-package-size.1 b/trunk/src/gentool/gentool-package-size.1
deleted file mode 100644 (file)
index 29408b0..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-.TH gentool-package-size "1" "Nov 2002" "gentoolkit"
-.SH NAME
-gentool-package-size \- Calculates the diskspace occupied by a package
-.SH SYNOPSIS
-.B gentool-package-revision 
-\fIpackage-name\fR
-.SH DESCRIPTION
-The \fBgentool-package-revision\fR utility calculates the actual diskspace
-taken by a given package. It will not consider the parition block size. The 
-package name need not be absolute, the closest match is sought.
-.SH EXAMPLE
-.LP
-To look for the first package with a name starting with \fImozilla\fR:
-.RS
-.nf
-\fBgentool-package-revision mozilla\fP
-.fi
-.RE
-
-.LP
-To look for the first package in category \fInet-www\fR starting with
-\fImozilla\fR:
-.RS
-.nf
-\fBgentool-package-revision net-www/mozilla\fP
-.fi
-.RE
-
-.LP
-To only match a very specific version of \fImozilla\fR in the
-\fInet-www\fR category:
-.RS
-.nf
-\fBgentool-package-revision net-www/mozilla-1.0.1-r3\fP
-.fi
-.RE
-
-.SH AUTHOR
-Karl Trygve Kalleberg <karltk@gentoo.org>, 2002
-.SH SEE ALSO
-gentool-package-count(1)
-.TP
-See \fI/usr/share/doc/gentoolkit-<version>/\fR for documentation on other gentoolkit utilities.
-
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..6cdc2119956dafd5c2d6ec60abba30b6cc8eaac1 100644 (file)
@@ -0,0 +1,2 @@
+2004-01-07 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Added Makefile
index 41ff77b3b7a7253dad55caaafdee05929f3e54da..fafb62ee95e88734f311207e342dfdf5e794988a 100644 (file)
-#! /usr/bin/env python2.2
-#
-# Copyright 2003 Karl Trygve Kalleberg
-# Copyright 2003 Gentoo Technologies, Inc.
-# Distributed under the terms of the GNU General Public License v2
-#
-# $Header$
-# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
-#
+#!/bin/bash
 #
 # qpkg - query portage package system for various information
 #
-# This is a reimplementation of the previous qpkg, written in bash, by 
-# Vitaly Kushneriuk <vitaly_kushneriuk@yahoo.com>,
-# Brandon Low <lostlogic@gentoo.org>,
-# Josh Goebel <dreamer@firesedge.org>
+# 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} <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
+"
+       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 -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
+               home=`grep HOMEPAGE ${p}| cut -d\" -f2`
+               desc=`grep DESCRIPTION ${p}| cut -d\" -f2`
+               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
+                       if [[ $(grep -R "*${package}" /etc/make.profile/packages) != "" ]]; then
+                               echo -e "\t${color}SYSTEM PROFILE${NO}"
+                       fi
+               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}" $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 ::"
 
-import sys
-from output import *
-
-__author__ = "Karl Trygve Kalleberg"
-__email__ = "karltk@gentoo.org"
-__version__ = "0.2.0"
-__productname__ = "qpkg"
-__description__ = "Query Portage package system CLI tool"
-
-class Config:
-    showUsage=0
-    pass
-
-def showUsage():
-    
-    print turquoise("qpkg") + " v" + __version__ + " - Gentoo package query tool"
-
-    print white("Usage:")
-
-    print "\t" + turquoise("qpkg") + " " +\
-          "[" + white("options") + "] " + \
-          "[" + yellow("pkgname") + "] " + \
-          "[" + blue("-g") + " " + yellow("group") + "] " + \
-          "[" + blue("-f") + " " + yellow("<file>") + "|" + blue("-fp") + " " + yellow("<pattern") + "]"
-
-    print "\t" + turquoise("qpkg") + " " + blue("--dups") + " [" + blue("--slot") + "]"
-    print "\t" + turquoise("qpkg") + " " + blue("--help")
-
-    print "\n" + white("Duplicates:")
-    print blue("-d,   --dups") + "\t\tprint packages that have multiple versions installed"
-    print blue("-s,   --slot") + "\t\tmake " + blue("-d") + " SLOT only print dups of the same SLOT"
-
-    print "\n" + white("Package selection:")
-    print blue("-f,   --find-file") + "\tfinds package that owns file <file>"
-    print blue("-fp,  --find-pattern") + "\tfinds package that owns file matching *<pattern>*"
-    print blue("-m,   --masked") + "\t\tinclude " + yellow("only") + " masked packages"
-    print blue("-n,   --non-masked") + "\tinclude " + yellow("only") + " installed packages"
-    print blue("-U,   --uninstalled") + "\tinclude " + yellow("only") + " uninstalled packages"
-    print blue("-g,   --group") + "\t\tfind by group (can be combined with other searches"
-
-    print "\n" + white("Information selection:")
-    print blue("-l,   --list") + "\t\tlist package content"
-    print blue("-i,   --info") + "\t\tget package description and home page"
-    print blue("-ct,  --check-time")
-    print blue("-tc,  --time-check") + "\tverify package files' time stamps"
-    print blue("-cm,  --check-md5")
-    print blue("-mc,  --md5-check") + "\tverify package files md5"
-    print blue("-c,   --check") + "\t\tverify mtimes " + yellow("and") + "md5"
-    print blue("-q,   --query-deps") + "\tdisplay all installed packages" + \
-              "\n\t\t\tdepending on selected packages"
-
-    print "\n" + white("Operation modifiers:")
-    print blue("-nc, --no-color") + "\tdo not use colors"
-    print blue("-v,  --verbose") + "\tincrease verbosity [ can be repeated twice ]"
-    print blue("-vv") + "\t\tsame as " + blue("-v -v")
-
-    print "\n" + yellow("Notes")
-    print yellow("*") + " " + blue("-f, -fp, -d, -l, -ct, -cm") + " and " + \
-          blue("-c") + " apply only to installed packages"
-    print yellow("*") + " short options may not be combined on the command-line, yet"
-    print yellow("*") + " the operation of some flags has been changed by the " + \
-          "stripping of version\n" + \
-          "  numbers from some output to see the version numbers play with " + \
-          blue("-v") + " and " + blue("-vv")
-    print yellow("*") + " when using " + blue("-f") + " with " + blue("-l") + \
-              " or " + blue("--check.. -v") + " options, only matching files will be\n" + \
-              "  displayed, unless " + blue("-v") + " is doubled, or " + blue("--vv") + " is used"
-
-    print "\n" + yellow("Examples:")
-    print "qpkg --dups          print duplicates oldest first"
-    print "qpkg --dups -v       ... with versions"
-    print "qpkg                 print list of installed packages"
-    print "qpkg porta -I        print versions of installed portage"
-    print "qpkg porta -i        ... + versions in portage tree + descriptions and homepages"
-    print "qpkg gawk -c -v      check integrity of all installed versions of gawk, the\n" + \
-          "\t\t\tolder will have \"damaged\" files"
-    print "qpkg -f /bin/ls      print package(s) that own /bin/ls"
-
-def setupConfigDefaults():
-    Config.verbosity = 0
-    Config.color = 1
-    Config.showUsage = 0
-    Config.showPackageContents = 0
-    Config.showInstalled = 0
-    Config.showMasked = 0
-    Config.showDeps = 0
-    Config.showSlot = 0
-    Config.findFile = 0
-    Config.checkMD5 = 0
-    Config.checkTime = 0
-    
-def parseArgs():
-    setupConfigDefaults()
-
-    if len(sys.argv) < 2:
-        Config.showUsage = 1
-        return
-
-    args=sys.argv[1:]
-    skip=0
-    for x in range(len(args)):
-        # FIXME: Nasty skippery hackery
-        if skip:
-            skip-=1
-            continue
-        i=args[x]
-        if 0:
-            pass
-        elif i in ["-h","--help"]:
-            Config.showUsage = 1
-        elif i in ["-i","--info"]:
-            Config.showInfo = 1
-        elif i in ["-d","--dups"]:
-            Config.showDups = 1
-            Config.showInstalled = 1
-        elif i in ["-q","--query-deps"]:
-            Config.showDeps = 1
-        elif i in ["-s","--slot"]:
-            Config.showSlot = 1
-        elif i in ["-f","--find-file"]:
-            Config.findFile = 1
-            Config.showInstalled = 1
-        elif i in ["-fp","--find-pattern"]:
-            Config.findFile = 1
-            Config.findFilePattern = 1
-            Config.showInstalled = 1
-        elif i in ["-I","--installed"]:
-            Config.showInstalled = 1
-        elif i in ["-m", "--masked"]:
-            Config.showMasked = 1
-        elif i in ["-n", "--non-masked"]:
-            Config.showMasked = 0
-        elif i in ["-U","--uninstalled"]:
-            Config.showInstalled = 0
-        elif i in ["-g","--group"]:
-            Config.showCategory = args[x+1]
-            skip=1
-        elif i in ["-l", "--list"]:
-            Config.showPackageContents = 1
-            Config.showInstalled = 1
-        elif i in ["-ct","--check-time","-tc","--time-check"]:
-            Config.checkTime = 1
-            Config.showInstalled = 1
-        elif i in ["-cm","--check-md5","-mc","--md5-check"]:
-            Config.checkMD5 = 1
-            Config.showInstalled = 1
-        elif i in ["-v","--verbose"]:
-            Config.verbosity += 1
-        elif i in ["-vv"]:
-            Config.verbosity += 2
-        elif i in ["-nc","--no-color","--nocolor","--no-colors"]:
-            Config.color = 0
-        else:
-            print "xx:", i
-            Config.showUsage=1
-            break
-
-def showPackageContents():
-    print "showPackageContents"
-
-def checkMD5():
-    print "checkMD5"
-
-def checkTimeStamps():
-    print "checkTimeStamps"
-    
-def findFile():
-    print "findFile"
-
-def showDeps():
-    print "showDeps"
-    
-def main():
-    parseArgs()
-    if Config.showUsage:
-        showUsage()
-    elif Config.showPackageContents:
-        showPackageContents()
-    elif Config.checkMD5:
-        checkMD5()
-    elif Config.checkTime:
-        checkTimeStamps()
-    elif Config.findFile:
-        findFile()
-    elif Config.showDeps:
-        showDeps()
-    else:
-        raise "Don't know what do do..."
-    
-if __name__ == "__main__":
-    main()
+)
index e4164eafb3514bc39c85878d3adfb2f71ba4f1e3..6d45a9303f601b00c3aec64803e35353033a8701 100644 (file)
@@ -1,6 +1,6 @@
 .TH "qpkg" "1" "1.6" "gentoolkit 0.1.11-r1" ""
 .SH "NAME"
-qpkg \- the "query package" tool for Gentoo Linux
+qpkg \- Gentoo: query package tool
 .SH "SYNOPSIS"
 .LP 
 .B qpkg\fR     [\fIoptions\fR] [\fIpkgname\fR] [\fI\-g group\fR]
index 1150d0d3d65a640c1955450986f25572618d0e45..5c68147ea9ab9d6121f346ea13af1dc554b73e22 100644 (file)
@@ -15,7 +15,7 @@ dist:
 
 install:
 
-       install -m 0755 revdep-rebuild $(sbindir)/
+       install -m 0755 revdep-rebuild $(bindir)/
        install -d $(docdir)/revdep-rebuild     
        install -m 0644 {AUTHORS,README,TODO} $(docdir)/revdep-rebuild/
        install -m 0644 revdep-rebuild.1 $(mandir)/