From e0f1796baf5c0a2cf7758aac26d1abf538557fcf Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Tue, 6 Sep 2005 15:56:38 +0000 Subject: - show all missing directory before dying when --skipmissingdir is not specified --- gendistrib | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'gendistrib') diff --git a/gendistrib b/gendistrib index 9bb0a71..aba5d40 100755 --- a/gendistrib +++ b/gendistrib @@ -104,15 +104,22 @@ while (my ($k, $v) = each(%default_urpmfiles)) { $distrib->check(\*STDERR) unless $nooutput; my @hdlists; +my @media_mising_dirs; foreach ($distrib->listmedia) { $distrib->getvalue($_, 'askmedia') || $distrib->getvalue($_, 'suppl') and next; + + if (! -d ($distrib->getfullpath($_, 'path'))) { if ($skipmissingdir) { - printf STDERR "Skipping missing media %s\n", $distrib->getpath($_, 'path') unless $nooutput; - next; + printf(STDERR + "Skipping missing media %s\n", + $distrib->getpath($_, 'path') + ) unless $nooutput; } else { - die sprintf("Missing dir '%s' for media '%s'", $distrib->getpath($_, 'path'), $distrib->getvalue($_, 'name')); + # delaying error report to report all errors, not the only first + push(@media_mising_dirs, $_); } + next; } push @hdlists, { @@ -128,6 +135,18 @@ foreach ($distrib->listmedia) { }; } +# if there is result here, $skipmissingdir is not set and there is errors: +if (@media_mising_dirs) { + foreach my $media (@media_mising_dirs) { + printf(STDERR + "Missing dir '%s' for media '%s'\n", + $distrib->getpath($media, 'path'), + $distrib->getvalue($media, 'name') + ); + } + die "Stopping because dirs are missing, specify --skipmissingdir to ignore\n"; +} + sub clean_cache { unless ($noclean) { system($ENV{LD_LOADER} ? $ENV{LD_LOADER} : @{[]}, "rm", "-rf", $headers_dir); -- cgit v1.2.1