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

Re: Cleaning /var/lib/dpkg/available



George Danchev <danchev@spnet.net> writes:

> On Wednesday 14 June 2006 14:34, Jérôme Warnier wrote:
>> Hi,
>>
>> I've been upgrading my machines since Woody to Sarge, then to Etch. Now,
>> my /var/lib/dpkg/available are huge (15MB), and it seems they never get
>> cleaned.
>> How am I supposed to clean them? Isn't there any automated tools in
>> Debian to do that?
>
> In case you are interested to clear your /var/lib/dpkg/status, here is what I 
> use sometimes. For instance, if you want to purge package section with 
> 'Status: purge ok not-installed', ./this_script > /tmp/status.cleated, and 
> then see what have been removed from it diff'ing against your 
> current /var/lib/dpkg/status. Remember to make a backup before actually 
> replacing the file ;-)
>
>
> #!/usr/bin/perl
>
> use warnings;
> use strict;
>
> my $filename='/var/lib/dpkg/status';
>
> open FILE, $filename or
> die "Failed to open $filename\n";
>
> while (my $line=<FILE>) {
>
>     chomp($line);
>     my @section=();
>
>     while ($line ne "") {
>         push(@section,$line);
>         $line=<FILE>;
>         chomp($line);
>     }
>
>     if ($section[1] ne 'Status: purge ok not-installed') {
>
>         foreach (@section) {
>             $_ = $_ . "\n";
>             print;
>         }
>
>         print"\n";
>     }
> }

grep-dctrl -F Status "purge ok not-installed" status
mv status status.old
grep-dctrl -v -F Status "purge ok not-installed" status.old >status

MfG
        Goswin



Reply to: