#!/usr/bin/perl -w
my $package_name = '';
print "digraph cygwin_setup_ini {\n";
print "\tnode [shape = ellipse, style=filled, fillcolor=cornsilk];\n";

$file = 'setup.ini';
open(INFO, $file);
@lines = <INFO>;
close(INFO);

foreach my $line (@lines)
{
  $line =~ s/\R//g;
  if ($line =~ /^@ /)
  {
    ($package_name = $line) =~ s/^@ //;
  }
  elsif ($line =~ /^requires: /)
  {
    (my $requires = $line) =~ s/^requires: //;
    my @rqts = split(/ /, $requires);
    foreach my $rqt (@rqts)
    {
      print "\t\"${package_name}\" -> \"${rqt}\";\n";
    }
  }
}

print "}\n";

