l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
April 21: Google Glass
Next Installfest:
TBD
Latest News:
Mar. 18: Google Glass at LUGOD's April meeting
Page last updated:
2003 Mar 09 18:23

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
script for finding out which debian branches your packages came from
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

script for finding out which debian branches your packages came from


  • To: vox-tech@lugodMAPS.org
  • Subject: script for finding out which debian branches your packages came from
  • From: Ken Bloom <kabloom@ucdavisMAPS.edu>
  • Date: Sun, 9 Mar 2003 11:42:10 -0800
  • Delivered-to: lugod@livepenguin.com
  • User-agent: Mutt/1.5.3i

Here's a script that will look at all packages installed on your debian
box and will tell you which branch they match (i.e. how much of your box
is stable, how much is testing, and how much is unstable). If you want
to know about only one or two packages, use `apt-cache policy ...`
instead. This script automatically lists the most stable branch listed 
in the apt-cache policy results. (Which means a package in both stable 
and testing will be listed as stable, or one in both testing and 
unstable will be listed as testing).

#!/usr/bin/perl -w

$started=0;
@policies=`dpkg --get-selections | grep -v deinstall | cut -f 1 | xargs apt-cache policy`;
foreach $x ( @policies ) {
  if ($x =~ /^[a-z]/){ #matches lines with package names
    if ($started==1) { #print last package info
      print $instdist;
      print "\n";
    }
    chomp $x;
    print $x;
    print ' ';
    $started=1;
    $instversion=0;
    $instdist="unknown";
  }
  if ($x =~ /[0-9]+\.[0-9]+/) {$instversion=0;} #match a version number
  if ($x =~ /\*\*\*/ ) {$instversion=1;} #match the current version's ***
  if ($instversion==1 && ($x =~ /http/ || $x =~ /ftp/)){ #match a url line
    if ( $x =~ / stable/ ) {$instdist="stable";}
    if ( $x =~ /testing/ && $instdist ne "stable")
       {$instdist="testing";}
    if ( $x =~ /unstable/ && $instdist ne "stable"
         && $instdist ne "testing")
       {$instdist="unstable";}
  }
}

#print again after the last line
print $instdist;
print "\n";

-- 
I usually have a GPG digital signature included as an attachment.
If you don't know what it is, either ignore it or visit www.gnupg.org
Fingerprint: D5E2 8839 6ED3 3305 805C  941F 9476 A9BD E2B2 CAD1
The key is keyID E2B2CAD1 on pgp.mit.edu

Attachment: pgp00004.pgp
Description: PGP signature



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.