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. --- man/C/urpmi.8 | 3 +++ man/C/urpmi.addmedia.8 | 3 +++ man/C/urpmi.cfg.5 | 6 ++++++ man/C/urpmi.update.8 | 3 +++ urpm.pm | 28 ++++++++++++++++++++-------- urpm/args.pm | 4 +++- urpm/cfg.pm | 2 ++ urpmi | 1 + urpmi.addmedia | 1 + urpmi.update | 1 + 10 files changed, 43 insertions(+), 9 deletions(-) diff --git a/man/C/urpmi.8 b/man/C/urpmi.8 index 3f2a1db8..7d7771a5 100644 --- a/man/C/urpmi.8 +++ b/man/C/urpmi.8 @@ -135,6 +135,9 @@ Activate or deactivate rpm signature checking. It's activated by default. .IP "\fB\--test\fP" Test (same as \fBrpm --test\fP) installation of packages but do not modify the system. +.IP "\fB\--norebuild\fP" +Don't try to rebuild the hdlist files from the RPMs if the original hdlist wasn't +readable or was corrupted. .IP "\fB\--excludepath\fP \fIstring\fP" Do not install files whose name begins with the given \fIstring\fP (same as \fBrpm --excludepath\fP). diff --git a/man/C/urpmi.addmedia.8 b/man/C/urpmi.addmedia.8 index 3278499f..f6a1deca 100644 --- a/man/C/urpmi.addmedia.8 +++ b/man/C/urpmi.addmedia.8 @@ -112,6 +112,9 @@ installed. Create a virtual medium, this only works for file:// and removable:// protocol and no files will be created in /var/lib/urpmi. The medium is always up-to-date and so it does not need to be updated by \fBurpmi.update\fP. +.IP "\fB\--norebuild\fP" +Don't try to rebuild the hdlist files from the RPMs if the original hdlist wasn't +readable or was corrupted. .IP "\fB\-c\fP" Clean headers cache directory in /var/cache/urpmi/headers. .IP "\fB\-h\fP" diff --git a/man/C/urpmi.cfg.5 b/man/C/urpmi.cfg.5 index a97d8303..aba640a9 100644 --- a/man/C/urpmi.cfg.5 +++ b/man/C/urpmi.cfg.5 @@ -52,6 +52,12 @@ activated. .B excludedocs Same as \fB--excludedocs\fP for \fBurpmi\fP, default is disabled. +.TP +.B norebuild +Same as \fB--norebuild\fP for \fBurpmi\fP, \fBurpmi.update\fP and +\fBurpmi.addmedia\fP, disabled by default (meaning that \fBurpmi\fP +will try to rebuild hdlists by default). + .TP .B limit-rate Same as \fB--limit-rate\fP for all tools. This option allows to control download diff --git a/man/C/urpmi.update.8 b/man/C/urpmi.update.8 index 19797942..5ba617da 100644 --- a/man/C/urpmi.update.8 +++ b/man/C/urpmi.update.8 @@ -29,6 +29,9 @@ Use only update media. Disable MD5SUM file checking. .IP "\fB\--force-key\fP" Force update of GPG key. +.IP "\fB\--norebuild\fP" +Don't try to rebuild the hdlist files from the RPMs if the original hdlist wasn't +readable or was corrupted. .IP "\fB\-a\fP" Select all media that are not using a removable device to update them. .IP "\fB\-c\fP" 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})); } diff --git a/urpm/args.pm b/urpm/args.pm index afe63c66..b4eb6f2e 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -104,6 +104,7 @@ my %options_spec = ( $options{X} ||= $ENV{DISPLAY} && system('/usr/X11R6/bin/xtest', '') == 0 }, 'verify-rpm!' => sub { $urpm->{options}{'verify-rpm'} = $_[1] }, + 'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1] }, 'test!' => \$::test, 'skip=s' => \$options{skip}, 'root=s' => \$::root, @@ -248,6 +249,7 @@ my %options_spec = ( 'noa|d' => \my $dummy, # default, keeped for compatibility 'q|quiet' => sub { --$options{verbose} }, 'v|verbose' => sub { ++$options{verbose} }, + 'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1]; $options{force} = 0 }, '<>' => sub { push @::toupdates, $_[0] }, }, @@ -295,7 +297,7 @@ foreach my $k ("help|h", "version", "wget", "curl", "proxy=s", "proxy-user=s") { } foreach my $k ("help|h", "wget", "curl", "proxy=s", "proxy-user=s", "c", "f", "z", - "limit-rate=s", "no-md5sum", "update") + "limit-rate=s", "no-md5sum", "update", "norebuild!") { $options_spec{'urpmi.addmedia'}{$k} = $options_spec{'urpmi.update'}{$k}; } diff --git a/urpm/cfg.pm b/urpm/cfg.pm index 3d5b123a..d6c48d6a 100644 --- a/urpm/cfg.pm +++ b/urpm/cfg.pm @@ -105,6 +105,7 @@ sub load_config ($) { #- boolean options if (($no, $k, $v) = /^(no-)?( verify-rpm + |norebuild |fuzzy |allow-(?:force|nodeps) |(?:pre|post)-clean @@ -116,6 +117,7 @@ sub load_config ($) { ) { my $yes = $no ? 0 : 1; $no = $yes ? 0 : 1; + $v = '' unless defined $v; $config{$medium}{$k} = $v =~ /^(yes|on|1|)$/i ? $yes : $no; next; } diff --git a/urpmi b/urpmi index 5af85ef5..48a69055 100755 --- a/urpmi +++ b/urpmi @@ -124,6 +124,7 @@ usage: ") . N(" --skip - packages which installation should be skipped ") . N(" --more-choices - when several packages are found, propose more choices than the default. +") . N(" --norebuild - don't try to rebuild hdlist if not readable. ") . N(" -a - select all matches on command line. ") . N(" -p - allow search in provides to find package. ") . N(" -P - do not search in provides to find package. diff --git a/urpmi.addmedia b/urpmi.addmedia index c382da5c..6875b8e4 100755 --- a/urpmi.addmedia +++ b/urpmi.addmedia @@ -72,6 +72,7 @@ and [options] are from ") . N(" --virtual - create virtual media wich are always up-to-date, only file:// protocol is allowed. ") . N(" --no-md5sum - disable MD5SUM file checking. +") . N(" --norebuild - don't try to rebuild hdlist if not readable. ") . N(" -c - clean headers cache directory. ") . N(" -f - force generation of hdlist files. ") . N(" -q - quiet mode. diff --git a/urpmi.update b/urpmi.update index d018c694..c1a95819 100755 --- a/urpmi.update +++ b/urpmi.update @@ -38,6 +38,7 @@ where is a medium name to update. ") . N(" --update - update only update media. ") . N(" --no-md5sum - disable MD5SUM file checking. ") . N(" --force-key - force update of gpg key. +") . N(" --norebuild - don't try to rebuild hdlist if not readable. ") . N(" -a - select all non-removable media. ") . N(" -c - clean headers cache directory. ") . N(" -f - force generation of hdlist files. -- cgit v1.2.1