#!/usr/bin/perl -w

# Enable for debuggin
$opt_v = 0;
$description = 0;
$lines = -1;
while  (<STDIN>)  {
	chomp;
	push @packages, $package if ( $description && /^\Q $text\E.$/ );
	$description = 0 if $description;
	if (/^Package: (.*)$/) {
		push @oneliners, $package if $lines == 2;
		push @nodesc, $package if $lines == 1;
		print STDERR "Read $lines\n" if $opt_v;
		$package = $1 ;
		print STDERR "Processing $package\n" if $opt_v;
		$description = 0;
		$lines = -1;
	}
	$lines++ if $lines >= 0;
	if ( /^Description: (.*)$/ ) {
		$text = $1;
		$description = 1;
		$lines = 0;
		print STDERR "Read $text\n" if $opt_v;
	}
}

if ( @packages != 0 ) {
	print "The following packages first long description line\n";
	print "is the same as the short description\n";
	print "-" x 40;
	print "\n";
	while ( $package = pop @packages) {
		print "$package\n";
	}
	print "-" x 40;
	print "\n";
}
if ( @nodesc != 0 ) {
	print "The following packages do not have an extended description\n";
	print "-" x 40;
	print "\n";
	while ( $package = pop @nodesc) {
		print "$package\n";
	}
	print "-" x 40;
	print "\n";
}
if ( @oneliners != 0 ) {
	print "The following packages have an extended description of only one line:\n";
	print "-" x 40;
	print "\n";
	while ( $package = pop @oneliners) {
		print "$package\n";
	}
	print "-" x 40;
	print "\n";
}
exit 0;

