This may be redundant, or it may be useful. All I know is that it
works for me: The following script will verify the contents of your
cooker/misc/rpmslist against the actual contents of your RPMS
and report on
- packages missing in the RPMS
- multiple versions of the same package
- packages in RPMS but missing in your rpmslist
- total count and size of all rpms for each CD
This is based on the mkcd.pl so as to be as compatible with it as
possible (same regexs &c). You can also take the output list of
extra packages and simply cut and paste into your rpmslist.
#!/usr/bin/perl
########################################################################
# Perl Program: chklist.pl
#
# Mandrake Cooker utility program to check your rpmslist file against
# the actual files in your Mandrake/RPMS directory. Given the same
# repository directory as the mkcd.pl script, this script will check
# for duplicate packages (same package different versions), packages
# listed in the rpmslist but missing from the RPMS and packages found
# in the RPMS but missing from the rpmslist.
#
# The output report will also list the total size can count of all RPMS
# for each CD (but remember to leave some room on CD1!)
#
# This program is licensed under the GNU General Public License
#
# Created: Sat Jul 14 14:28:31 EDT 2001
# $Log: chklist.pl,v $
# Revision 1.2 2001/07/14 18:39:54 garym
# added documentation
#
# Revision 1.1 2001/07/14 18:32:43 garym
# Initial release to the cooker mailing list
#
#
# Author: Gary Lawrence Murphy <[EMAIL PROTECTED]>
# Copyright: 2001 TeleDynamics Communications Inc (www.teledyn.com)
# Version: $Id: chklist.pl,v 1.2 2001/07/14 18:39:54 garym Exp $
########################################################################
my $version = '$Id: chklist.pl,v 1.2 2001/07/14 18:39:54 garym Exp $';
my ($rep,$verbose) = @ARGV;
$rep or usage();
open A, "$rep/Mandrake/base/rpmslist";
my ($count,$size,$num,@a);
my @cd;
my %list;
my %count;
my %size;
while(<A>){
/<\/CD>/ and $num = 0;
/<CD num=(\d+)>/ and do { $num = $1; push @cd, $num};
/(?:<.*>)*([^<]*)\n/;
$1 and do {
push @{$list{$num}}, $1;
}
}
close A;
print "\nPACKAGE DUPLICATES " . ("=" x 50) . "\n";
my $dir = "$rep/Mandrake/RPMS";
my %rpms;
opendir DIR, $dir or die "unable to opendir $dir: !$\n";
foreach (readdir DIR) {
my ($file, $pkg)
= /(([^\/]*)-[^-]*-[^-]*\.[^\/\.]*\.rpm)$/ or next;
$rpms{$pkg} and do {
print "\n$pkg\t $file / " . $rpms{$pkg};
next;
};
$file and do {
$rpms{$pkg} = $file;
};
}
print "\n";
foreach my $disk (@cd){
print "\nCD $disk " . "=" x 64;
foreach my $pkg (@{$list{$disk}}) {
if ( $rpms{$pkg} && !($rpms{$pkg} eq "") ) {
$count{$disk}++;
$size{$disk} += -s "$dir/" . $rpms{$pkg};
if ($verbose) {
print "\n";
print -s "$dir/" . $rpms{$pkg};
print "\t$pkg";
}
undef $rpms{$pkg};
} else {
print "\nmissing $pkg";
}
}
print "\n\tDISK $disk TOTALS:\n\t\tfile count: " . $count{$disk};
print "\n\t\ttotal size: " . $size{$disk};
print " (" . int($size{$disk} / 1024 / 1024) . "M)";
}
print "\nUNREFERENCED PACKAGES " . ("=" x 47) . "\n";
foreach my $pkg (sort keys %rpms) {
$rpms{$pkg} and do {
print "\n$pkg";
print "\t" . $rpms{$pkg} if $verbose;
};
}
print "\n";
########################################################################
sub usage {
print "
Cooker chklist version $version
Copyright 2001 by Teledynamics (www.teledyn.com)
Verify cooker/Mandrake/RPMS against cooker/misc/rpmslist and
report missing or extra files and disk sizes.
usage:
$0 <cooker dir>
\n";
exit;
}
# 2001 by TeleDynamics Communications Inc - [EMAIL PROTECTED]