mirror of the now-defunct rocklinux.org
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.

83 lines
1.3 KiB

  1. #!/usr/bin/perl -w
  2. use English;
  3. use strict;
  4. if (not defined $ARGV[0] or not chdir $ARGV[0]) {
  5. print "\nUsage: $0 rootdir [min-pkgcount] [dir-regex]\n\n";
  6. print "E.g.: $0 build/ref0818-2.1.0-DEV-x86-reference-expert\n\n";
  7. exit 1;
  8. }
  9. shift @ARGV;
  10. my $minpkgcount = 0;
  11. my $dirregex;
  12. if (defined $ARGV[0] and $ARGV[0] =~ /^[0-9]+$/) {
  13. $minpkgcount = $ARGV[0];
  14. shift @ARGV;
  15. }
  16. if (defined $ARGV[0]) {
  17. $dirregex = $ARGV[0];
  18. shift @ARGV;
  19. }
  20. my %baddirs;
  21. my %badcount;
  22. my %badpkgs;
  23. while (<var/adm/dep-debug/*>) {
  24. /.*\/(\S+)/;
  25. my $p = $1;
  26. my %dirdep;
  27. my %filedep;
  28. next if $p eq "rock-debug";
  29. open P, $_ or die $!;
  30. while (<P>) {
  31. chomp;
  32. my ($d, $f) = split /: /;
  33. next if $d =~ /-dirtree$/;
  34. if ($dirregex ne "") {
  35. next if $f !~ /$dirregex/;
  36. }
  37. if (-d $f) {
  38. $dirdep{$d}{$f} = 1;
  39. } else {
  40. $filedep{$d} = 1;
  41. }
  42. }
  43. close P;
  44. foreach (keys %filedep) {
  45. delete $dirdep{$_};
  46. }
  47. foreach my $d (keys %dirdep) {
  48. foreach (keys %{$dirdep{$d}}) {
  49. $baddirs{$d}{$_}++;
  50. $badpkgs{$d}{$p}++;
  51. }
  52. $badcount{$d}++;
  53. }
  54. }
  55. foreach my $d (keys %badcount) {
  56. next if $badcount{$d} < $minpkgcount;
  57. print "\nFound pure dir dependencies to $d ($badcount{$d}):\n";
  58. foreach (keys %{$badpkgs{$d}}) {
  59. print "\tpkg\t$badpkgs{$d}{$_}\t$_\n";
  60. }
  61. foreach (keys %{$baddirs{$d}}) {
  62. print "\tdir\t$baddirs{$d}{$_}\t$_\n";
  63. }
  64. }
  65. print "\n";
  66. exit 0;