File: check-thumbnails.pl

package info (click to toggle)
games-thumbnails 20100826
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 100,344 kB
  • ctags: 26
  • sloc: python: 56; makefile: 54; perl: 34
file content (41 lines) | stat: -rw-r--r-- 968 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/perl
use strict;
use warnings;
use AptPkg::Cache;

my $cache = AptPkg::Cache->new;
my $policy = $cache->policy;

foreach my $thumb (sort(<*.png>, <*.jpg>)) {
    (my $pkg = $thumb) =~ s/\..*?$//;

    my $p = $cache->{$pkg};
    unless ($p)
    {
        warn "Apt doesn't know about $pkg\n";
        next;
    }

    my $available = $p->{VersionList};
    unless ($available)
    {
        warn "Apt doesn't know any available version of $pkg\n";
        next;
    }

    my ($unstable, $testing);
    for my $v (@$available)
    {
        for my $f (map $_->{File}, @{$v->{FileList}})
        {
            if ($f->{Origin} and $f->{Origin} eq 'Debian' and $f->{Component} eq 'main')
            {
                $testing ||= $f->{Archive} eq 'testing';
                $unstable ||= $f->{Archive} eq 'unstable';
            }
        }
    }

    warn "$pkg is not in unstable\n" if not $unstable;
    warn "$pkg is not in testing\n" if not $testing;
}