Sebastian Kapfer wrote:
Hello, On Fri, 04 Mar 2005 18:50:12 +0100, Travis Crump wrote:You can easily hack apt-show-versions to do this, example patch[for apt-show-versions] attached[just do 'apt-show-versions | grep -v Debian' to get all non-(official)-Debian packages].Great idea, but I can't get it to work. Applied your patch, but apt-show-versions spits lines line this one: rsync/unstable uptodate 2.6.3-2 i.e. there's no Debian there which I could grep for. What's the magic switch to make it print the Origin: field? Unfortunately, my Perl sucks.
a) make sure you are running the modified version and not the version in your path
b) run '/path/to/modified/apt-show-versions -i' and try againc) it is a lazy patch and won't work on non-i386 and/or package/release pair formats other than the ones on my computer. Attached patch should fix the arch issue[and has other cosmetic changes].
Travis
--- /usr/bin/apt-show-versions 2004-02-24 10:06:24.000000000 -0500 +++ /home/pretzalz/bin/asv 2005-03-04 16:28:07.000000000 -0500 @@ -34,9 +34,14 @@ use Getopt::Long; use Storable qw(store retrieve); -my $apackagescachefile="/var/cache/apt-show-versions/apackages"; -my $ipackagescachefile="/var/cache/apt-show-versions/ipackages"; -my $filescachefile="/var/cache/apt-show-versions/files"; +my $cachedir = "/var/cache/apt-show-versions"; +unless ( -w "$cachedir") { + $cachedir="$ENV{HOME}/.apt-show-versions"; + mkdir $cachedir unless -e $cachedir; +} +my $apackagescachefile="${cachedir}/apackages"; +my $ipackagescachefile="${cachedir}/ipackages"; +my $filescachefile="${cachedir}/files"; use AptPkg::Config '$_config'; use AptPkg::System '$_system'; @@ -127,7 +132,7 @@ if (!-e $filescachefile or -M $list_dir < -M $filescachefile or !ref($filesref)) { opendir(DIR, $list_dir) or die "Can't opendir $list_dir: $!"; @files = map { $list_dir . $_} grep /Packages$/, readdir(DIR); - ($< == 0) and (store(\@files, $filescachefile) or + (store(\@files, $filescachefile) or warn "Can't write $filescachefile"); } unless (scalar @files > 0) {die "Error: No information about packages! (Maybe no deb entries?)\n"}; @@ -142,7 +147,7 @@ } if (!-e $ipackagescachefile or -M $status_file < -M $ipackagescachefile or !ref($ipackages)) { $ipackages = parse_file ($status_file, 1); - ($< == 0) and (store($ipackages, $ipackagescachefile) or + (store($ipackages, $ipackagescachefile) or warn "Can't write $ipackagescachefile"); } @@ -161,17 +166,24 @@ # Get available package information out of all Packages files foreach (@files) { my $release = $_; + $release =~ s/[-a-z]*_binary-[a-z0-9]+_Packages/Release/; $release =~ s/Packages/Release/; - $release = quotemeta $release; - my $archiv; - $archiv = `fgrep -s Archive $release` or - $archiv = `fgrep -s Suite $release` or - ($release =~ /(potato|woody|sarge|sid|stable|testing|unstable)/ and $archiv = $1) or - $archiv = "unknown"; -# next; - $archiv =~ s/Archive: //; - $archiv =~ s/Suite: //; - $archiv =~ s/\n//; + my $archiv="unknown"; + my $codename; + if (-f "$release" and -r "$release") { + open (RELEASE, $release) or die "bad error"; + while (my $release_line = <RELEASE>) { + $archiv = $1 if $release_line =~ "Origin: +(.+)"; + $codename = $1 if $release_line =~ "Archive: +(.+)"; + $codename = $1 if $release_line =~ "Suite: +(.+)"; + } + close RELEASE; + } + else { + ($release =~ /(potato|woody|sarge|sid|stable|testing|unstable)/ and $codename = $1) or + $codename = "unknown"; + } + $archiv .= "-$codename"; $releases{$archiv} = 1; # Parse Packages file if newer than packages cache @@ -210,10 +222,10 @@ } } # Store if we are root -($< == 0) and (store($apackages, $apackagescachefile) or +(store($apackages, $apackagescachefile) or die "Warning: Can't write to $apackagescachefile!\n"); # Exit if we are root and using the -i option -($< == 0) and (exists $opts{'initialize'}) and exit; +(exists $opts{'initialize'}) and exit; # print info for selected package if (exists $opts{'package'} &&
Attachment:
signature.asc
Description: OpenPGP digital signature