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 # skip missing files, like "%_excludedocs 0" being active
47 # XXX: this truncates mtime to its low resolution value
48 my $mtime = (stat $f)[9];
49 warn "Mtime failed on $f" unless $mtime;
59 foreach my $file ( @$files ) {
61 my $f = $chroot.$file;
64 while ( $_ = readlink $f and m#^/# ) {
68 my $atime = (stat $f)[8];
69 if ( not defined $atime ) {
70 print "$rpm: $f no atime\n";
71 } elsif ( $atime > 0 ) {
72 #print "$rpm: $file accessed\n";
76 #print "$rpm: $file NOT accessed !\n";
79 print "$rpm may be superfluous !\n";# unless $used;
83 foreach my $rpm ( @rpms ) {
84 my @files = qx/rpm --root=$chroot -ql --what-provides "$rpm"/;
85 next if $files[0] =~ /^no package provides/;
86 #print "*** $rpm ***\n";
88 clear_files( $rpm, \@files );
90 check_files( $rpm, \@files );