You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

45 lines
883 B

  1. #!/usr/bin/perl
  2. #
  3. # makeoverride directory
  4. #
  5. # This program spits out an override file for the tasks.
  6. my $dir=shift or die "no directory specified\n";
  7. my %p;
  8. use File::Find;
  9. find(\&processfile, $dir);
  10. print "$_\tTask\t", (join ", ", sort keys %{$p{$_}}), "\n"
  11. for sort keys %p;
  12. sub processfile {
  13. my $file=$_; # File::Find craziness.
  14. $file eq 'po' && -d $file && ($File::Find::prune = 1);
  15. return unless $file =~ /^[-+_.a-z0-9]+$/ and -f $file;
  16. open (IN, $file) or die "$file: $!";
  17. my %fields;
  18. my $field="";
  19. while (<IN>) {
  20. chomp;
  21. next if /^\s*#/;
  22. s/#.*//;
  23. if (/^\s/) {
  24. $fields{$field}.="\n$_";
  25. }
  26. else {
  27. ($field, my $value)=split(/:\s*/, $_, 2);
  28. $field=lc($field);
  29. $fields{$field}=$value;
  30. }
  31. }
  32. close IN;
  33. foreach my $field (qw(key packages)) {
  34. foreach my $package(split(' ', $fields{$field})) {
  35. $p{$package}->{$fields{task}} = 1;
  36. }
  37. }
  38. }