Cleanups
authorkarltk <karltk@gentoo.org>
Fri, 22 Nov 2002 19:48:32 +0000 (19:48 -0000)
committerkarltk <karltk@gentoo.org>
Fri, 22 Nov 2002 19:48:32 +0000 (19:48 -0000)
svn path=/; revision=13

24 files changed:
trunk/AUTHORS
trunk/ChangeLog
trunk/TODO
trunk/src/change/AUTHORS
trunk/src/distfiles-clean/AUTHORS
trunk/src/epm/AUTHORS
trunk/src/gentool/AUTHORS [new file with mode: 0644]
trunk/src/gentool/ChangeLog [new file with mode: 0644]
trunk/src/gentool/README [moved from trunk/src/pkg-size/README with 100% similarity]
trunk/src/gentool/gentool-bump-revision [new file with mode: 0755]
trunk/src/gentool/gentool-bump-revision.1 [new file with mode: 0644]
trunk/src/gentool/gentool-package-count [moved from trunk/src/portage-statistics/pst-package-count with 100% similarity]
trunk/src/gentool/gentool-package-count.1 [new file with mode: 0644]
trunk/src/gentool/gentool-package-size [new file with mode: 0755]
trunk/src/gentool/gentool-package-size.1 [new file with mode: 0644]
trunk/src/pkg-size/AUTHORS [deleted file]
trunk/src/pkg-size/ChangeLog [deleted file]
trunk/src/pkg-size/pkg-size [deleted file]
trunk/src/portage-statistics/AUTHORS [deleted file]
trunk/src/portage-statistics/ChangeLog [deleted file]
trunk/src/portage-statistics/README [deleted file]
trunk/src/portage-statistics/histogram.awk [deleted file]
trunk/src/portage-statistics/pst-author-coverage [deleted file]
trunk/src/portage-statistics/pst-total-coverage [deleted file]

index 41965716caea0bc2f42e78bdae81f170767add4f..fdfccf3dc4b72b8a6a6f22e151d30ba1dc1228e9 100644 (file)
@@ -1,3 +1,6 @@
 Karl Trygve Kalleberg <karltk@gentoo.org>
- - Maintenance
+ * Maintenance
+
+See the AUTHOR file in the various src/<foo> subdirectories for a full
+log of who's done what with whome and when.
 
index 357d64217e48508f187139cf50bd1bb5eed8e22f..a32edde7baed0b7178417a6a0cbefd01543ec2e9 100644 (file)
@@ -1,3 +1,9 @@
+
+2002-11-21 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Renamed pkg-size to gentool-package-size
+       * Renamed pst-package-count to gentool-package-count
+       * Retired rest of pst-* stuff
+
 2002-08-06 Karl Trygve Kalleberg <karltk@gentoo.org>
        * Created separate CVS module for Gentoolkit
        * Restructured directory hierarchy
index 7028f5f5846faf0dd0d29030bb30ab02596e04f8..8b137891791fe96927ad78e64b0aad7bded08bdc 100644 (file)
@@ -1 +1 @@
-- Merge emerge-webrsync with emerge-rsync
+
index fc3af195737b3278cf0adb7ae11d3c12ed1d215e..4b3873a56a1e27b1b58e472ea5fdbef81e565457 100644 (file)
@@ -1,5 +1,5 @@
 Dan Armak <danarmak@gentoo.org>
- Basic idea
- Initial version
* Basic idea
* Initial version
 Karl Trygve Kalleberg <karltk@gentoo.org>
- Gentoolkit-specific changes
* Gentoolkit-specific changes
index b9121b4734996bf33f302c96330d3de27f69c70f..d913891369a8e7182bd90bc796e0ea55bf10a5d9 100644 (file)
@@ -1,4 +1,6 @@
-
 José Fonseca <j_r_fonseca@yahoo.co.uk>
- - Wrote all of it.
+ * Wrote the script
+
+Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Wrote the man page.
 
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..b0c578ffd95e35c02f750a35ff1f8d5b39245273 100644 (file)
@@ -0,0 +1 @@
+Currently unknown, if anybody remembers, mail karltk@gentoo.org.
diff --git a/trunk/src/gentool/AUTHORS b/trunk/src/gentool/AUTHORS
new file mode 100644 (file)
index 0000000..9935ef7
--- /dev/null
@@ -0,0 +1,3 @@
+Karl Trygve Kalleberg <karltk@gentoo.org>
+ * Initial version
+
diff --git a/trunk/src/gentool/ChangeLog b/trunk/src/gentool/ChangeLog
new file mode 100644 (file)
index 0000000..d421157
--- /dev/null
@@ -0,0 +1,8 @@
+2002-11-22 Karl Trygve Kalleberg <karltk@gentoo.org>
+       * Fixed the nasty thinko whereby the old revisions were removed
+       from CVS.
+       * Imported pkg-size as gentool-package-size.
+       * Importet pst-package-count as gentool-package-count.
+       * Added a man page for gentool-bump-revision.   
+       * Added a man page for gentool-package-size.
+       * Added a man page for gentool-package-count.
diff --git a/trunk/src/gentool/gentool-bump-revision b/trunk/src/gentool/gentool-bump-revision
new file mode 100755 (executable)
index 0000000..37eebf9
--- /dev/null
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (c) 2002, Gentoo Technologies, Inc.
+# Author: Karl Trygve Kalleberg <karltk@gentoo.org>
+# $Header$
+
+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 "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
new file mode 100644 (file)
index 0000000..b7efc47
--- /dev/null
@@ -0,0 +1,20 @@
+.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.1 b/trunk/src/gentool/gentool-package-count.1
new file mode 100644 (file)
index 0000000..ad27479
--- /dev/null
@@ -0,0 +1,17 @@
+.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
new file mode 100755 (executable)
index 0000000..7209a9a
--- /dev/null
@@ -0,0 +1,138 @@
+#! /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
new file mode 100644 (file)
index 0000000..29408b0
--- /dev/null
@@ -0,0 +1,44 @@
+.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.
+
diff --git a/trunk/src/pkg-size/AUTHORS b/trunk/src/pkg-size/AUTHORS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/trunk/src/pkg-size/ChangeLog b/trunk/src/pkg-size/ChangeLog
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/trunk/src/pkg-size/pkg-size b/trunk/src/pkg-size/pkg-size
deleted file mode 100644 (file)
index 96cdff2..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/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::"`
-
-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/trunk/src/portage-statistics/AUTHORS b/trunk/src/portage-statistics/AUTHORS
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/trunk/src/portage-statistics/ChangeLog b/trunk/src/portage-statistics/ChangeLog
deleted file mode 100644 (file)
index b83850b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-2002-03-22 Karl Trygve Kalleberg <karltk@gentoo.org>
-       * Threw away the coverage scripts, replaced with this.
diff --git a/trunk/src/portage-statistics/README b/trunk/src/portage-statistics/README
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/trunk/src/portage-statistics/histogram.awk b/trunk/src/portage-statistics/histogram.awk
deleted file mode 100644 (file)
index 146f4e4..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-{
-       match($0, "<([A-Za-z0-9.-]+@[A-Za-z0-9.-]+)>") 
-       val=substr($0, RSTART, RLENGTH)
-       arr[val]++
-       total++
-}
-
-END {
-       for (x in arr) {
-               printf("%35s: %-4d of %-4d (%-4.2f%)\n",x,arr[x],total,arr[x]*100/total)
-               mytot += arr[x]
-       }
-       printf("%35s: %-4d of %-4d (%-4.2f%)\n","TOTAL",mytot, total,mytot*100/total)
-}
\ No newline at end of file
diff --git a/trunk/src/portage-statistics/pst-author-coverage b/trunk/src/portage-statistics/pst-author-coverage
deleted file mode 100755 (executable)
index 6f7451a..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#! /bin/sh
-
-if [ -z "$1" ] ; then
-       echo "Usage: $1 <author@site.tld>"
-       exit 1
-fi
-
-numebuilds=`find /usr/portage/ -name "*.ebuild" | wc -l`
-numebuildsfor=`find /usr/portage/ -name "*.ebuild" | xargs grep "$1" | wc -l`
-
-pct=`echo "scale=2 ; $numebuildsfor*100/$numebuilds" | bc`
-printf "%25s: %-4d of %-4d (%-4.2f)\n" $1 $numebuildsfor $numebuilds $pct
diff --git a/trunk/src/portage-statistics/pst-total-coverage b/trunk/src/portage-statistics/pst-total-coverage
deleted file mode 100755 (executable)
index 0da5c6e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#! /bin/sh
-
-
-find /usr/portage/ -name "*.ebuild" | \
-       xargs egrep -i "<[a-z]+@[a-z\.]+>" | \
-       awk -f /usr/share/gentoolkit/histogram.awk | \
-       sort -n +1 -r