#!perl

use strict;

my $packagename;
my $requires;

print "digraph setup_ini {\n";

while (<>)
{
  if (/^@/)
  {
    # Get current line
    $packagename=$_;
    # Strip leading @ and space
    $packagename=~s/^@ //;
    # Remove EOL for concatenation later
    chomp($packagename);
  }

  if (/^requires: /)
  {
    $requires=$_;
    # Strip non-package name header
    $requires=~ s/^requires: //;
    # and EOL
    chomp($requires);
    # Put quotes around each name
    $requires=~ s/([^ ]+)/"$packagename" -> "\1" ;\n/g;
    print $requires . "\n";
  }
}
continue
{
  close ARGV if eof;
}

print "}\n";


