From 21ba800aefa91802836150371f77d459ababcc69 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 13 Mar 2001 13:04:18 +0000 Subject: compss is deprecated. use compssUsers for the tree --- perl-install/install2.pm | 2 +- perl-install/install_any.pm | 1 - perl-install/install_steps.pm | 2 +- perl-install/install_steps_gtk.pm | 33 ++++++++++++++----------------- perl-install/install_steps_interactive.pm | 6 +++--- perl-install/pkgs.pm | 26 +----------------------- 6 files changed, 21 insertions(+), 49 deletions(-) diff --git a/perl-install/install2.pm b/perl-install/install2.pm index b2fb734db..5daeca68e 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -237,7 +237,7 @@ sub choosePackages { #- always setPackages as it may have to copy hdlist files and depslist file. $o->setPackages; - $o->choosePackages($o->{packages}, $o->{compss}, $o->{compssUsers}, $_[1] == 1); + $o->choosePackages($o->{packages}, $o->{compssUsers}, $_[1] == 1); log::l("compssUsersChoice's: ", join(" ", grep { $o->{compssUsersChoice}{$_} } keys %{$o->{compssUsersChoice}})); #- check pre-condition where base backage has to be selected. diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index 8be1c7c6e..084e59bd3 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -313,7 +313,6 @@ sub setPackages { #- must be done after selecting base packages (to save memory) pkgs::getProvides($o->{packages}); - $o->{compss} = pkgs::readCompss($o->{prefix}, $o->{packages}); #- must be done after getProvides pkgs::read_rpmsrate($o->{packages}, getFile("Mandrake/base/rpmsrate")); ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers($o->{meta_class}); diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index 06137b3cb..a7323789b 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -253,7 +253,7 @@ sub selectPackagesToUpgrade { } sub choosePackages { - my ($o, $packages, $compss, $compssUsers, $first_time) = @_; + my ($o, $packages, $compssUsers, $first_time) = @_; #- now for upgrade, package that must be upgraded are #- selected first, after is used the same scheme as install. diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index b9f43a150..f72bd7a42 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -249,7 +249,7 @@ a percentage of %d%% will install as many packages as possible.", $percentage, $ $w->main and $val + 1; #- add a single byte (hack?) to make selection of 0 bytes ok. } sub choosePackagesTree { - my ($o, $packages, $compss) = @_; + my ($o, $packages) = @_; $o->set_help('choosePackagesTree'); my ($curr, $parent, $info_widget, $w_size, $go, $idle, $flat, $auto_deps); @@ -292,8 +292,8 @@ sub choosePackagesTree { my $add_parent; $add_parent = sub { $_[0] or return undef; if (my $w = $wtree{$_[0]}) { return $w } - my $s; foreach (split '/', $_[0]) { - my $s2 = $s ? "$s/$_" : $_; + my $s; foreach (split '\|', $_[0]) { + my $s2 = $s ? "$s|$_" : $_; $wtree{$s2} ||= do { my $n = $tree->insert_node($s ? $add_parent->($s) : undef, undef, [$_, '', ''], 5, (undef) x 4, 0, 0); $n; @@ -319,26 +319,23 @@ sub choosePackagesTree { $tree->freeze; while (1) { $tree->remove_node($tree->node_nth(0) || last) } - my ($root, $leaf); if ($flat = $_[0]) { $add_node->($_, undef) foreach sort grep { my $pkg = pkgs::packageByName($packages, $_); pkgs::packageMedium($pkg)->{selected} } keys %{$packages->{names}}; } else { - my (@others, $old_root); - foreach (sort @$compss) { - ($root, $leaf) = m|(.*)/(.+)|o or ($root, $leaf) = ('', $_); - if ($root ne $old_root) { - $add_node->($_, $old_root . '/' . _("Other")) foreach @others; - @others = (); - $old_root = $root - } - my $pkg = pkgs::packageByName($packages, $leaf); - pkgs::packageMedium($pkg)->{selected} or next; - if (pkgs::packageRate($pkg) < 4) { - push @others, $leaf; - } else { - $add_node->($leaf, $root); + foreach (@{$o->{compssUsersSorted}}) { + my $root = $o->{compssUsers}{$_}{path} . '|' . $_; + my (%fl, @firstchoice, @others); + $fl{$_} = 1 foreach @{$o->{compssUsers}{$_}{flags}}; + foreach my $p (values %{$packages->{names}}) { + my ($rate, @flags) = pkgs::packageRateRFlags($p); + next if !($rate && !grep { !grep { /^!(.*)/ ? !$fl{$1} : $fl{$_} } split('\|\|') } @flags); + $rate >= 3 ? + push(@firstchoice, pkgs::packageName($p)) : + push(@others, pkgs::packageName($p)); } + $add_node->($_, $root ) foreach sort @firstchoice; + $add_node->($_, $root . '|' . _("Other")) foreach sort @others; } } $tree->thaw; diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index 24a0bd235..3e47ec3c6 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -429,7 +429,7 @@ sub selectPackagesToUpgrade { } #------------------------------------------------------------------------------ sub choosePackages { - my ($o, $packages, $compss, $compssUsers, $first_time) = @_; + my ($o, $packages, $compssUsers, $first_time) = @_; #- this is done at the very beginning to take into account #- selection of CD by user if using a cdrom. @@ -492,7 +492,7 @@ sub choosePackages { ($o->{packages_}{ind}) = pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $min_mark, $size2install); - $o->choosePackagesTree($packages, $compss) if $individual; + $o->choosePackagesTree($packages) if $individual; } sub chooseSizeToInstall { @@ -500,7 +500,7 @@ sub chooseSizeToInstall { min($def, $availableC * 0.7); } sub choosePackagesTree { - my ($o, $packages, $compss) = @_; + my ($o, $packages) = @_; $o->ask_many_from_list('', _("Choose the packages you want to install"), { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index ddae5735b..f245a98d5 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -359,7 +359,7 @@ sub psUpdateHdlistsDeps { #- this is necessary for urpmi. install_any::getAndSaveFile("Mandrake/base/$_", "$prefix/var/lib/urpmi/$_") - foreach qw(depslist.ordered provides compss rpmsrate); + foreach qw(depslist.ordered provides rpmsrate); } sub psUsingHdlists { @@ -572,30 +572,6 @@ sub getProvides($) { } } -sub readCompss { - my ($prefix, $packages) = @_; - my ($p, @compss); - - #- this is necessary for urpmi. - install_any::getAndSaveFile('Mandrake/base/compss', "$prefix/var/lib/urpmi/compss"); - - local *F; open F, "$prefix/var/lib/urpmi/compss" or die "can't find compss"; - local $_; - while () { - /^\s*$/ || /^#/ and next; - s/#.*//; - - if (/^(\S.*)/) { - $p = $1; - } else { - /(\S+)/; - $packages->{names}{$1} or log::l("unknown package $1 in compss"), next; - push @compss, "$p/$1"; - } - } - \@compss; -} - sub read_rpmsrate { my ($packages, $f) = @_; my $line_nb = 0; -- cgit v1.2.1