[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Security risks due to packages that are no longer part of Debian?



> A tool which lists all packages which are no longer downloadable from
> any APT source would be more helpful, I think.  Does it already exist?

I have a slighty inefficient script for that. I believe there are better 
ways to do what listallpackages does, unknown to the author of the script 
back then ;-) (Reminder to myself: Don't post ugly hacks to mailing
lists.) At least this does its purpose without deselect nor aptitude.

  #!/bin/sh
  helper/listallpackages \
          | while read package version
          do
          
          # Is that version in the apt package lists?
          if ! apt-cache showpkg $package 2>&1 \
                  | egrep "(^$version.*/var/lib/apt/lists/)" \
                  &>/dev/null
          then
                  echo "W: '$package' is not downloadable"
          fi
  done

Where helper/listallpackages is:

  #!/usr/bin/perl 

  $statusfile = '/var/lib/dpkg/status';

  if( -e $statusfile) {
          open(PKG_SOURCE, "< $statusfile") || 
                    die "Cannot open $statusfile - $!\n";
          $/ = "";  #snarf a paragraph at a time
          while(<PKG_SOURCE>) {
                  $clump = $_; 
                  if (/Status: install ok installed/) {
                  $clump =~ /Package: (.*)/; print "$1 ";
                  $clump =~ /Version: (.*)/; 
                  $v = $1;
                  $v =~ s/\+/\\\\\\+/g; print "$v\n";
                  }
          }
          close (PKG_SOURCE);
  }



Reply to: