From 228e9f101df598b634208de6e4b5690a8810f28b Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Thu, 14 Oct 2004 01:56:45 +0000 Subject: Implement a new option, --norebuild, to urpmi, urpmi.update and urpmi.addmedia. It prevents rebuilding the hdlist from the headers of the RPMs for a local media. It's also settable globally in the urpmi.cfg file. Comes with doc. --- urpm.pm | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'urpm.pm') diff --git a/urpm.pm b/urpm.pm index 6701e5a1..5ca89560 100644 --- a/urpm.pm +++ b/urpm.pm @@ -148,6 +148,7 @@ sub read_config { split-length split-level verify-rpm + norebuild )) { if (defined $config->{''}{$opt} && !exists $urpm->{options}{$opt}) { $urpm->{options}{$opt} = $config->{''}{$opt}; @@ -1206,18 +1207,28 @@ this could happen if you mounted manually the directory when creating the medium } } } else { - $options{force} < 2 and $options{force} = 2; + if ($urpm->{options}{norebuild}) { + $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $medium->{name})); + $medium->{ignore} = 1; + } else { + $options{force} < 2 and $options{force} = 2; + } } #- if copying hdlist has failed, try to build it directly. if ($error) { - $options{force} < 2 and $options{force} = 2; - #- clean error state now. - $error = undef; + if ($urpm->{options}{norebuild}) { + $urpm->{error}(N("unable to access hdlist file of \"%s\", medium ignored", $_->{name})); + $medium->{ignore} = 1; + } else { + $options{force} < 2 and $options{force} = 2; + #- clean error state now. + $error = undef; + } } if ($options{force} < 2) { - #- examine if a local list file is available (always probed according to with_hdlist + #- examine if a local list file is available (always probed according to with_hdlist) #- and check hdlist has not be named very strangely... if ($medium->{hdlist} ne 'list') { my $local_list = $medium->{with_hdlist} =~ /hd(list.*)\.cz2?$/ ? $1 : 'list'; @@ -1815,13 +1826,14 @@ this could happen if you mounted manually the directory when creating the medium ); #- synthesis needs to be created, since the medium has been built from rpm files. eval { $urpm->build_synthesis( - start => $medium->{start}, - end => $medium->{end}, - synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", + start => $medium->{start}, + end => $medium->{end}, + synthesis => "$urpm->{statedir}/synthesis.$medium->{hdlist}", ) }; if ($@) { $urpm->{error}(N("Unable to build hdlist and synthesis files for medium \"%s\".", $medium->{name})); unlink "$urpm->{statedir}/$medium->{hdlist}", "$urpm->{statedir}/synthesis.$medium->{hdlist}"; + $medium->{ignore} = 1; } else { $urpm->{log}(N("built hdlist synthesis file for medium \"%s\"", $medium->{name})); } -- cgit v1.2.1