From 793988e186f85b0378efb5db6686315ee5cde1a6 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Fri, 15 Jun 2007 20:50:03 +0000 Subject: - fail before generating any file when no *.rpm are found - do not default to directory ".", the directory is now mandatory --- genhdlist2 | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'genhdlist2') diff --git a/genhdlist2 b/genhdlist2 index 0d727ef..11648c3 100644 --- a/genhdlist2 +++ b/genhdlist2 @@ -28,8 +28,8 @@ sub main() { 'version' => sub { warn "$0 version $VERSION\n"; exit 0 }, ); - @ARGV <= 1 or usage(); - my $rpms_dir = $ARGV[0] || '.'; + @ARGV == 1 or usage(); + my $rpms_dir = $ARGV[0]; do_it($rpms_dir, %options); } @@ -44,6 +44,8 @@ sub do_it { $verbose = $options{verbose}; $no_bad_rpm = $options{no_bad_rpm}; + my @rpms = grep { /\.rpm$/ } all($rpms_dir) or die "no *.rpm found in $rpms_dir\n"; + my $media_info_dir = "$rpms_dir/media_info"; -e $media_info_dir || mkdir $media_info_dir or die "Can't mkdir $media_info_dir: $!n"; -d $media_info_dir && -w _ && -x _ or die "$media_info_dir isn't a writable directory, bailing out\n"; @@ -62,7 +64,6 @@ sub do_it { }; END { unlink $lock_file if $lock } - my @rpms = grep { /\.rpm$/ } all($rpms_dir); my %rpms_todo = map { /(.*)\.rpm/ => 1 } @rpms; my $urpm = new URPM; @@ -222,7 +223,7 @@ genhdlist2 - generates an hdlist and a synthesis file =head1 SYNOPSIS - genhdlist2 [options] [dir] + genhdlist2 [options] dir =head1 OPTIONS -- cgit v1.2.1