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;
40 while ( $_ = readlink $f and m#^/# ) {
44 # XXX: this truncates mtime to its low resolution value
45 my $mtime = (stat $f)[9];
46 warn "Mtime failed on $f" unless $mtime;
56 foreach my $file ( @$files ) {
58 my $f = $chroot.$file;
61 while ( $_ = readlink $f and m#^/# ) {
65 my $atime = (stat $f)[8];
66 if ( not defined $atime ) {
67 print "$rpm: $f no atime\n";
68 } elsif ( $atime > 0 ) {
69 #print "$rpm: $file accessed\n";
73 #print "$rpm: $file NOT accessed !\n";
76 print "$rpm may be superfluous !\n";# unless $used;
80 foreach my $rpm ( @rpms ) {
81 my @files = qx/rpm --root=$chroot -ql --what-provides "$rpm"/;
82 next if $files[0] =~ /^no package provides/;
83 #print "*** $rpm ***\n";
85 clear_files( $rpm, \@files );
87 check_files( $rpm, \@files );