summaryrefslogtreecommitdiffstats
path: root/urpmi
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-07 14:08:04 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-07 14:08:04 +0000
commit379179afcd2a68ff3d315357031cfbf6563dfc98 (patch)
treefb4004b86c405e64721b82a1a5eb32f44a6df306 /urpmi
parentddc3808f569c456ec97c80892f8d38fff285ee58 (diff)
downloadurpmi-379179afcd2a68ff3d315357031cfbf6563dfc98.tar
urpmi-379179afcd2a68ff3d315357031cfbf6563dfc98.tar.gz
urpmi-379179afcd2a68ff3d315357031cfbf6563dfc98.tar.bz2
urpmi-379179afcd2a68ff3d315357031cfbf6563dfc98.tar.xz
urpmi-379179afcd2a68ff3d315357031cfbf6563dfc98.zip
- urpmi
o enhance "columns" display of packages to install (esp. fit on 80 columns)
Diffstat (limited to 'urpmi')
-rwxr-xr-xurpmi32
1 files changed, 10 insertions, 22 deletions
diff --git a/urpmi b/urpmi
index 03e96541..52a321bd 100755
--- a/urpmi
+++ b/urpmi
@@ -25,7 +25,7 @@ use urpm::args;
use urpm::msg;
use urpm::media;
use urpm::select;
-use urpm::util qw(max untaint difference2 member partition);
+use urpm::util qw(untaint difference2 member partition);
use urpm::main_loop;
#- contains informations to parse installed system.
@@ -569,47 +569,35 @@ have to be removed for others to be upgraded:\n%s\n", $list);
}
}
-#- package to install as a array of strings.
-my @to_install;
-
#- check if there is at least one package to install that
#- has not been given by the user.
my $ask_user = $env || $search_result eq 'substring';
my @root_only;
-foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$state->{selected}}]) {
+my @to_install = @{$urpm->{depslist}}[sort { $a <=> $b } keys %{$state->{selected}}]; # sorted by medium for format_selected_packages
+foreach my $pkg (@to_install) {
#- reflect change in flag usage, now requested is set whatever a package is selected or not,
#- but required is always set (so a required but not requested is a pure dependency).
$ask_user ||= !$pkg->flag_requested || $auto_select || $parallel;
if (!$env && $install_src && $pkg->arch ne 'src') {
push @root_only, $pkg->fullname;
- } elsif ($install_src || $pkg->arch ne 'src') {
- my $medium = URPM::pkg2media($urpm->{media}, $pkg);
- my @name_and_evr = ($pkg->fullname, $medium && $medium->{name});
- $name_and_evr[2] =~ s/mdv(.*)/mdv/ if length($name_and_evr[2]) > 15;
- if ($state->{selected}{$pkg->id}{suggested}) {
- push @name_and_evr, N("(suggested)");
- }
- push @to_install, \@name_and_evr;
}
}
-$urpm->{nb_install} = @to_install;
if (@root_only && !$env) {
- print N("You need to be root to install the following dependencies:\n%s\n", join ' ', @root_only);
+ print N("You need to be root to install the following dependencies:\n%s\n", join(' ', sort @root_only));
exit 1;
-} elsif (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env) {
+}
+$urpm->{nb_install} = @to_install;
+if (!$urpm->{options}{auto} && $ask_user && $urpm->{nb_install} || $env) {
my $msg = $urpm->{nb_install} == 1 ? N("To satisfy dependencies, the following package is going to be installed:")
: N("To satisfy dependencies, the following packages are going to be installed:");
if ($test) {
$msg = "$msg\n" . N("(test only, installation will not be actually done)");
}
- my $size = $urpm->selected_size($state);
- my @field_sizes = map { my $i = $_; max(map { length($_->[$i]) } @to_install) } 0 .. 5;
- my @field_nice_sizes = (40, 10, 14, 6, 15, 15);
- { my $i; foreach (@field_sizes) { $_++ if $_ <= $field_nice_sizes[$i++] } }
- my $format = join(' ', map { '%-' . $_ . 's' } @field_sizes);
- my @to_install_formatted = map { sprintf(" $format", @$_) } @to_install;
+ my $size = $urpm->selected_size($state);
+
+ my @to_install_formatted = urpm::msg::format_line_selected_packages($urpm, $state, \@to_install);
my $msg2 = $size >= 0 ?
N("%s of additional disk space will be used.", formatXiB($size)) :
N("%s of disk space will be freed.", formatXiB(-$size));