File: gensections.pl

package info (click to toggle)
popularity-contest 1.79
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 576 kB
  • sloc: perl: 1,267; python: 450; sh: 374; makefile: 42
file content (25 lines) | stat: -rwxr-xr-x 509 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
#! /usr/bin/perl -wT

my $mirrorbase = "/srv/mirrors/debian";
my $docurlbase = "";

$ENV{PATH}="/bin:/usr/bin";

for (glob("$mirrorbase/dists/stable/*/binary-*/Packages.xz"))
{
  /([^[:space:]]+)/ or die("incorrect package name");
  $file = $1;#Untaint
  open AVAIL, "-|:encoding(UTF-8)","xzcat $file";
  while(<AVAIL>)
  {
/^Package: (.+)/  and do {$p=$1;next;};
/^Section: (.+)/ or next;
          $section{$p}=$1;
  }
  close AVAIL;
}
@pkgs=sort keys %section;
for (@pkgs)
{
  print "$_ $section{$_}\n";
}