l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
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

@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 ' ';
  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")
    if ( $x =~ /unstable/ && $instdist ne "stable"
         && $instdist ne "testing")

#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

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
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:
O'Reilly and Associates
For numerous book donations.