#!/usr/bin/perl -w
use strict;

use RPM2;
use Data::Dumper;

my %nuovi;
foreach( glob("*.rpm") ) {
	my $header = RPM2->open_package($_ );

	#print $_, " ", $header->tag("NAME"), " ", $header->version(), " ", $header->release(), " ", $header->arch(), "\n"; 
	#for ( qw/NOSOURCE SOURCE SOURCEPACKAGE SOURCEPKGID SOURCERPM/ ) {
	#	print $_, ": ", $header->tag("$_"), "\n";
	#}

	my $k = $header->tag("NAME") . ":" . ( $header->tag("SOURCEPACKAGE") ? "sourcerpm" : $header->arch() );
	#print $_, "\t\t", $k, "\n";
	$nuovi{ $k }++;
}

foreach( glob("*/*.rpm") ) {
	my $header = RPM2->open_package($_ );

	#print $header->tag("NAME"), " ", $header->version(), " ", $header->release(), "\n"; 
	#print Dumper($header);

	my $k = $header->tag("NAME") . ":" . ( $header->tag("SOURCEPACKAGE") ? "sourcerpm" : $header->arch() );
	$nuovi{ $k } && print "Eliminerei $_\n";
}
