From: karltk Date: Fri, 22 Nov 2002 19:48:32 +0000 (-0000) Subject: Cleanups X-Git-Tag: gentoolkit-0.2.4.3~489 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0e4c3469a70ddd2c6ab36744258cab6d1470f1c0;p=gentoolkit.git Cleanups svn path=/; revision=13 --- diff --git a/trunk/AUTHORS b/trunk/AUTHORS index 4196571..fdfccf3 100644 --- a/trunk/AUTHORS +++ b/trunk/AUTHORS @@ -1,3 +1,6 @@ Karl Trygve Kalleberg - - Maintenance + * Maintenance + +See the AUTHOR file in the various src/ subdirectories for a full +log of who's done what with whome and when. diff --git a/trunk/ChangeLog b/trunk/ChangeLog index 357d642..a32edde 100644 --- a/trunk/ChangeLog +++ b/trunk/ChangeLog @@ -1,3 +1,9 @@ + +2002-11-21 Karl Trygve Kalleberg + * 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 * Created separate CVS module for Gentoolkit * Restructured directory hierarchy diff --git a/trunk/TODO b/trunk/TODO index 7028f5f..8b13789 100644 --- a/trunk/TODO +++ b/trunk/TODO @@ -1 +1 @@ -- Merge emerge-webrsync with emerge-rsync + diff --git a/trunk/src/change/AUTHORS b/trunk/src/change/AUTHORS index fc3af19..4b3873a 100644 --- a/trunk/src/change/AUTHORS +++ b/trunk/src/change/AUTHORS @@ -1,5 +1,5 @@ Dan Armak - - Basic idea - - Initial version + * Basic idea + * Initial version Karl Trygve Kalleberg - - Gentoolkit-specific changes + * Gentoolkit-specific changes diff --git a/trunk/src/distfiles-clean/AUTHORS b/trunk/src/distfiles-clean/AUTHORS index b9121b4..d913891 100644 --- a/trunk/src/distfiles-clean/AUTHORS +++ b/trunk/src/distfiles-clean/AUTHORS @@ -1,4 +1,6 @@ - José Fonseca - - Wrote all of it. + * Wrote the script + +Karl Trygve Kalleberg + * Wrote the man page. diff --git a/trunk/src/epm/AUTHORS b/trunk/src/epm/AUTHORS index e69de29..b0c578f 100644 --- a/trunk/src/epm/AUTHORS +++ b/trunk/src/epm/AUTHORS @@ -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 index 0000000..9935ef7 --- /dev/null +++ b/trunk/src/gentool/AUTHORS @@ -0,0 +1,3 @@ +Karl Trygve Kalleberg + * Initial version + diff --git a/trunk/src/gentool/ChangeLog b/trunk/src/gentool/ChangeLog new file mode 100644 index 0000000..d421157 --- /dev/null +++ b/trunk/src/gentool/ChangeLog @@ -0,0 +1,8 @@ +2002-11-22 Karl Trygve Kalleberg + * 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/pkg-size/README b/trunk/src/gentool/README similarity index 100% rename from trunk/src/pkg-size/README rename to trunk/src/gentool/README diff --git a/trunk/src/gentool/gentool-bump-revision b/trunk/src/gentool/gentool-bump-revision new file mode 100755 index 0000000..37eebf9 --- /dev/null +++ b/trunk/src/gentool/gentool-bump-revision @@ -0,0 +1,67 @@ +#! /bin/sh +# Copyright (c) 2002, Gentoo Technologies, Inc. +# Author: Karl Trygve Kalleberg +# $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 index 0000000..b7efc47 --- /dev/null +++ b/trunk/src/gentool/gentool-bump-revision.1 @@ -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 , 2002 +.SH SEE ALSO +change(1) +.TP +See \fI/usr/share/doc/gentoolkit-/\fR for documentation on other gentoolkit utilities. + diff --git a/trunk/src/portage-statistics/pst-package-count b/trunk/src/gentool/gentool-package-count similarity index 100% rename from trunk/src/portage-statistics/pst-package-count rename to trunk/src/gentool/gentool-package-count diff --git a/trunk/src/gentool/gentool-package-count.1 b/trunk/src/gentool/gentool-package-count.1 new file mode 100644 index 0000000..ad27479 --- /dev/null +++ b/trunk/src/gentool/gentool-package-count.1 @@ -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 , 2002 +.SH SEE ALSO +gentool-package-size(1) +.TP +See \fI/usr/share/doc/gentoolkit-/\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 index 0000000..7209a9a --- /dev/null +++ b/trunk/src/gentool/gentool-package-size @@ -0,0 +1,138 @@ +#! /usr/bin/env python +# +# Copyright(c) 2002, Gentoo Technologies, Inc +# Copyright(c) 2002, Karl Trygve Kalleberg +# 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 + +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 index 0000000..29408b0 --- /dev/null +++ b/trunk/src/gentool/gentool-package-size.1 @@ -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 , 2002 +.SH SEE ALSO +gentool-package-count(1) +.TP +See \fI/usr/share/doc/gentoolkit-/\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 index e69de29..0000000 diff --git a/trunk/src/pkg-size/ChangeLog b/trunk/src/pkg-size/ChangeLog deleted file mode 100644 index e69de29..0000000 diff --git a/trunk/src/pkg-size/pkg-size b/trunk/src/pkg-size/pkg-size deleted file mode 100644 index 96cdff2..0000000 --- a/trunk/src/pkg-size/pkg-size +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# Copyright(c) 2002, Gentoo Technologies, Inc -# Author: Karl Trygve Kalleberg - -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 index e69de29..0000000 diff --git a/trunk/src/portage-statistics/ChangeLog b/trunk/src/portage-statistics/ChangeLog deleted file mode 100644 index b83850b..0000000 --- a/trunk/src/portage-statistics/ChangeLog +++ /dev/null @@ -1,2 +0,0 @@ -2002-03-22 Karl Trygve Kalleberg - * 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 index e69de29..0000000 diff --git a/trunk/src/portage-statistics/histogram.awk b/trunk/src/portage-statistics/histogram.awk deleted file mode 100644 index 146f4e4..0000000 --- a/trunk/src/portage-statistics/histogram.awk +++ /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 index 6f7451a..0000000 --- a/trunk/src/portage-statistics/pst-author-coverage +++ /dev/null @@ -1,12 +0,0 @@ -#! /bin/sh - -if [ -z "$1" ] ; then - echo "Usage: $1 " - 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 index 0da5c6e..0000000 --- a/trunk/src/portage-statistics/pst-total-coverage +++ /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