From 45219a97f50e6c6328d14da239c0fea7192e4007 Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Tue, 13 Jan 2004 15:57:28 +0000 Subject: add --use-distrib code --- urpm.pm | 9 ++++++++- urpme | 4 +++- urpmi | 3 +++ urpmq | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/urpm.pm b/urpm.pm index 8c3e9dca..decfd7d4 100644 --- a/urpm.pm +++ b/urpm.pm @@ -787,7 +787,12 @@ sub configure { $urpm->{options}{'split-length'} = 0; } } else { - $urpm->read_config(%options); + if ($options{usedistrib}) { + $urpm->{media} = []; + $urpm->add_distrib_media("Virtual", $options{usedistrib}, %options, 'virtual' => 1); + } else { + $urpm->read_config(%options); + } if ($options{media}) { delete $_->{modified} foreach @{$urpm->{media} || []}; $urpm->select_media(split ',', $options{media}); @@ -918,6 +923,7 @@ sub add_medium { my ($urpm, $name, $url, $with_hdlist, %options) = @_; #- make sure configuration has been read. + # (Olivier Thauvin) Yes but Why ??? Is this a workaround ? $urpm->{media} or $urpm->read_config(); #- if a medium with that name has already been found @@ -986,6 +992,7 @@ sub add_distrib_media { my ($hdlists_file); #- make sure configuration has been read. + # (Olivier Thauvin): Is this a workaround ? $urpm->{media} or $urpm->read_config(); #- try to copy/retrive Mandrake/basehdlists file. diff --git a/urpme b/urpme index 70e03b24..1d6efb9c 100644 --- a/urpme +++ b/urpme @@ -25,7 +25,7 @@ use URPM; use URPM::Resolve; use urpm; -my (@nextargv, $root, $test, $parallel, $auto, $matches, $verbose, $maymatch, @l); +my (@nextargv, $root, $test, $parallel, $auto, $matches, $verbose, $maymatch, $usedistrib, @l); my $askok = N("Is this OK?"); # Translator: Add here the keys which might be pressed in the "No"-case. my $noexpr = N("Nn"); @@ -57,6 +57,7 @@ while (defined($_ = shift @ARGV)) { /^--(no-)?test$/ and do { $test = !$1; next }; /^--force$/ and do { $force = 1; next }; /^--root$/ and do { push @nextargv, \$root; next }; + /^--use-distrib$/ and do { push @nextargv, \$usedistrib; next }; /^--parallel$/ and do { push @nextargv, \$parallel; next }; /^-(.*)$/ and do { foreach (split //, $1) { /[\?h]/ and do { usage; next }; @@ -77,6 +78,7 @@ $verbose or $urpm->{log} = sub {}; $parallel and $urpm->configure(synthesis => ($parallel and 'none'), root => $root, parallel => $parallel, + usedistrib => $usedistrib, ); #- examine packages... diff --git a/urpmi b/urpmi index 98ea8d1c..d496c2fa 100755 --- a/urpmi +++ b/urpmi @@ -50,6 +50,7 @@ my $noclean = 0; my $verbose = 0; my $skip = ''; my $root = ''; +my $usedistrib = undef; my $bug = ''; my $env = ''; my $log = ''; @@ -204,6 +205,7 @@ while (defined($_ = shift @argv)) { /^--comment$/ and do { push @nextargv, undef; next }; /^--skip$/ and do { push @nextargv, \$skip; next }; /^--root$/ and do { push @nextargv, \$root; next }; + /^--use-distrib$/ and do { push @nextargv, \$usedistrib; next }; /^--exclude-?path$/ and do { $urpm->{options}{excludepath} = undef; push @nextargv, \$urpm->{options}{excludepath}; next }; /^--exclude-?docs$/ and do { $urpm->{options}{excludedocs} = 1; next }; /^-(.*)$/ and do { foreach (split //, $1) { @@ -334,6 +336,7 @@ $urpm->configure(nocheck_access => $env || $uid > 0, root => $root, bug => $bug, parallel => $parallel, + usedistrib => $usedistrib, ); #- get back activated default values of boolean options. foreach (qw(post-clean verify-rpm)) { diff --git a/urpmq b/urpmq index a2a870fd..394c66a9 100755 --- a/urpmq +++ b/urpmq @@ -113,6 +113,7 @@ while (defined($_ = shift @ARGV)) { /^--force$/ and do { $query->{force} = 1; next }; /^--skip$/ and do { push @nextargv, \$query->{skip}; next }; /^--root$/ and do { push @nextargv, \$query->{root}; next }; + /^--use-distrib$/ and do { push @nextargv, \$query->{usedistrib}; next }; /^--parallel$/ and do { push @nextargv, \$query->{parallel}; next }; /^--wget$/ and do { $urpm->{sync} = sub { my $options = shift @_; if (ref($options)) { $options->{prefer} = 'wget' } @@ -192,6 +193,7 @@ $urpm->configure(nocheck_access => 1, skip => $query->{skip}, root => $query->{root}, parallel => $query->{parallel}, + usedistrib => $query->{usedistrib}, ); my $state = {}; -- cgit v1.2.1