#!/usr/bin/perl # # This script checks the listed RPMS and SRPMS # die "usage: check rpm_dir srpm_dir rpm_list\n" unless ($#ARGV == 2); # Validate the args $rpm_dir = shift; die "bad rpm_dir specified ($rpm_dir)\n" unless (-d $rpm_dir); $srpm_dir = shift; die "bad rpm_dir specified ($srpm_dir)\n" unless (-d $srpm_dir); $list = shift; die "bad rpm_list specified ($list)\n" unless (-f $list); # Process the list open LIST, "<$list"; while () { chomp; # Skip comments next if (m/^\s*#/); # Skip blank lines next if ($_ eq ""); # Remove extra options like --nodeps and --force $rpm = $_; $rpm =~ s/\.rpm.*/\.rpm/; # Get the RPM name and path # Look before you leap... if (-f "$rpm_dir/$rpm") { $srpm = `rpm -qp --qf '%{SOURCERPM}' $rpm_dir/$rpm`; unless (-f "$srpm_dir/$srpm") { print "missing SRPM: $srpm\n"; print "\tneeded by: $rpm\n"; } } else { print "missing RPM: $rpm\n"; } } close LIST;