#!/devtool/local/bin/perl
use Env;

$IgmeVersion = shift;
print "IgmeVersion=$IgmeVersion\n";
local $IgmeRelease=substr($IgmeVersion, 0, 3);
print "IgmeRelease=$IgmeRelease\n";

$CurrentDevelopVersion="";
open(PIPE_IN, "$ENV{TOOL}/bin/igme -l |");
while (<PIPE_IN> ) {
    print "Entry:$_\n";
    $currentEntry = substr($_, 0, 15);
    if ( $currentEntry =~ /develop/ ) {
	if ( $currentEntry =~ /^$IgmeRelease/ ) {
            if ( $currentEntry gt $CurrentDevelopVersion ) {
                $CurrentDevelopVersion = $currentEntry;
            }
        }
    }
}
close(PIPE_IN);

print "CurrentDevelopVersion=$CurrentDevelopVersion\n";

