6 die "Arguments missing: $0 [-c] <chroot> <spec>\n" unless @ARGV;
8 if ( $ARGV[0] eq "-c" ) {
12 my $chroot = shift @ARGV or die "chroot directory not specified\n";
13 my $spec = shift @ARGV or die "Spec file not specified\n";
15 -d $chroot or die "chroot '$chroot' is not a directory\n";
16 -r $spec or die "spec file '$spec' is not readable\n";
19 open F_IN, "<", $spec or die "Cannot open '$spec'\n";
21 if ( /^\s*(?:%{.*)?BuildRequires:\s*(\S+)/i ) {
25 } elsif ( /^%(prep|build|changelog)/ ) {
35 foreach my $file ( @$files ) {
37 my $f = $chroot.$file;
39 # XXX: this truncates mtime to its low resolution value
40 my $mtime = (stat $f)[9];
41 warn "Mtime failed on $f" unless $mtime;
51 foreach my $file ( @$files ) {
53 my $f = $chroot.$file;
55 my $atime = (stat $f)[8];
57 #print "$rpm: $file accessed\n";
61 #print "$rpm: $file NOT accessed !\n";
64 print "$rpm may be superfluous !\n";# unless $used;
68 foreach my $rpm ( @rpms ) {
69 my @files = qx/rpm --root=$chroot -ql --what-provides "$rpm"/;
70 next if $files[0] =~ /^no package provides/;
71 #print "*** $rpm ***\n";
73 clear_files( $rpm, \@files );
75 check_files( $rpm, \@files );