Created
July 1, 2016 14:49
-
-
Save bapril/b679382c9e55ab9426ff3ed9179fe30c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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