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.
 
 
 

46 lines
926 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 if $File::Find::dir=~/\.svn/;
  16. return unless $file =~ /^[-+_.a-z0-9]+$/ and -f $file;
  17. open (IN, $file) or die "$file: $!";
  18. my %fields;
  19. my $field="";
  20. while (<IN>) {
  21. chomp;
  22. next if /^\s*#/;
  23. s/#.*//;
  24. if (/^\s/) {
  25. $fields{$field}.="\n$_";
  26. }
  27. else {
  28. ($field, my $value)=split(/:\s*/, $_, 2);
  29. $field=lc($field);
  30. $fields{$field}=$value;
  31. }
  32. }
  33. close IN;
  34. foreach my $field (qw(key packages-list)) {
  35. foreach my $package(split(' ', $fields{$field})) {
  36. $p{$package}->{$fields{task}} = 1;
  37. }
  38. }
  39. }