diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-09-30 13:39:34 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.org> | 2005-09-30 13:39:34 +0000 |
commit | 1d8305349363cadd4046da7bdc14d752f427b50a (patch) | |
tree | 4a0786c67e67cf2db5cc184bce4741f26001b957 /genhdlist | |
parent | c1d9955a80ec1b997c7ffc802777fda85b831b35 (diff) | |
download | rpmtools-1d8305349363cadd4046da7bdc14d752f427b50a.tar rpmtools-1d8305349363cadd4046da7bdc14d752f427b50a.tar.gz rpmtools-1d8305349363cadd4046da7bdc14d752f427b50a.tar.bz2 rpmtools-1d8305349363cadd4046da7bdc14d752f427b50a.tar.xz rpmtools-1d8305349363cadd4046da7bdc14d752f427b50a.zip |
Add an option --md5sum
Diffstat (limited to 'genhdlist')
-rw-r--r-- | genhdlist | 24 |
1 files changed, 18 insertions, 6 deletions
@@ -26,10 +26,9 @@ use File::Path; use Getopt::Long; use Pod::Usage; -# TODO generate MD5SUM # TODO more flexiblity about destination directory -my ($noclean, $nooutput, $dontdie, $suffix, $dest) = (0, 0, 0, "", ""); +my ($noclean, $nooutput, $dontdie, $md5sum, $suffix, $dest) = (0, 0, 0, 0, "", ""); my $tmpdir = (-d "$ENV{HOME}/tmp" ? "$ENV{HOME}/tmp" : $ENV{TMPDIR} || "/tmp") . "/.build_hdlist"; sub usage () { @@ -42,6 +41,7 @@ GetOptions( 'help|h' => sub { usage(); exit 0 }, nobadrpm => \$dontdie, noclean => \$noclean, + md5sum => \$md5sum, s => \$nooutput, 'suffix=s' => \$suffix, 'v|version' => sub { warn "$0 version $VERSION\n"; exit 0 }, @@ -50,7 +50,7 @@ GetOptions( my $urpm = new URPM; my $index = "hdlist$suffix.cz"; my $synthesis = "synthesis.$index"; -my @dir = @ARGV ? @ARGV : ("."); +my @dir = @ARGV ? @ARGV : ("."); grep { m!^/! } @dir and die "Directories to parse should be relative\n"; @@ -62,7 +62,8 @@ my @rpms; my %rpmslist; # get rpm list -open my $list, ">", "list$suffix" or die "Can't create list file: $!\n"; +open my $list, ">", "list$suffix" + or die "Can't create list file [list$suffix]: $!\n"; foreach my $dir (@dir) { print "parsing $dir\n" unless $nooutput; @rpms = (); @@ -92,12 +93,12 @@ foreach my $dir (@dir) { }, ); # This code will become useless... see above - foreach my $rpm (@rpms) { + foreach my $rpm (@rpms) { $rpmslist{($rpm =~ m!.*/(.*)\z!)[0]} or next; print $list "$rpm\n"; } } -close($list); +close $list; # create index file # No rpms, exit ! @@ -119,6 +120,13 @@ $urpm->build_synthesis( synthesis => $synthesis, ); +if ($md5sum) { + my $m = qx(/usr/bin/md5sum '$index' '$synthesis'); + open my $f, '>', 'MD5SUM' or die "Can't write MD5SUM: $!\n"; + print $f $m; + close $f; +} + __END__ =head1 NAME @@ -141,6 +149,10 @@ Build index from this directory. Put temporary files in directory. +=item --md5sum + +Generates an MD5SUM file. + =item --nobadrpm Do not abort on bad rpms. |