diff options
author | Karl Trygve Kalleberg <karltk@gentoo.org> | 2002-01-24 20:45:57 +0000 |
---|---|---|
committer | Karl Trygve Kalleberg <karltk@gentoo.org> | 2002-01-24 20:45:57 +0000 |
commit | f22d9f28a60f8d274c6ef963e0cf530898547906 (patch) | |
tree | b10c072a60f119867657a4db639c4a6883d69d89 /app-admin/gentoolkit | |
parent | unmasked poedit, confirmed to be working. this took a long time because a bug... (diff) | |
download | gentoo-2-f22d9f28a60f8d274c6ef963e0cf530898547906.tar.gz gentoo-2-f22d9f28a60f8d274c6ef963e0cf530898547906.tar.bz2 gentoo-2-f22d9f28a60f8d274c6ef963e0cf530898547906.zip |
Initial import of Gentoolkit
Diffstat (limited to 'app-admin/gentoolkit')
-rw-r--r-- | app-admin/gentoolkit/files/coverage/author-coverage | 9 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/coverage/histogram.awk | 14 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/coverage/total-coverage | 8 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/lintool/checklist-for-ebuilds | 15 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/lintool/lintool | 309 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/emerge-webrsync | 39 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/epm | 421 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/etc-update | 62 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/mkebuild | 207 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/pkg-clean | 66 | ||||
-rw-r--r-- | app-admin/gentoolkit/files/scripts/qpkg | 350 | ||||
-rw-r--r-- | app-admin/gentoolkit/gentoolkit-0.1.0.ebuild | 35 |
12 files changed, 1535 insertions, 0 deletions
diff --git a/app-admin/gentoolkit/files/coverage/author-coverage b/app-admin/gentoolkit/files/coverage/author-coverage new file mode 100644 index 000000000000..2edf3cf72f9b --- /dev/null +++ b/app-admin/gentoolkit/files/coverage/author-coverage @@ -0,0 +1,9 @@ +#! /bin/sh + +. /etc/make.globals + +numebuilds=`find ${PORTDIR}/ -name "*.ebuild" | wc -l` +numebuildsfor=`find ${PORTDIR}/ -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/app-admin/gentoolkit/files/coverage/histogram.awk b/app-admin/gentoolkit/files/coverage/histogram.awk new file mode 100644 index 000000000000..146f4e4e28bc --- /dev/null +++ b/app-admin/gentoolkit/files/coverage/histogram.awk @@ -0,0 +1,14 @@ +{ + 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/app-admin/gentoolkit/files/coverage/total-coverage b/app-admin/gentoolkit/files/coverage/total-coverage new file mode 100644 index 000000000000..ef28fbada379 --- /dev/null +++ b/app-admin/gentoolkit/files/coverage/total-coverage @@ -0,0 +1,8 @@ +#! /bin/sh + +. /etc/make.globals + +find ${PORTDIR}/ -name "*.ebuild" | \ + xargs egrep -i "<[a-z]+@[a-z\.]+>" | \ + awk -f /usr/share/gentoolkit/histogram.awk | \ + sort -n +1 -r
\ No newline at end of file diff --git a/app-admin/gentoolkit/files/lintool/checklist-for-ebuilds b/app-admin/gentoolkit/files/lintool/checklist-for-ebuilds new file mode 100644 index 000000000000..94c5cef1cfef --- /dev/null +++ b/app-admin/gentoolkit/files/lintool/checklist-for-ebuilds @@ -0,0 +1,15 @@ +1) Is the header correct ? + - Copyright sentence has correct year + - Correct author + - $Header: +2) Is S correct ? +3) Is DESCRIPTION set ? +4) Is SRC_URI correct ? +5) Is HOMEPAGE correct ? +6) Is DEPEND correct ? + - Is a separate RDEPEND required ? +7) Is || die used instead of try ? +8) Does it write to ${D} and not / ? +9) Are tabs used instead of spaces ? + + diff --git a/app-admin/gentoolkit/files/lintool/lintool b/app-admin/gentoolkit/files/lintool/lintool new file mode 100644 index 000000000000..f6cf39229ae2 --- /dev/null +++ b/app-admin/gentoolkit/files/lintool/lintool @@ -0,0 +1,309 @@ +#! /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 checks if a set of 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. +# +# Usage: ebuildchecker.py /usr/portage/*/*/*.ebuild +# Options: +# --no-summary : Do not show total summary +# --show-separate : Show short summary of tests for each ebuild checked +# --show-details : Show full details of tests for each ebuild checked +# +# TODO +# +# - New checks: +# - presence of all required env vars (HOMEPAGE, SRC_URI, S, DESCRIPTION) +# - Make HTMLFormatter +# - Sort errors into errors and warnings +# +# + +import sys +import re + +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 subsub(self, s): + print " |" + s + def div(self, left, right): + l = len(left) + r = len(right) + print left + " " * (79-l-r) + right + +class Test: + def __init__(self, formatter): + self.formatter = formatter + def reset(self): + self.lines = [] + def isOK(self): + return len(self.lines) == 0 + def getDesc(self): + return self.desc + def getStatus(self): + if self.isOK(): return "passed" + else: return "failed" + +class TestSpaces(Test): + + def __init__(self, formatter): + Test.__init__(self, formatter) + self.desc = "Testing for illegal spaces at the start of the line" + self.re = re.compile("^([ ][ ]*)([a-zA-Z\.].*)") + self.lines = [] + + def checkLine(self, s): + k = self.re.match(s) + if k: + spcs = k.groups()[0] + rest = k.groups()[1] + self.lines.append(spcs.replace(" ", "%") + rest) + + def report(self): + if len(self.lines): + self.formatter.sub("Has illegal spaces (marked by %):") + for i in self.lines: + self.formatter.subsub(i) + +class TestHeaders(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for malformed headers" + self.re = [ re.compile("^(# Copyright 1999-2000 Gentoo Technologies, Inc.)"), + re.compile("^(# /home.*)") ] + self.lines = [] + + def checkLine(self, s): + for i in self.re: + k = i.match(s) + if k: + self.lines.append(k.groups()[0]) + + def report(self): + if len(self.lines): + self.formatter.sub("Has illegal or suspect headers:") + for i in self.lines: + self.formatter.subsub(i) + +class TestTry(Test): + + def __init__(self,formatter): + Test.__init__(self,formatter) + self.desc = "Testing for occurence of deprecated try" + self.re = [ re.compile("^([ \t][ \t]*try.*)"), + re.compile("(.*=.* try .*)") ] + self.lines = [] + + def checkLine(self, s): + for i in self.re: + k = i.match(s) + if k: + self.lines.append(k.groups()[0]) + + def report(self): + if len(self.lines): + self.formatter.sub("Uses try, which is deprecated") + for i in self.lines: + self.formatter.subsub(i) + +class TestA(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for unnecessary A=${P}.tar.gz" + self.re = re.compile("(A=\$\{P\}.tar.gz)") + self.lines = [] + + def checkLine(self, s): + k = self.re.match(s) + if k: + self.lines.append(k.groups()[0]) + + def report(self): + if len(self.lines): + self.formatter.sub("Contains unnecessary " + self.lines[0]) + +class TestDepend(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for empty DEPEND" + self.re = re.compile("DEPEND=\"\"") + self.lines = [] + + def checkLine(self, s): + k = self.re.match(s) + if k: + self.lines.append("") + + def report(self): + if len(self.lines): + self.formatter.sub("Is DEPENDS supposed to be empty ?") + +class TestHomepage(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for empty HOMEPAGE" + self.re = re.compile("HOMEPAGE=\"\"") + self.lines = [] + + def checkLine(self, s): + k = self.re.match(s) + if k: + self.lines.append("") + + def report(self): + if len(self.lines): + self.formatter.sub("Is HOMEPAGE really supposed to be empty ?") + +class TestDescription(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for empty DESCRIPTION" + self.re = re.compile("DESCRIPTION=\"\"") + self.lines = [] + + def checkLine(self, s): + k = self.re.match(s) + if k: + self.lines.append("") + + def report(self): + if len(self.lines): + self.formatter.sub("DESCRIPTION is empty") + +class TestEnvVarPresence(Test): + + def __init__(self, formatter): + Test.__init__(self,formatter) + self.desc = "Testing for presence of SRC_URI, HOMEPAGE, .." + self.re = [] + self.found = [] + self.required = ["SRC_URI=", "DESCRIPTION=", "HOMEPAGE=" ] + self.desired = [ "# Author:", "# Maintainer:", "DEPEND=", "RDEPEND=", "S="] + + for i in self.required: + self.re.append(re.compile("^(" + i + ")")) + for i in self.desired: + self.re.append(re.compile("^(" + i + ")")) + + def checkLine(self, s): + 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 not in self.found: + self.formatter.sub("Missing " + i) + for i in self.desired: + if i not in self.found: + self.formatter.sub("Missing " + i) + + def isOK(self): + warn = error = 0 + for i in self.required: + if i not in self.found: + error = 1 + for i in self.desired: + if i not in self.found: + warn = 1 + return (warn + error) == 0 + + +def extractFilename(path): + return path + +def runTests(ins): + for j in tests: + j.reset() + + for i in ins.readlines(): + for j in tests: + j.checkLine(i) + + for j in xrange(len(tests)): + if not tests[j].isOK(): + result[j] += 1 + +def showStatus(file): + if showFullStatus or showSeparate: + formatter.section("Status for " + file) + for j in tests: + if showSeparate: + l = len(j.getDesc()) + formatter.bullet(j.getDesc() + " " * (70 - l) + ": " + j.getStatus()) + if showFullStatus: + j.report() + else: + allOK = 1 + for j in tests: + if not j.isOK(): + allOK = 0 + break + if allOK: + formatter.div(file, ": OK") + else: + formatter.div(file, ": Not OK") + + +formatter = TextFormatter() + +tests = [ TestSpaces(formatter), + TestHeaders(formatter), + TestTry(formatter), + TestA(formatter), + TestDepend(formatter), + TestHomepage(formatter), + TestDescription(formatter), + TestEnvVarPresence(formatter) ] + +result = range(len(tests)) + +showSeparate = 0 +showTotal = 1 +showFullStatus = 0 +showShort = 1 + +for i in xrange(len(result)): result[i] = 0 + + +for i in sys.argv[1:]: + if len(i) > 2 and i[0:2] == "--": + if i == "--show-details": + showShort = 0 + showFullStatus = 1 + if i == "--show-separate": + showShort = 0 + showSeparate = 1 + if i == "--no-summary": + showTotal = 0 + else: + fn = extractFilename(i) + ins = open(i, "r") + runTests(ins) + if showSeparate or showFullStatus or showShort: + showStatus(fn) + +if showTotal: + print "\n" + "-"*79 + print " Summary for all ebuilds checked" + " " * 39 + "# fails" + print "-"*79 + for i in xrange(len(tests)): + l = len(tests[i].getDesc()) + print tests[i].getDesc() + " " * (70 - l) + ": " + str(result[i]) diff --git a/app-admin/gentoolkit/files/scripts/emerge-webrsync b/app-admin/gentoolkit/files/scripts/emerge-webrsync new file mode 100644 index 000000000000..b1d8bc18a7d3 --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/emerge-webrsync @@ -0,0 +1,39 @@ +#!/usr/bin/perl -w + +use strict; + +my $tempRsyncPath = "/var/tmp/emerge-webrsync"; + +unless(-e $tempRsyncPath) +{ + mkdir($tempRsyncPath); +} + +chdir($tempRsyncPath); + +my $mytime = time; +my $flag = 1; + +while($flag) +{ + my @date = localtime($mytime); + my $day = sprintf("%02d", $date[3]); + ++$date[4]; + my $month = sprintf("%02d", $date[4]); + $date[5] += 1900; + my $year = sprintf("%04d", $date[5]); + + my $file = "portage-".$year.$month.$day.".tar.bz2"; + my $url = "http://www.gentoo.org/snapshots/$file"; + print "Trying to get $url...\n"; + $flag = system "wget $url"; + if(!$flag) + { + system "tar xjf $file"; + unlink($file); + system "rsync -av . /usr/"; + } + else { $mytime -= 86400; } +} + +system "rm -rf portage"; diff --git a/app-admin/gentoolkit/files/scripts/epm b/app-admin/gentoolkit/files/scripts/epm new file mode 100644 index 000000000000..441bd30e3021 --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/epm @@ -0,0 +1,421 @@ +#!/usr/bin/perl -wI. +# $Id: epm,v 1.1 2002/01/24 20:45:57 karltk Exp $ + +use Getopt::Long; +#use epm; + +# Global vars +my $verbose = 0; +my $dbpath = '/var/db/pkg'; +my $pkgregex = + '^(.+?)'. # name + '-(\d+(?:\.\d+)*\w*)'. # version, eg 1.23.4a + '((?:(?:_alpha|_beta|_pre|_rc)\d*)?)'. # special suffix + '((?:-r\d+)?)$'; # revision, eg r12 +my $root = '/'; +my %opt = ( + 'dbpath' => \$dbpath, + 'root' => \$root, + 'v' => \$verbose, +); +my $exitcode = 0; + +############################################## +# +# UTILITY FUNCTIONS +# +############################################## +sub verb { + print STDERR map "-- $_\n", @_ if $verbose; +} + +sub vverb { + print STDERR map "-- $_\n", @_ if $verbose > 1; +} + +############################################## +# +# QUERY MODE +# +############################################## +sub query { + verb "query mode"; + verb "actually Verify mode" if $opt{'V'}; + + # Implied -l similar to rpm + $opt{'dump'} and $opt{'l'} = 1; + $opt{'d'} and $opt{'l'} = 1; + $opt{'c'} and $opt{'l'} = 1; + + # @dgrps contains a list of all the groups at dbpath + # @dpkgs contains a list of all the packages at dbpath/@dgrps + # %dpkggrp contains a mapping of pkg=>grp + # %dnampkg contains a mapping of nam=>@pkg (libxml=>[libxml-1.8.13]) + # @pkgs is the list of packages being queried + # %dfilepkg is a mapping of filename=>@pkg + my (@dgrps, @dpkgs, %dpkggrp, %dnampkg, @pkgs); + + # Read all groups in the db (except for virtual) + opendir D, $dbpath or + die "epm: Database not found at $dbpath\n"; + @dgrps = grep {-d "$dbpath/$_" && !/^\./ && $_ ne 'virtual'} readdir D; + closedir D; + verb "read ".@dgrps." groups from $dbpath"; vverb @dgrps; + + # Read all pkgs in the db + for my $g (@dgrps) { + opendir D, "$dbpath/$g" or + die "epm: Error reading directory $dbpath/$g\n"; + my @dp = grep {-d "$dbpath/$g/$_" && !/^\./} readdir D; + verb "read ".@dp." pkgs in group $g"; vverb @dp; + @dpkggrp{@dp} = ($g) x @dp; + push @dpkgs, @dp; + } + vverb "package to group associations:"; + vverb map " $_ => $dpkggrp{$_}", keys %dpkggrp; + + # Create association of names => pkgs + for my $p (@dpkgs) { + $p =~ /$pkgregex/o || $dpkggrp{$p} eq 'virtual' || + die "epm: Could't parse name/version/suffix/rev from $p"; + # $2, $3, $4 aren't used right now, but they're in the regex + # for the sake of completeness. + push @{$dnampkg{$1}}, $p; + } + + # File-based query + if ($opt{'f'}) { + # Search through CONTENTS for elements in ARGV. Building an + # index would be bad because it would be HUGE. + for my $a (@ARGV) { + my $found = 0; + # Trim trailing slashes from directories + $a =~ s#/*$##; + # TODO: If it's a relative pathname, then figure out + # the full pathname + if ($a !~ m#^/#) { } + # TODO: stat the file here so that we can determine later + # what package the file currently belongs to + for my $p (@dpkgs) { + my ($CONTENTS, @files); + $CONTENTS = "$dbpath/$dpkggrp{$p}/$p/CONTENTS"; + unless (-s $CONTENTS) { + verb "skipping empty/nonexistent $CONTENTS"; + next; + } + open F, "<$CONTENTS" or die "epm: Can't open $CONTENTS\n"; + @files = <F>; + close F; + # Check this list of files for the current query + for my $f (@files) { + $f = (split ' ', $f)[1]; + next unless $f eq $a; + $found = 1; + # If not doing -qlf, then print the package name + unless ($opt{'l'}) { + # If doing -qGf, then include the group name + print $opt{'G'} ? "$dpkggrp{$p}/$p\n" : "$p\n"; + } + push @pkgs, $p; + } + } + unless ($found) { + print "file $a is not owned by any package\n"; + $exitcode = 1; + } + } + # Clear out ARGV so queries below don't get confused + @ARGV = (); + } + + # Group-based query + # Note that if -qfg specified, then rpm prioritizes -qf over -qg, + # so we do too. + elsif ($opt{'g'}) { + for my $a (@ARGV) { + verb "checking for packages in group $a"; + my @l = grep $dpkggrp{$_} eq $a, @dpkgs; + vverb "packages in group $a:"; + vverb " ", join "\n ", @l; + unless (@l) { + print "group $a does not contain any packages\n"; + $exitcode = 1; + } + push @pkgs, @l; + } + # Clear out ARGV so queries below don't get confused + @ARGV = (); + } + + # Package-based query (how does this work with emerge?) + if ($opt{'p'}) { + die "epm: Sorry, package-based query not yet supported\n"; + } + + # Query on all packages + if ($opt{'a'}) { + die "epm: extra arguments given for query of all packages\n" if @ARGV; + @pkgs = @dpkgs; + } + elsif (@pkgs) { + # must have been populated by, for instance, -qf + } + else { + for my $a (@ARGV) { + if ($a =~ /$pkgregex/o) { + verb "$a matches pkgregex"; + vverb "name=$1, version=$2, suffix=$3, revision=$4"; + push @pkgs, $a; + next; + } + if (defined $dnampkg{$a}) { + verb "$a found in dnampkg"; + vverb @{$dnampkg{$a}}; + push @pkgs, @{$dnampkg{$a}}; + next; + } + print "package $a is not installed\n"; + next; + } + } + + # Do a file listing of the requested packages + if ($opt{'l'}) { + for my $p (@pkgs) { + my $CONTENTS = "$dbpath/$dpkggrp{$p}/$p/CONTENTS"; + open F, "<$CONTENTS" || die "epm: Can't open $CONTENTS\n"; + my @files = <F>; + close F; + # Trim @files if config files requested + if ($opt{'c'}) { + # Read in CONFIG_PROTECT from /etc/make.{global,conf} + my @CONFIG_PROTECT = split ' ', + `. /etc/make.globals; + . /etc/make.conf; + echo \$CONFIG_PROTECT`; + die "CONFIG_PROTECT is empty" unless @CONFIG_PROTECT; + my $confprotre = join '|', @CONFIG_PROTECT; + @files = grep { + (split ' ', $_)[1] =~ /^($confprotre)/o + } @files; + } + # Trim @files if doc files requested + if ($opt{'d'}) { + # We don't have a variable like CONFIG_PROTECT to work + # with, so just fake it... :-) + my $docre = '/usr/share/doc|/usr/share/man'; + @files = grep { + (split ' ', $_)[1] =~ m/^($docre)/o + } @files; + } + # If this is a dump query, then print the entire array + if ($opt{'dump'}) { + print @files; + } + # Otherwise do some work so that intermediate directories + # aren't listed + else { + for (my $i=0; $i < @files; $i++) { + my ($f1) = $files[$i]; + $f1 = (split ' ', $f1)[1]; + if ($i < @files-1) { + my $f2 = $files[$i+1]; + $f2 = (split ' ', $f2)[1]; + vverb "Comparing $f1 to $f2"; + next if $f2 =~ m#^\Q$f1\E/#; + } + print $f1, "\n"; + } + } + } + } + + # If not another type of listing, then simply list the packages + if (!$opt{'l'} && !$opt{'f'}) { + # If doing -qG, then include the group name + print map(($opt{'G'} ? "$dpkggrp{$_}/$_\n" : "$_\n"), @pkgs); + } +} + +############################################## +# +# ERASE MODE +# +############################################## +sub erase { + verb "erase mode"; + verb "(testing)" if $opt{'test'}; + + # Catch empty command-line + die "epm: no packages given for uninstall\n" unless @ARGV; + + # Must be root to erase; rpm just lets permissions slide but I don't + if ($> != 0) { + print STDERR "Must be root to remove packages from the system\n"; + $exitcode = 1; + return; + } + + # Erase everything listed on the command-line. Give an error + # message on bogus names, but continue anyway, a la rpm. Note + # that for epm, we require the group name... + for my $a (@ARGV) { + unless ($a =~ '/') { + print STDERR "error: $a does not contain group/ prefix\n"; + $exitcode = 1; + next; + } + my $p = $a; + $p =~ s,^.*/,,; # remove the group + unless (-f "$dbpath/$a/$p.ebuild") { + print STDERR "error: package $a is not installed\n"; + $exitcode = 1; + next; + } + my @cmd = ('ebuild', "$dbpath/$a/$p.ebuild", 'unmerge'); + print STDERR join(" ", @cmd), "\n"; + unless ($opt{'test'}) { + system @cmd; + die "epm: Fatal error running ebuild; aborting\n" if $?; + } + } +} + +############################################## +# +# MAIN +# +############################################## + +# Syntax string for errors +my $syntax = <<EOT; +EPM version 0.1 +Copyright (C) 2001 - Aron Griffis +This program may be freely redistributed under the terms of the GNU GPL + +Usage: + --help - print this message + *--version - print the version of rpm being used + + All modes support the following arguments: + -v - be a little more verbose + -vv - be incredibly verbose (for debugging) + + -q, --query - query mode + --dbpath <dir> - use <dir> as the directory for the database + --root <dir> - use <dir> as the top level directory + Package specification options: + -a, --all - query all packages + -f <file>+ - query package owning <file> + *-p <packagefile>+ - query (uninstalled) package <packagefile> + *--triggeredby <pkg> - query packages triggered by <pkg> + *--whatprovides <cap> - query packages which provide <cap> capability + *--whatrequires <cap> - query packages which require <cap> capability + -g <group>+ --group <group>+ - query packages in group <group> + Information selection options: + *-i, --info - display package information + -l - display package file list + -G, --showgroup - display group name in output (not in rpm) + -d - list only documentation files (implies -l) + -c - list only configuration files (implies -l) + --dump - show all verifiable information for each file + (must be used with -l, -c, or -d) + *--provides - list capabilities package provides + *-R, --requires - list package dependencies + *--scripts - print the various [un]install scripts + + --erase <package> + -e <package> - erase (uninstall) package + *--allmatches - remove all packages which match <package> + (normally an error is generated if <package> + specified multiple packages) + --dbpath <dir> - use <dir> as the directory for the database + *--justdb - update the database, but do not modify the + filesystem + *--nodeps - do not verify package dependencies + *--noorder - do not reorder package installation to satisfy + dependencies + *--noscripts - do not execute any package specific scripts + *--notriggers - don't execute any scripts triggered by this + package + --root <dir> - use <dir> as the top level directory + --test - don't uninstall, but tell what would happen + + -V, -y, --verify - verify a package installation using the same + package specification options as -q + --dbpath <dir> - use <dir> as the directory for the database + --root <dir> - use <dir> as the top level directory + --nodeps - do not verify package dependencies + --nomd5 - do not verify file md5 checksums + --nofiles - do not verify file attributes +EOT + +# Allow bundling of options since rpm does +Getopt::Long::Configure ("bundling"); + +# Parse the options on the cmdline. Put the short versions first in +# each optionstring so that the hash keys are created using the short +# versions. For example, use 'q|query', not 'query|q'. +my $result = GetOptions( + \%opt, + 'help', # help message + 'v+', # verbose, more v's for more verbosity + + 'q|query', # query mode + 'dbpath=s', # use <dir> as the directory for the database + 'root=s', # use <dir> as the top level directory + # Package specification options: + 'a|all', # query all packages + 'f', # query package owning file(s) + 'p', # query (uninstalled) package + 'g|group', # query packages in group(s) + 'whatprovides', # query packages which provide capability + 'whatrequires', # query packages which require capability + # Information selection options: + 'i|info', # display package information + 'l', # display package file list + 'd', # list documentation files (implies -l) + 'c', # list configuration files (implies -l) + 'dump', # show all verifiable information for each file + # (must be used with -l, -c, or -d) + 'R|requires', # list package dependencies + 'scripts', # print the various [un]install scripts + 'G|showgroup', # include group name in output + + 'e|erase', # erase mode + 'test', # don't uninstall, but tell what would happen + + 'V|y|verify', # verify a package installation using the same + # package specification options as -q + 'nodeps', # do not verify package dependencies + 'nomd5', # do not verify file md5 checksums + 'nofiles', # do not verify file attributes +); + +# Handle help message +if ($opt{'help'}) { print $syntax; exit 0 } + +# Determine which mode we're running in; make sure it's valid. +# (q)uery +# (V)erify +# (i)nstall +# (U)pgrade +# (e)rase +# (b)uild +# other +if ((defined $opt{"q"} || 0) + + (defined $opt{"V"} || 0) + + (defined $opt{"i"} || 0) + + (defined $opt{"U"} || 0) + + (defined $opt{"e"} || 0) + + (defined $opt{"b"} || 0) != 1) { + die "One mode required, and only one mode allowed\n"; +} + +# Query mode +if ($opt{'q'}) { query(); exit $exitcode } +if ($opt{'V'}) { query(); exit $exitcode } +if ($opt{'e'}) { erase(); exit $exitcode } + +# Other modes not implemented yet +die "epm: Sorry, this mode isn't implemented yet. Check back later! :-)\n"; diff --git a/app-admin/gentoolkit/files/scripts/etc-update b/app-admin/gentoolkit/files/scripts/etc-update new file mode 100644 index 000000000000..dc70829a5d39 --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/etc-update @@ -0,0 +1,62 @@ +#!/bin/bash +# Copyright 2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author: Leo Lipelis + +# uses $EDITOR value for editor +# edit three lines below to your liking +rm_opts="-i" +mv_opts="-i" +editor_opts="-d" # vim diff mode + +cfg_files=`find /etc -iname '._cfg????_*'` + +# returns 1 if the file pair still needs to be looked at +# or 0 if one of the two files was chosen for deletion and +# everything is fine +rm_extra_file() { + old=$1 + new=$2 + echo + echo "1) Upgrade to new $new" + echo "2) Keep existing $old" + echo " OR" + echo "3) Edit this file pair again" + echo -n "Type (1, 2 or 3): " + # read and echo 1 char from stdin + read -n 1 input + echo + case $input in + 1) + echo + echo "deleting $old ..." + rm $rm_opts $old + echo "moving $new to $old ..." + mv $mv_opts $new $old + ;; + 2) + echo + echo "deleting $new ..." + rm $rm_opts $new + ;; + 3) + echo + echo "looking at $old and $new again ..." + return 1 + ;; + *) + echo + echo "!!! Please pick a valid choice next time" + rm_extra_file $old $new + ;; + esac +} + +for new_full_path in $cfg_files; do + file=${new_full_path##*/} + old_full_path=${new_full_path%/*}/${file:10} + $EDITOR $editor_opts ${old_full_path} ${new_full_path} + until rm_extra_file ${old_full_path} ${new_full_path}; do + $EDITOR $editor_opts ${old_full_path} ${new_full_path} + done +done diff --git a/app-admin/gentoolkit/files/scripts/mkebuild b/app-admin/gentoolkit/files/scripts/mkebuild new file mode 100644 index 000000000000..7ebd688eaf57 --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/mkebuild @@ -0,0 +1,207 @@ +#!/bin/bash + +# Copyright (c) 2002 +# John Stalker +# Department of Mathematics +# Princeton University + +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 or later" + 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 >>${EBUILD_FILE} +echo 'A=${P}.'${FILE_EXTENSION} >>${EBUILD_FILE} +echo 'S=${WORKDIR}/${P}' >>${EBUILD_FILE} +echo 'DESCRIPTION=""' >>${EBUILD_FILE} +echo 'SRC_URI="'${SOURCE_LOCATION}'/${P}.'${FILE_EXTENSION}'"' >>${EBUILD_FILE} +echo 'HOMEPAGE="'${SOURCE_LOCATION}'/"' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'DEPEND=""' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'RDEPEND=$DEPEND' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo 'src_unpack() {' >>${EBUILD_FILE} +echo >>${EBUILD_FILE} +echo -e "\t"'unpack ${P}.'${FILE_EXTENSION} >>${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/app-admin/gentoolkit/files/scripts/pkg-clean b/app-admin/gentoolkit/files/scripts/pkg-clean new file mode 100644 index 000000000000..f464ea790ceb --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/pkg-clean @@ -0,0 +1,66 @@ +#!/usr/bin/python +# vim: set ts=4 sw=4: +# Copyright 2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author: Leo Lipelis + +import commands as c +import re +import sys +import string +import time + +# 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) = c.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 = string.atoi(pkg_time) + pkg_name = re.match(r'/var/db/pkg/(.*/.*)/.*', pkg).group(1) + pkg_core = re.match(r'(.*)-\d.*', pkg_name).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)] + +for pkg_core in pkg_hash.keys(): + print "Examining %s:" % (pkg_core) + if len(pkg_hash[pkg_core]) < 2: + continue + unmerged_indexes = [] + while 1: + i = 0 + print "0) Continue" + for pkg_tuple in pkg_hash[pkg_core]: + if i not in unmerged_indexes: + print "%d) %s %s" % ( + i+1, + time.ctime(pkg_tuple[PKG_TIME]), + pkg_tuple[PKG_NAME]) + i = i + 1 + print "Unmerge: ", + index = string.atoi(sys.stdin.readline()) + if index == 0: + break + else: + index = index - 1 + ebuild = pkg_hash[pkg_core][index][PKG] + print "Unmerge %s? " % (ebuild), + confirmed = sys.stdin.readline() + if confirmed == "y\n": + (status, unmerge_out) = c.getstatusoutput( + "ebuild %s unmerge" % (ebuild)) + print unmerge_out + if status != 0: + sys.exit(status) + unmerged_indexes.append(index) + else: + print "continuing without unmerging..." diff --git a/app-admin/gentoolkit/files/scripts/qpkg b/app-admin/gentoolkit/files/scripts/qpkg new file mode 100644 index 000000000000..bc254e81e5ff --- /dev/null +++ b/app-admin/gentoolkit/files/scripts/qpkg @@ -0,0 +1,350 @@ +#!/bin/sh +# +# qpkg - query portage package system for various information +# +# Copiright (c) Vitaly Kushneriuk <vitaly_kushneriuk@yahoo.com> +# This program is distributed under the terms of GPL version 2. +# +ID='$Id: qpkg,v 1.1 2002/01/24 20:45:57 karltk Exp $' +VERSION=0.`echo $ID | cut -d\ -f3` + +PROG=`basename $0` + +# Parse args +verb=0 +while [ $# -gt 0 ] +do + a=$1 + shift + case "$a" in + + -h|--help) + usage=y + break + ;; + + -i|--info) + info=y + ;; + + --dups) + dups=y + ;; + + -f|--find-file) + ffind=y + inst=y + ;; + + -fp|--find-pattern) + ffind=y + fpat=y + inst=y + ;; + + -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++)) + ;; + + -I|--installed) + inst=y + ;; + + -U|--uninstalled) + uninst=y + ;; + + -nc|--no-colors) + 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 + +T="\t" +if [ ! "$nocolor" ]; then + NO="\x1b[0;0m" + BR="\x1b[0;01m" + CY="\x1b[36;01m" + RD="\x1b[31;01m" + YL="\x1b[33;01m" + BL="\x1b[34;01m" +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 +${BR}Usage: +$T$CY$PROG$NO [$BR options$NO ] [$YL pkgname $NO|$BL-f$YL file$NO ] +$T$CY$PROG$NO $BL--dups$NO +$T$CY$PROG$NO $BL--conlicts$NO + +${BR}Operation Modes: + $BL-h, --help$NO$T$T This usage help + $BL--dups$NO$T$T print packages that have multiple versions installed + $BL-i, --info$NO$T$T Get package description and home page. + $BL-l, --list$NO$T$T List package content + $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. + +${BR}Operation modifiers: + $BL-nc, --no-color$NO$T don't use colors + $BL-f, --find-file$NO$T apply to package that owns file + $BL-fp, --find-pattern$NO$T apply to package that owns file that looks 'like' ... + $BL-I, --installed$NO$T Include$YL only$NO installed packages + $BL-U, --uninstalled$NO$T Include$YL only$NO uninstalled packages + $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-l$NO, $BL-ct$NO, and $BL-cm$NO apply only to installed packages +$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 + $PROG --dups -v .. with versions + $PROG print list of installed packages + $PROG porta print versions of installed portage + $PROG -a porta -i .. + versions in portage tree + descriptions and homepages + $PROG gawk -c -v check integrity all installed versions of gawk + the older will have \"demaged\" files. + $PROG -f /bin/ls print package(s) that own /bin/ls +" + exit +fi + + +if [ "$dups" ]; then + dups=`/usr/lib/portage/bin/pkglist | + sed -e 's:-r[0-9]*::' -e 's:-[^-]*$::' | + sort | + uniq -d` + if [ "$verb" -gt 1 ]; then + ls /var/db/pkg/*/*/*$arg*.ebuild 2>/dev/null | fgrep "$dups" + elif [ "$verb" -gt 0 ]; then + /usr/lib/portage/bin/pkglist | fgrep "$dups" + else + echo "$dups" + 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/*/*/CONTENTS | xargs grep -l "$arg" \ + | xargs --no-run-if-empty -n 1 dirname` + else + dirs=`ls /var/db/pkg/*/*/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 + [ ! "$uninst" ] && ipak=`ls /var/db/pkg/*/*/*$arg*.ebuild 2>/dev/null` + # not installed packages (yet:-) + [ ! "$inst" ] && upak=`ls /usr/portage/*/*/*$arg*.ebuild 2>/dev/null` +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=`echo $p | sed -e "s:^/var/db/pkg/$X/$X.*:iii \1/\2:" \ + -e "s:^/usr/portage/$X/$X/$X\.ebuild:uuu \1/\3:"` + d=`dirname $p` + echo $n + if [ $verb -gt 0 ];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 + + # 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 \([^ ]*\).*:$BR\1$NO:" \ + -e "s:sym \([^ ]*\) -> \([^ ]*\).*:$CY\1 $NO-> \2:" \ + -e "s:dir \([^ ]*\).*:$YL\1$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 -d\ -f1| awk '{print toupper($1)}'` + } + + 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 + err=1 + name="$name $RD!md5!$NO" + fi + if [ "$mtime" != "$_mtime" ]; then + err=1 + name="$name $RD!mtime!$NO" + fi + + [ $verb -gt 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 $verb -gt 0 \) ]; then + sort -k 2 | uniq -1 + else + cat + fi | sed \ + -e "s:^iii $X/$X:$BR\1/$CY\2 *$NO:" \ + -e "s:^uuu $X/$X:$BR\1/$YL\2$NO:" \ + -e "s:^vvv \(.*\)$:$BL\1$NO:" + +) + diff --git a/app-admin/gentoolkit/gentoolkit-0.1.0.ebuild b/app-admin/gentoolkit/gentoolkit-0.1.0.ebuild new file mode 100644 index 000000000000..2d10260ccd32 --- /dev/null +++ b/app-admin/gentoolkit/gentoolkit-0.1.0.ebuild @@ -0,0 +1,35 @@ +# Copyright 1999-2002 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Maintainer: Karl Trygve Kalleberg <karltk@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/app-admin/gentoolkit/gentoolkit-0.1.0.ebuild,v 1.1 2002/01/24 20:45:57 karltk Exp $ + +S=${WORKDIR}/${P} +DESCRIPTION="Collection of unofficial administration scripts for Gentoo" +SRC_URI="" +HOMEPAGE="http://" + +DEPEND="" +RDEPEND=">=dev-lang/python-2.0 + >=sys-devel/perl-5.6" + +src_install () { + dodir /usr/share/gentoolkit + + insinto /usr/share/gentoolkit + doins ${FILESDIR}/coverage/histogram.awk + + dosbin ${FILESDIR}/coverage/total-coverage + dosbin ${FILESDIR}/coverage/author-coverage + + dosbin ${FILESDIR}/lintool/lintool + + dosbin ${FILESDIR}/scripts/etc-update + dosbin ${FILESDIR}/scripts/pkg-clean + dosbin ${FILESDIR}/scripts/qpkg + dosbin ${FILESDIR}/scripts/mkebuild + dosbin ${FILESDIR}/scripts/emerge-webrsync + dosbin ${FILESDIR}/scripts/epm + + dodoc ${FILESDIR}/lintool/checklist-for-ebuilds + +} |