diff options
author | Francois Pons <fpons@mandriva.com> | 2002-06-13 16:20:54 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-06-13 16:20:54 +0000 |
commit | 9fa4c82881e1ceabfdde4592a69839a3e59ca0fd (patch) | |
tree | 480e0b3a0cb54ffe8dc4a1f698aedbbdf0be9a59 | |
parent | e91b06f9eaa672d4e06b05256b05c235c1ee6012 (diff) | |
download | urpmi-9fa4c82881e1ceabfdde4592a69839a3e59ca0fd.tar urpmi-9fa4c82881e1ceabfdde4592a69839a3e59ca0fd.tar.gz urpmi-9fa4c82881e1ceabfdde4592a69839a3e59ca0fd.tar.bz2 urpmi-9fa4c82881e1ceabfdde4592a69839a3e59ca0fd.tar.xz urpmi-9fa4c82881e1ceabfdde4592a69839a3e59ca0fd.zip |
3.5-2mdk
-rwxr-xr-x | urpmi | 53 | ||||
-rw-r--r-- | urpmi.spec | 5 |
2 files changed, 45 insertions, 13 deletions
@@ -41,6 +41,7 @@ my $noclean = 0; my $verbose = 0; my $root = ''; my $bug = ''; +my $env = ''; my $log = ''; my $uid; @@ -73,6 +74,7 @@ usage: ") . _(" --wget - use wget to retrieve distant files. ") . _(" --curl - use curl to retrieve distant files. ") . _(" --bug - output a bug report in directory indicated by next arg. +") . _(" --env - use specific environment (typically a bug report). ") . _(" --X - use X interface. ") . _(" --best-output - choose best interface according to the environment: X or text mode. @@ -105,6 +107,7 @@ for (@ARGV) { /^--wget$/ and do { $sync = \&urpm::sync_wget; next }; /^--curl$/ and do { $sync = \&urpm::sync_curl; next }; /^--bug$/ and do { push @nextargv, \$bug; next }; + /^--env$/ and do { push @nextargv, \$env; next }; /^--X$/ and do { $X = 1; next }; /^--WID=(.*)$/ and do { $WID = $1; next }; /^--WID$/ and do { push @nextargv, \$WID; next }; @@ -175,15 +178,26 @@ if ($bug) { $log = "$bug/urpmi.log"; } -if ($uid > 0) { - #- only src files are installable using urpmi. - @names || @files and $urpm->{fatal}(1, _("Only superuser is allowed to install packages")); - - #- allow installation. - @rpms_install = @src_files; +if ($env) { + print STDERR "using specific environment on $env\n"; + $log = "$env/urpmi_env.log"; + unlink $log; + #- setting new environment. + $urpm->{config} = "$env/urpmi.cfg"; + $urpm->{skiplist} = "$env/skip.list"; + $urpm->{instlist} = "$env/inst.list"; + $urpm->{statedir} = $env; } else { - #- allow log if not defined. - $log ||= "/var/log/urpmi.log"; + if ($uid > 0) { + #- only src files are installable using urpmi. + @names || @files and $urpm->{fatal}(1, _("Only superuser is allowed to install packages")); + + #- allow installation. + @rpms_install = @src_files; + } else { + #- allow log if not defined. + $log ||= "/var/log/urpmi.log"; + } } if ($log) { @@ -229,7 +243,7 @@ unless ($bug) { } $verbose or $urpm->{log} = sub {}; -$urpm->configure(nocheck_access => $uid > 0, +$urpm->configure(nocheck_access => $env || $uid > 0, media => $media, update => $update, ); @@ -292,7 +306,16 @@ sub ask_choice { #- open/close of database should be moved here, in order to allow testing #- some bogus case and check for integrity. { - my $db = URPM::DB::open($root); + my $db; + + #- take care of specific environment. + if ($env) { + $db = new URPM; + $db->parse_synthesis("$env/rpmdb.cz"); + } else { + $db = URPM::DB::open($root); + } + my $sig_handler = sub { undef $db; exit 3 }; local $SIG{INT} = $sig_handler; local $SIG{QUIT} = $sig_handler; @@ -320,7 +343,7 @@ my @to_install; #- check if there is at least one package to install that #- has not been given by the user. -my $ask_user = $auto_select; +my $ask_user = $env || $auto_select; my $sum = 0; my @root_only; @@ -328,13 +351,19 @@ foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$sta $ask_user ||= $pkg->flag_required; my $fullname = $pkg->fullname; - if ($uid > 0 && $pkg->arch ne 'src') { + if (!$env && $uid > 0 && $pkg->arch ne 'src') { push @root_only, $fullname; } elsif ($uid > 0 || $pkg->arch ne 'src') { $sum += $pkg->size; push @to_install, $fullname; } } +if ($env) { + my $msg = _("To satisfy dependencies, the following packages are going to be installed (%d MB)", toMb($sum)); + my $p = join "\n", @to_install; + print STDERR "$msg:\n$p\n"; + exit 0; #- exit now for specific environment. +} if (@root_only) { print STDERR _("You need to be root to install the following dependencies:\n%s\n", join ' ', @root_only); exit 1; @@ -2,7 +2,7 @@ Name: urpmi Version: 3.5 -Release: 1mdk +Release: 2mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -144,6 +144,9 @@ fi %changelog +* Thu Jun 13 2002 François Pons <fpons@mandrakesoft.com> 3.5-2mdk +- added --env option to urpmi to replay bug report. + * Thu Jun 13 2002 François Pons <fpons@mandrakesoft.com> 3.5-1mdk - use perl-URPM >= 0.04-2mdk for new require resolution algorithms. |