diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2006-11-29 15:46:25 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2006-11-29 15:46:25 +0000 |
commit | 50bfacb9170146abf3c11332cf509734d117a91f (patch) | |
tree | 6b07521f180be3ca940fdfa77fb2d5273a3cad19 | |
parent | df95f65347ad42a943b273e0bbaaf865826c93cc (diff) | |
download | urpmi-50bfacb9170146abf3c11332cf509734d117a91f.tar urpmi-50bfacb9170146abf3c11332cf509734d117a91f.tar.gz urpmi-50bfacb9170146abf3c11332cf509734d117a91f.tar.bz2 urpmi-50bfacb9170146abf3c11332cf509734d117a91f.tar.xz urpmi-50bfacb9170146abf3c11332cf509734d117a91f.zip |
directly set $urpm->{root}, it's simpler
(also use it in urpm::get_pkgs::selected2list() even if callers didn't pass it)
-rw-r--r-- | urpm/args.pm | 4 | ||||
-rw-r--r-- | urpm/get_pkgs.pm | 4 | ||||
-rw-r--r-- | urpm/media.pm | 4 | ||||
-rw-r--r-- | urpm/select.pm | 3 | ||||
-rw-r--r-- | urpme | 5 | ||||
-rwxr-xr-x | urpmi | 15 | ||||
-rwxr-xr-x | urpmq | 8 |
7 files changed, 20 insertions, 23 deletions
diff --git a/urpm/args.pm b/urpm/args.pm index b1d10f32..b843735d 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -120,8 +120,8 @@ my %options_spec = ( 'skip=s' => \$options{skip}, 'root=s' => sub { require File::Spec; - $options{root} = File::Spec->rel2abs($_[1]); - if (!-d $options{root}) { + $urpm->{root} = File::Spec->rel2abs($_[1]); + if (!-d $urpm->{root}) { $urpm->{fatal}->(9, N("chroot directory doesn't exist")); } $options{nolock} = 1; diff --git a/urpm/get_pkgs.pm b/urpm/get_pkgs.pm index 29a3ce1f..c1c150a6 100644 --- a/urpm/get_pkgs.pm +++ b/urpm/get_pkgs.pm @@ -85,7 +85,7 @@ sub selected2list { } elsif (keys(%{$file2fullnames{$filename} || {}}) == 1) { my ($fullname) = keys(%{$file2fullnames{$filename} || {}}); if (defined(my $id = $fullname2id{$fullname})) { - if (!/\.delta\.rpm$/ || $urpm->is_delta_installable($urpm->{depslist}[$id], $options{root})) { + if (!/\.delta\.rpm$/ || $urpm->is_delta_installable($urpm->{depslist}[$id], $urpm->{root})) { $sources{$id} = "$medium->{url}/$filename"; } } @@ -118,7 +118,7 @@ sub selected2list { unless (exists($list_examined{$fullname})) { ++$list_warning; if (defined(my $id = $fullname2id{$fullname})) { - if ($fi !~ /\.delta\.rpm$/ || $urpm->is_delta_installable($urpm->{depslist}[$id], $options{root})) { + if ($fi !~ /\.delta\.rpm$/ || $urpm->is_delta_installable($urpm->{depslist}[$id], $urpm->{root})) { $sources{$id} = "$medium->{url}/" . $fi; } } diff --git a/urpm/media.pm b/urpm/media.pm index 217b6cd3..d2134128 100644 --- a/urpm/media.pm +++ b/urpm/media.pm @@ -442,7 +442,7 @@ sub write_config { #- read urpmi.cfg file as well as necessary synthesis files #- options : -#- root +#- root (deprecated, set directly $urpm->{root}) #- cmdline_skiplist #- nocheck_access (used by read_config) #- @@ -479,7 +479,7 @@ sub configure { } } else { #- nb: can't have both parallel and root - $urpm->{root} = $options{root}; + $urpm->{root} = $options{root} if $options{root}; } $urpm->{root} && ! -c "$urpm->{root}/dev/null" diff --git a/urpm/select.pm b/urpm/select.pm index fa018352..658c80ec 100644 --- a/urpm/select.pm +++ b/urpm/select.pm @@ -235,7 +235,6 @@ sub resolve_dependencies { #- callback_notfound #- force #- matches -#- root #- test sub find_packages_to_remove { my ($urpm, $state, $l, %options) = @_; @@ -244,7 +243,7 @@ sub find_packages_to_remove { #- invoke parallel finder. $urpm->{parallel_handler}->parallel_find_remove($urpm, $state, $l, %options, find_packages_to_remove => 1); } else { - my $db = urpm::db_open_or_die($urpm, $options{root}); + my $db = urpm::db_open_or_die($urpm, $urpm->{root}); my (@m, @notfound); if (!$options{matches}) { @@ -76,7 +76,7 @@ if ($< && !$test) { #- rurpme checks if ($restricted) { - urpm::error_restricted($urpm) if $options{root} || $options{usedistrib} || $noscripts || $parallel; + urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $noscripts || $parallel; } unless ($test) { @@ -87,7 +87,7 @@ unless ($test) { my $_urpmi_lock = urpm::lock::urpmi_db($urpm); urpm::media::configure($urpm, synthesis => ($parallel ? 'none' : ''), - root => $options{root}, + root => $urpm->{root}, parallel => $parallel, probe_with => $options{probe_with}, usedistrib => $options{usedistrib}, @@ -117,7 +117,6 @@ my @toremove = urpm::select::find_packages_to_remove($urpm, #- Warning : the following message is parsed in urpm::parallel_* $urpm->{error}(N("removing package %s will break your system", $_)); } 0 }, - root => $options{root}, ) or $urpm->{fatal}(0, N("Nothing to remove")); my $list = urpm::select::translate_why_removed($urpm, $state, @toremove); @@ -229,7 +229,7 @@ if ($restricted) { #- force some options foreach (qw(keep verify-rpm)) { $urpm->{options}{$_} = 1 } #- forbid some other options - urpm::error_restricted($urpm) if $options{root} || $options{usedistrib} || $force || $env || $parallel || $synthesis || $auto_update; + urpm::error_restricted($urpm) if $urpm->{root} || $options{usedistrib} || $force || $env || $parallel || $synthesis || $auto_update; foreach (qw(allow-nodeps allow-force curl-options rsync-options wget-options prozilla-options noscripts)) { urpm::error_restricted($urpm) if $urpm->{options}{$_}; } @@ -265,7 +265,7 @@ if ($env) { } } -unless ($bug || $install_src || $env || $urpm->{options}{'allow-force'} || $options{root}) { +unless ($bug || $install_src || $env || $urpm->{options}{'allow-force'} || $urpm->{root}) { require urpm::sys; urpm::sys::check_fs_writable() or $urpm->{fatal}(1, N("Error: %s appears to be mounted read-only. Use --allow-force to force operation.", $urpm::sys::mountpoint)); @@ -333,7 +333,7 @@ if (exists $urpm->{options}{'priority-upgrade'} && $urpm->{options}{'priority-up require urpm::sys; urpm::sys::fix_fd_leak(); # also, clean up rpm db log files, because rpm might have been upgraded - unlink glob('/var/lib/rpm/__db.*') unless $options{root}; + unlink glob('/var/lib/rpm/__db.*') unless $urpm->{root}; } my $urpmi_lock = !$env && !$options{nolock} && urpm::lock::urpmi_db($urpm); @@ -346,7 +346,6 @@ my %config_hash = ( media => $media, nocheck_access => $env || $< != 0, parallel => $parallel, - root => $options{root}, searchmedia => $searchmedia, cmdline_skiplist => $options{skip}, sortmedia => $sortmedia, @@ -356,7 +355,7 @@ my %config_hash = ( probe_with => $options{probe_with}, ); -$options{root} and $urpm->{options}{'priority-upgrade'} = ''; +$urpm->{root} and $urpm->{options}{'priority-upgrade'} = ''; if ($auto_update && !$bug && !$env) { #- For translators : there are several media here $urpm->{log}(N("Updating media...\n")); @@ -381,7 +380,7 @@ urpm::media::configure($urpm, %config_hash); if ($bug) { require urpm::bug_report; - urpm::bug_report::rpmdb_to_synthesis($urpm, "$bug/rpmdb.cz", $options{root}); + urpm::bug_report::rpmdb_to_synthesis($urpm, "$bug/rpmdb.cz", $urpm->{root}); } #- get back activated default values of boolean options. @@ -513,7 +512,7 @@ if (@ask_unselect) { my @ask_remove = $urpm->{options}{'allow-force'} ? @{[]} : urpm::select::removed_packages($urpm, $state); if (@ask_remove) { { - my $db = urpm::db_open_or_die($urpm, $options{root}); + my $db = urpm::db_open_or_die($urpm, $urpm->{root}); urpm::select::find_removed_from_basesystem($urpm, $db, $state, sub { my $urpm = shift @_; foreach (@_) { @@ -681,7 +680,7 @@ foreach my $set (@{$state->{transaction} || []}) { #- install source package only (whatever the user is root or not, but use rpm for that). if ($install_src) { if (my @l = grep { /\.src\.rpm$/ } values %transaction_sources_install, values %transaction_sources) { - system("rpm", "-i$rpm_opt", @l, ($options{root} ? ("--root", $options{root}) : @{[]})); + system("rpm", "-i$rpm_opt", @l, ($urpm->{root} ? ("--root", $urpm->{root}) : @{[]})); #- Warning : the following message is parsed in urpm::parallel_* if ($?) { print N("Installation failed"), "\n"; @@ -68,6 +68,8 @@ usage: ") . N(" --parallel - distributed urpmi across machines of alias. ") . N(" --use-distrib - configure urpmi on the fly from a distrib tree. This permit to querying a distro. +") . N(" --probe-synthesis - use synthesis file. +") . N(" --probe-hdlist - use hdlist file. ") . N(" --wget - use wget to retrieve distant files. ") . N(" --curl - use curl to retrieve distant files. ") . N(" --prozilla - use prozilla to retrieve distant files. @@ -151,8 +153,8 @@ urpm::media::configure($urpm, sortmedia => $urpm::args::options{sortmedia}, synthesis => $urpm::args::options{synthesis}, update => $urpm::args::options{update}, - root => $urpm::args::options{root}, parallel => $urpm::args::options{parallel}, + probe_with => $urpm::args::options{probe_with}, usedistrib => $urpm::args::options{usedistrib}, cmdline_skiplist => $urpm::args::options{skip}, ); @@ -334,9 +336,7 @@ if ($urpm::args::options{list_aliases}) { $pkg && $pkg->header_filename } @selected)) { my %h = map { $_ => 1 } @headers; @headers = keys %h; - my $hdlist_path = $medium->{virtual} - ? urpm::media::hdlist_or_synthesis_for_virtual_medium($medium) - : urpm::media::statedir_hdlist($urpm, $medium); + my $hdlist_path = urpm::media::any_hdlist($urpm, $medium); if (-s $hdlist_path) { require MDV::Packdrakeng; my $packer = MDV::Packdrakeng->open(archive => $hdlist_path, quiet => 1); |