Browse Source

added

tags/version_1_26
Joey Hess 18 years ago
parent
commit
c9592dc564
1 changed files with 43 additions and 0 deletions
  1. +43
    -0
      makeoverride.pl

+ 43
- 0
makeoverride.pl View File

@@ -0,0 +1,43 @@
#!/usr/bin/perl
#
# makeoverride directory
#
# This program spits out an override file for the tasks.

my $dir=shift or die "no directory specified\n";

my %p;
use File::Find;
find(\&processfile, $dir);

print "$_\tTask\t", (join ", ", sort keys %{$p{$_}}), "\n"
for sort keys %p;

sub processfile {
my $file=$_; # File::Find craziness.
return unless $file =~ /^[-+_.a-z0-9]+$/ and -f $file;
open (IN, $file) or die "$file: $!";
my %fields;
my $field="";
while (<IN>) {
chomp;
next if /^\s*#/;
s/#.*//;

if (/^\s/) {
$fields{$field}.="\n$_";
}
else {
($field, my $value)=split(/:\s*/, $_, 2);
$field=lc($field);
$fields{$field}=$value;
}
}
close IN;
foreach my $field (qw(key packages)) {
foreach my $package(split(' ', $fields{$field})) {
$p{$package}->{$fields{task}} = 1;
}
}
}

Loading…
Cancel
Save