Skip to content

Instantly share code, notes, and snippets.

@bapril
Created July 1, 2016 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bapril/b679382c9e55ab9426ff3ed9179fe30c to your computer and use it in GitHub Desktop.
Save bapril/b679382c9e55ab9426ff3ed9179fe30c to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
print "digraph g {\n";
open(PKGS, "dpkg -l |egrep \"^[a-zA-Z0-9]{2} \" | awk {'print \$2'} |");
while(<PKGS>){
my $pkg = $_;
chomp($pkg);
print "\"$pkg\" [shape=square];\n";
open(DEPS, "apt-cache show $pkg |grep Depends |sed -e \"s/([^)]*)//g\" | sed -e \"s/Depends: //\"| sed -e \"s/ //g\" | ");
while(<DEPS>){
my $dep_list = $_;
foreach $dep (split(',',$dep_list)) {
chomp($dep);
print "\"$pkg\" -> \"$dep\"\n";
}
}
close(DEPS);
}
close(PKGS);
print "}\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment