#!/usr/bin/perl $cache=1; print "Dependency list\n"; print "---------------\n"; for $file (<*.tgz>) { $name = $file; $name =~ s/\.tgz$//; unless ($cache && -f "t/CONTENTS.$name") { system("tar zxqf $file +CONTENTS"); rename("+CONTENTS", "t/CONTENTS.$name"); } open(FILE, "t/CONTENTS.$name") or die "No contents"; $deps{$name}=[]; while () { chomp; if (m/^\@pkgdep\s+/) { push(@{$deps{$name}}, $'); } } close(FILE); print $name, ": ", join(',', @{$deps{$name}}), "\n"; } print "Checking topological order\n"; print "--------------------------\n"; # check recursive brokeness while (($key, $value) = each %deps) { %pulled=(); for $np (@$value) { for $rec (@{$deps{$np}}) { unless (defined $pulled{$rec}) { print "Error: $key depends on $np which depends on $rec\n"; print "(", join(",", @$value), ")\n"; } } $pulled{$np} = 1; } }