diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2004-08-13 08:08:55 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2004-08-13 08:08:55 +0000 |
commit | 29c6e4f818ae3b2a7717125105268bc8df154ff8 (patch) | |
tree | aed17983db265b3760bfbe366f0f1312284f2d01 | |
parent | f2793bd866028a0692e721e3c1442076c46a3379 (diff) | |
download | drakx-29c6e4f818ae3b2a7717125105268bc8df154ff8.tar drakx-29c6e4f818ae3b2a7717125105268bc8df154ff8.tar.gz drakx-29c6e4f818ae3b2a7717125105268bc8df154ff8.tar.bz2 drakx-29c6e4f818ae3b2a7717125105268bc8df154ff8.tar.xz drakx-29c6e4f818ae3b2a7717125105268bc8df154ff8.zip |
- don't use compssUsers anymore, use compssUsers.pl
- code to display compssUsers choices is now in compssUsers.pl
- {compssUsers} is now a list instead of a hash, and so drop {compssUsersSorted}
- rename {compssUsersChoice} to {rpmsrate_flags_chosen} (better name)
- i18n_compssUsers is no more needed, add share/compssUsers.pl* to ALLPMS
-rw-r--r-- | perl-install/Makefile | 2 | ||||
-rw-r--r-- | perl-install/Makefile.config | 2 | ||||
-rw-r--r-- | perl-install/install2.pm | 2 | ||||
-rw-r--r-- | perl-install/install_any.pm | 59 | ||||
-rw-r--r-- | perl-install/install_steps.pm | 6 | ||||
-rw-r--r-- | perl-install/install_steps_gtk.pm | 61 | ||||
-rw-r--r-- | perl-install/install_steps_interactive.pm | 59 | ||||
-rw-r--r-- | perl-install/pkgs.pm | 54 | ||||
-rw-r--r-- | perl-install/share/compssUsers | 89 | ||||
-rw-r--r-- | perl-install/share/compssUsers.pl | 136 | ||||
-rw-r--r-- | perl-install/share/po/Makefile | 1 | ||||
-rw-r--r-- | perl-install/share/po/i18n_compssUsers | 42 |
12 files changed, 226 insertions, 287 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile index 6795b9fec..ae743fe85 100644 --- a/perl-install/Makefile +++ b/perl-install/Makefile @@ -173,7 +173,7 @@ endif -cd share ; cp -f *.png $(DEST)/usr/share -cd pixmaps ; cp -af *.png *.xpm $(DEST)/usr/share ; rm -f $(DEST)/usr/share/wiz_* cp `perl -I. -Mlang -e 'lang::png_lang_files()'` $(DEST)/usr/share/langs - cd share ; cp compssUsers compssUsers.* rpmsrate $(MEDIA_INFO_DEST) + cd share ; cp compssUsers.pl* rpmsrate $(MEDIA_INFO_DEST) clean-rpmsrate $(MEDIA_INFO_DEST)/rpmsrate $(MAIN_RPMS_DIR) diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config index cccee450a..450bc7896 100644 --- a/perl-install/Makefile.config +++ b/perl-install/Makefile.config @@ -7,7 +7,7 @@ PMS = *.pm $(PMS_DIRS:%=%/*.pm) commands install2 STANDALONEPMS_ = XFdrake adduserdrake diskdrake drakTermServ drakautoinst drakauth drakbackup drakboot drakbug drakbug_report drakclock drakconnect drakedm drakfirewall drakfloppy drakfont drakgw drakhelp drakperm drakproxy drakpxe drakroam draksec draksound draksplash drakupdate_fstab drakups drakvpn drakxservices drakxtv fileshareset harddrake2 keyboarddrake localedrake logdrake lsnetdrake mousedrake net_applet net_monitor printerdrake scannerdrake service_harddrake service_harddrake_confirm bootloader-config STANDALONEPMS = $(STANDALONEPMS_:%=standalone/%) -ALLPMS = $(PMS) $(STANDALONEPMS) share/advertising/*.pl +ALLPMS = $(PMS) $(STANDALONEPMS) share/advertising/*.pl share/compssUsers.pl* REP4PMS = /usr/bin/perl-install ROOTDEST = /export DEST = $(STAGE2_LIVE) diff --git a/perl-install/install2.pm b/perl-install/install2.pm index 4463aaff2..db2a700ea 100644 --- a/perl-install/install2.pm +++ b/perl-install/install2.pm @@ -221,7 +221,7 @@ sub choosePackages { #- always setPackages as it may have to copy hdlist files and synthesis files. installStepsCall($o, $auto, 'setPackages', $o->{isUpgrade} && $ent_number == 1); installStepsCall($o, $auto, 'choosePackages', $o->{packages}, $o->{compssUsers}, $ent_number == 1); - log::l("compssUsersChoice's: ", join(" ", grep { $o->{compssUsersChoice}{$_} } keys %{$o->{compssUsersChoice}})); + log::l("rpmsrate_flags_chosen's: ", join(" ", map_each { if_($::b, $::a) } %{$o->{rpmsrate_flags_chosen}})); #- check pre-condition where base backage has to be selected. pkgs::packageByName($o->{packages}, 'basesystem')->flag_available or die "basesystem package not selected"; diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm index a60cdb477..c889e3620 100644 --- a/perl-install/install_any.pm +++ b/perl-install/install_any.pm @@ -490,12 +490,12 @@ sub setPackages { $o->{packages}, getFile($suppl_method eq 'cdrom' ? "/mnt/cdrom/media/media_info/rpmsrate" : "media/media_info/rpmsrate") ); - ($o->{compssUsers}, $o->{compssUsersSorted}) = pkgs::readCompssUsers( + ($o->{compssUsers}, $o->{gtk_display_compssUsers}) = pkgs::readCompssUsers( $o->{meta_class}, - $suppl_method eq 'cdrom' ? "/mnt/cdrom/media/media_info/compssUsers" : "", + ($suppl_method eq 'cdrom' ? '/mnt/cdrom/' : '') . 'media/media_info/compssUsers.pl' ); - #- preselect default_packages and compssUsersChoices. + #- preselect default_packages and compssUsers selected. setDefaultPackages($o); pkgs::selectPackage($o->{packages}, pkgs::packageByName($o->{packages}, $_) || next) foreach @{$o->{default_packages}}; @@ -529,7 +529,7 @@ sub setDefaultPackages { my ($o, $b_clean) = @_; if ($b_clean) { - delete $o->{$_} foreach qw(default_packages compssUsersChoice); #- clean modified variables. + delete $o->{default_packages}; #- clean modified variables. } push @{$o->{default_packages}}, "brltty" if cat_("/proc/cmdline") =~ /brltty=/; @@ -543,35 +543,31 @@ sub setDefaultPackages { #- if no cleaning needed, populate by default, clean is used for second or more call to this function. unless ($b_clean) { - if ($::auto_install && ($o->{compssUsersChoice} || {})->{ALL}) { - $o->{compssUsersChoice}{$_} = 1 foreach map { @{$o->{compssUsers}{$_}{flags}} } @{$o->{compssUsersSorted}}; + if ($::auto_install && ($o->{rpmsrate_flags_chosen} || {})->{ALL}) { + $o->{rpmsrate_flags_chosen}{$_} = 1 foreach map { @{$_->{flags}} } @{$o->{compssUsers}}; } - if (!$o->{compssUsersChoice} && !$o->{isUpgrade}) { + if (!$o->{rpmsrate_flags_chosen} && !$o->{isUpgrade}) { #- use default selection seen in compssUsers directly. - foreach (keys %{$o->{compssUsers}}) { - $o->{compssUsers}{$_}{selected} or next; - log::l("looking for default selection on $_"); - member($o->{meta_class} || 'default', @{$o->{compssUsers}{$_}{selected}}) || - member('all', @{$o->{compssUsers}{$_}{selected}}) or next; - log::l(" doing selection on $_"); - $o->{compssUsersChoice}{$_} = 1 foreach @{$o->{compssUsers}{$_}{flags}}; + foreach (@{$o->{compssUsers}}) { + $_->{selected} = $_->{default_selected} or next; + $o->{rpmsrate_flags_chosen}{$_} = 1 foreach @{$_->{flags}}; } } } - $o->{compssUsersChoice}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia'); - $o->{compssUsersChoice}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall(); - $o->{compssUsersChoice}{SYSTEM} = 1; - $o->{compssUsersChoice}{DOCS} = !$o->{excludedocs}; - $o->{compssUsersChoice}{UTF8} = $o->{locale}{utf8}; - $o->{compssUsersChoice}{BURNER} = 1 if detect_devices::burners(); - $o->{compssUsersChoice}{DVD} = 1 if detect_devices::dvdroms(); - $o->{compssUsersChoice}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface"); - $o->{compssUsersChoice}{PCMCIA} = 1 if detect_devices::hasPCMCIA(); - $o->{compssUsersChoice}{HIGH_SECURITY} = 1 if $o->{security} > 3; - $o->{compssUsersChoice}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64|x86_64/; - $o->{compssUsersChoice}{SMP} = 1 if detect_devices::hasSMP(); - $o->{compssUsersChoice}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}}; - $o->{compssUsersChoice}{'3D'} = 1 if + $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach grep { modules::probe_category("multimedia/$_") } modules::sub_categories('multimedia'); + $o->{rpmsrate_flags_chosen}{uc($_)} = 1 foreach map { $_->{driver} =~ /Flag:(.*)/ } detect_devices::probeall(); + $o->{rpmsrate_flags_chosen}{SYSTEM} = 1; + $o->{rpmsrate_flags_chosen}{DOCS} = !$o->{excludedocs}; + $o->{rpmsrate_flags_chosen}{UTF8} = $o->{locale}{utf8}; + $o->{rpmsrate_flags_chosen}{BURNER} = 1 if detect_devices::burners(); + $o->{rpmsrate_flags_chosen}{DVD} = 1 if detect_devices::dvdroms(); + $o->{rpmsrate_flags_chosen}{USB} = 1 if $o->{modules_conf}->get_probeall("usb-interface"); + $o->{rpmsrate_flags_chosen}{PCMCIA} = 1 if detect_devices::hasPCMCIA(); + $o->{rpmsrate_flags_chosen}{HIGH_SECURITY} = 1 if $o->{security} > 3; + $o->{rpmsrate_flags_chosen}{BIGMEM} = 1 if !$::oem && availableRamMB() > 800 && arch() !~ /ia64|x86_64/; + $o->{rpmsrate_flags_chosen}{SMP} = 1 if detect_devices::hasSMP(); + $o->{rpmsrate_flags_chosen}{CDCOM} = 1 if any { $_->{descr} =~ /commercial/i } values %{$o->{packages}{mediums}}; + $o->{rpmsrate_flags_chosen}{'3D'} = 1 if detect_devices::matching_desc('Matrox.* G[245][05]0') || detect_devices::matching_desc('Rage X[CL]') || detect_devices::matching_desc('3D Rage (?:LT|Pro)') || @@ -592,9 +588,9 @@ sub setDefaultPackages { unshift @{$o->{default_packages}}, uniq(map { $_->name } @locale_pkgs); foreach (lang::langsLANGUAGE($o->{locale}{langs})) { - $o->{compssUsersChoice}{qq(LOCALES"$_")} = 1; + $o->{rpmsrate_flags_chosen}{qq(LOCALES"$_")} = 1; } - $o->{compssUsersChoice}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1; + $o->{rpmsrate_flags_chosen}{'CHARSET"' . lang::l2charset($o->{locale}{lang}) . '"'} = 1; } sub unselectMostPackages { @@ -1067,6 +1063,9 @@ sub loadO { } } } + if (my $rpmsrate_flags_chosen = delete $o->{compssUsersChoice}) { + $o->{rpmsrate_flags_chosen} = $rpmsrate_flags_chosen; + } $o; } diff --git a/perl-install/install_steps.pm b/perl-install/install_steps.pm index fe54fff48..fb75f630a 100644 --- a/perl-install/install_steps.pm +++ b/perl-install/install_steps.pm @@ -310,7 +310,7 @@ sub choosePackages { #- for expert, as they may have done individual selection before. if ($first_time || !$::expert) { exists $o->{compssListLevel} - and pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $o->{compssListLevel}, $availableCorrected); + and pkgs::setSelectedFromCompssList($packages, $o->{rpmsrate_flags_chosen}, $o->{compssListLevel}, $availableCorrected); } $availableCorrected; } @@ -598,7 +598,7 @@ sub install_urpmi { $o->{method}, $o->{packages}, $o->{packages}{mediums}); - pkgs::saveCompssUsers($o->{prefix}, $o->{packages}, $o->{compssUsers}, $o->{compssUsersSorted}); + pkgs::saveCompssUsers($o->{prefix}, $o->{packages}, $o->{compssUsers}); } } @@ -689,7 +689,7 @@ sub summary { } sub summaryAfter { - my ($o) = @_; + my ($_o) = @_; } #------------------------------------------------------------------------------ diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm index dd3d838a9..f8e010941 100644 --- a/perl-install/install_steps_gtk.pm +++ b/perl-install/install_steps_gtk.pm @@ -200,7 +200,7 @@ sub selectMouse { } sub reallyChooseGroups { - my ($o, $size_to_display, $individual, $val) = @_; + my ($o, $size_to_display, $individual, $compssUsers) = @_; my $w = ugtk2->new(''); my $tips = Gtk2::Tooltips->new; @@ -208,60 +208,22 @@ sub reallyChooseGroups { my $entry = sub { my ($e) = @_; - my $text = translate($o->{compssUsers}{$e}{label}); - my $help = translate($o->{compssUsers}{$e}{descr}); + my $text = translate($e->{label}); + my $help = translate($e->{descr}); my $check = Gtk2::CheckButton->new($text); - $check->set_active($val->{$e}); + $check->set_active($e->{selected}); $check->signal_connect(clicked => sub { - $val->{$e} = $check->get_active; + $e->{selected} = $check->get_active; $w_size->set_label(&$size_to_display); }); gtkset_tip($tips, $check, $help); - #gtkpack_(Gtk2::HBox->new(0, 0), 0, gtkpng($file), 1, $check); $check; }; - my $entries_in_path = sub { - my ($path) = @_; - translate($path), map { $entry->($_) } grep { $o->{compssUsers}{$_}{path} eq $path } @{$o->{compssUsersSorted}}; - }; gtkadd($w->{window}, gtkpack_($w->create_box_with_title(N("Package Group Selection")), - 1, gtkpack_(Gtk2::VBox->new(0, 0), - 1, gtkpack_(Gtk2::HBox->new(0, 0), - $o->{meta_class} eq 'server' ? ( - 1, gtkpack(Gtk2::VBox->new(0, 0), - $entries_in_path->('Workstation'), - '', - $entries_in_path->('Server'), - ), - 1, gtkpack(Gtk2::VBox->new(0, 0), - $entries_in_path->('Graphical Environment'), - '', - $entries_in_path->('Development'), - '', - $entries_in_path->('Utilities'), - ), - ) : $o->{meta_class} eq 'desktop' ? ( - 1, gtkpack(Gtk2::VBox->new(0, 0), - $entries_in_path->('Workstation'), - ), - ) : ( - 1, gtkpack(Gtk2::VBox->new(0, 0), - $entries_in_path->('Workstation'), - '', - $entry->('Development|Development'), - $entry->('Development|Documentation'), - $entry->('Development|LSB'), - ), - 0, gtkpack(Gtk2::VBox->new(0, 0), - $entries_in_path->('Server'), - '', - $entries_in_path->('Graphical Environment'), - ), - ), - )), - 1, '', + 1, $o->{gtk_display_compssUsers}->($entry), + 1, '', 0, gtkadd(Gtk2::HBox->new(0, 0), gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => $o->interactive_help_sub_display_id('choosePackages')), $w_size, @@ -309,10 +271,9 @@ sub choosePackagesTree { $add_node->($_, undef); } } else { - foreach my $root (@{$o->{compssUsersSorted}}) { - my (%fl, @firstchoice, @others); - #$fl{$_} = $o->{compssUsersChoice}{$_} foreach @{$o->{compssUsers}{$root}{flags}}; #- FEATURE:improve choce of packages... - $fl{$_} = 1 foreach @{$o->{compssUsers}{$root}{flags}}; + foreach my $root (@{$o->{compssUsers}}) { + my (@firstchoice, @others); + my %fl = map { $_ => 1 } @{$root->{flags}}; foreach my $p (@{$packages->{depslist}}) { !$o_limit_medium || pkgs::packageMedium($packages, $p) == $o_limit_medium or next; my @flags = $p->rflags; @@ -321,7 +282,7 @@ sub choosePackagesTree { push(@firstchoice, $p->name) : push(@others, $p->name); } - my $root2 = join('|', map { translate($_) } split('\|', $root)); + my $root2 = translate($root->{path}) . '|' . translate($root->{label}); $add_node->($_, $root2) foreach sort @firstchoice; $add_node->($_, $root2 . '|' . N("Other")) foreach sort @others; } diff --git a/perl-install/install_steps_interactive.pm b/perl-install/install_steps_interactive.pm index f1ef4fbcc..ef46bda75 100644 --- a/perl-install/install_steps_interactive.pm +++ b/perl-install/install_steps_interactive.pm @@ -413,7 +413,8 @@ sub choosePackages { my $min_mark = 4; my $b = pkgs::saveSelected($packages); - my $_level = pkgs::setSelectedFromCompssList($packages, { map { $_ => 1 } map { @{$compssUsers->{$_}{flags}} } @{$o->{compssUsersSorted}} }, $min_mark, 0); + my %all_compssUsers_flags = map { $_ => 1 } map { @{$_->{flags}} } @$compssUsers; + my $_level = pkgs::setSelectedFromCompssList($packages, \%all_compssUsers_flags, $min_mark, 0); my $max_size = pkgs::selectedSize($packages) + 1; #- avoid division by zero. log::l("max size (level $min_mark) is : " . formatXiB($max_size)); pkgs::restoreSelected($b); @@ -423,7 +424,7 @@ sub choosePackages { $o->chooseGroups($packages, $compssUsers, $min_mark, \$individual, $max_size) if !$o->{isUpgrade} && !$::corporate && $o->{meta_class} ne 'desktop'; ($o->{packages_}{ind}) = - pkgs::setSelectedFromCompssList($packages, $o->{compssUsersChoice}, $min_mark, $availableC); + pkgs::setSelectedFromCompssList($packages, $o->{rpmsrate_flags_chosen}, $min_mark, $availableC); $o->choosePackagesTree($packages) or goto chooseGroups if $individual; @@ -481,7 +482,6 @@ sub chooseGroups { #- limitation of current implementation. #- use an empty state for each one (no flag update should be propagated). -#- OLD VERSION my $b = pkgs::saveSelected($packages); install_any::unselectMostPackages($o); pkgs::setSelectedFromCompssList($packages, {}, $min_level, $max_size); @@ -490,9 +490,8 @@ sub chooseGroups { pkgs::restoreSelected($b); log::l("system_size: $system_size"); - my @groups = @{$o->{compssUsersSorted}}; - my %stable_flags = grep_each { $::b } %{$o->{compssUsersChoice}}; - delete $stable_flags{$_} foreach map { @{$compssUsers->{$_}{flags}} } @groups; + my %stable_flags = grep_each { $::b } %{$o->{rpmsrate_flags_chosen}}; + delete $stable_flags{$_} foreach map { @{$_->{flags}} } @{$o->{compssUsers}}; my $compute_size = sub { my %pkgs; @@ -508,20 +507,16 @@ sub chooseGroups { next A; } } - log::l("computed size $total_size"); + log::l("computed size $total_size (flags " . join(' ', keys %flags) . ")"); log::l("chooseGroups: ", join(" ", sort keys %pkgs)); int $total_size; }; - my %val = map { - $_ => every { $o->{compssUsersChoice}{$_} } @{$compssUsers->{$_}{flags}} - } @groups; -# @groups = grep { $size{$_} = round_down($size{$_} / sqr(1024), 10) } @groups; #- don't display the empty or small one (eg: because all packages are below $min_level) my ($size, $unselect_all); my $available_size = install_any::getAvailableSpace($o) / sqr(1024); my $size_to_display = sub { - my $lsize = $system_size + $compute_size->(map { @{$compssUsers->{$_}{flags}} } grep { $val{$_} } @groups); + my $lsize = $system_size + $compute_size->(map { @{$_->{flags}} } grep { $_->{selected} } @$compssUsers); #- if a profile is deselected, deselect everything (easier than deselecting the profile packages) $unselect_all ||= $size > $lsize; @@ -532,49 +527,49 @@ sub chooseGroups { while (1) { if ($available_size < 140) { # too small to choose anything. Defaulting to no group chosen - $val{$_} = 0 foreach keys %val; + $_->{selected} = 0 foreach @$compssUsers; last; } - $o->reallyChooseGroups($size_to_display, $individual, \%val) or return; + $o->reallyChooseGroups($size_to_display, $individual, $compssUsers) or return; last if $::testing || pkgs::correctSize($size / sqr(1024)) < $available_size; $o->ask_warn('', N("Selected size is larger than available space")); } - $o->{compssUsersChoice}{$_} = 0 foreach map { @{$compssUsers->{$_}{flags}} } grep { !$val{$_} } keys %val; - $o->{compssUsersChoice}{$_} = 1 foreach map { @{$compssUsers->{$_}{flags}} } grep { $val{$_} } keys %val; + $o->{rpmsrate_flags_chosen}{$_} = 0 foreach map { @{$_->{flags}} } grep { !$_->{selected} } @$compssUsers; + $o->{rpmsrate_flags_chosen}{$_} = 1 foreach map { @{$_->{flags}} } grep { $_->{selected} } @$compssUsers; - log::l("compssUsersChoice: " . (!$val{$_} && "not ") . "selected [$_] as [$o->{compssUsers}{$_}{label}]") foreach keys %val; + log::l("compssUsersChoice selected: ", join(', ', map { qq("$_->{path}|$_->{label}") } grep { $_->{selected} } @$compssUsers)); #- do not try to deselect package (by default no groups are selected). $o->{isUpgrade} or $unselect_all and install_any::unselectMostPackages($o); #- if no group have been chosen, ask for using base system only, or no X, or normal. - if (!$o->{isUpgrade} && !any { $_ } values %val) { + if (!$o->{isUpgrade} && !any { $_->{selected} } @$compssUsers) { my $docs = !$o->{excludedocs}; - my $minimal = !any { $_ } values %{$o->{compssUsersChoice}}; + my $minimal = !any { $_ } values %{$o->{rpmsrate_flags_chosen}}; $o->ask_from(N("Type of install"), N("You haven't selected any group of packages. Please choose the minimal installation you want:"), [ - { val => \$o->{compssUsersChoice}{X}, type => 'bool', text => N("With X"), disabled => sub { $minimal } }, + { val => \$o->{rpmsrate_flags_chosen}{X}, type => 'bool', text => N("With X"), disabled => sub { $minimal } }, { val => \$docs, type => 'bool', text => N("With basic documentation (recommended!)"), disabled => sub { $minimal } }, { val => \$minimal, type => 'bool', text => N("Truly minimal install (especially no urpmi)") }, ], - changed => sub { $o->{compssUsersChoice}{X} = $docs = 0 if $minimal }, + changed => sub { $o->{rpmsrate_flags_chosen}{X} = $docs = 0 if $minimal }, ) or return &chooseGroups; $o->{excludedocs} = !$docs || $minimal; #- reselect according to user selection. if ($minimal) { - $o->{compssUsersChoice}{$_} = 0 foreach keys %{$o->{compssUsersChoice}}; + $o->{rpmsrate_flags_chosen}{$_} = 0 foreach keys %{$o->{rpmsrate_flags_chosen}}; } else { - my $X = $o->{compssUsersChoice}{X}; #- don't let setDefaultPackages modify this one + my $X = $o->{rpmsrate_flags_chosen}{X}; #- don't let setDefaultPackages modify this one install_any::setDefaultPackages($o, 'clean'); - $o->{compssUsersChoice}{X} = $X; + $o->{rpmsrate_flags_chosen}{X} = $X; } install_any::unselectMostPackages($o); } @@ -582,7 +577,7 @@ Please choose the minimal installation you want:"), } sub reallyChooseGroups { - my ($o, $size_to_display, $individual, $val) = @_; + my ($o, $size_to_display, $individual, $compssUsers) = @_; my $size_text = &$size_to_display; @@ -594,22 +589,22 @@ sub reallyChooseGroups { { val => \$size_text, type => 'label' }, {}, (map { my $old = $path; - $path = $o->{compssUsers}{$_}{path}; + $path = $_->{path}; if_($old ne $path, { val => translate($path) }), { - val => \$val->{$_}, + val => \$_->{selected}, type => 'bool', disabled => sub { $all }, - text => translate($o->{compssUsers}{$_}{label}), - help => translate($o->{compssUsers}{$_}{descr}), + text => translate($_->{label}), + help => translate($_->{descr}), } - } @{$o->{compssUsersSorted}}), + } @$compssUsers), if_($o->{meta_class} eq 'desktop', { text => N("All"), val => \$all, type => 'bool' }), if_($individual, { text => N("Individual package selection"), val => $individual, advanced => 1, type => 'bool' }), ]); if ($all) { - $val->{$_} = 1 foreach keys %$val; + $_->{selected} = 1 foreach @$compssUsers; } 1; } @@ -980,7 +975,7 @@ sub summary { $sound_index++; } - if (!@sound_cards && ($o->{compssUsersChoice}{GAMES} || $o->{compssUsersChoice}{AUDIO})) { + if (!@sound_cards && ($o->{rpmsrate_flags_chosen}{GAMES} || $o->{rpmsrate_flags_chosen}{AUDIO})) { #- if no sound card are detected AND the user selected things needing a sound card, #- propose a special case for ISA cards push @l, { diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm index ca009f364..2948f062b 100644 --- a/perl-install/pkgs.pm +++ b/perl-install/pkgs.pm @@ -587,44 +587,22 @@ sub read_rpmsrate { sub readCompssUsers { my ($meta_class, $file) = @_; - $file ||= 'media/media_info/compssUsers'; my $f = $meta_class && install_any::getFile("$file.$meta_class") || install_any::getFile($file) or die "can't find $file"; - readCompssUsers_raw($f); -} - -sub readCompssUsers_raw { - my ($f) = @_; - my (%compssUsers, @sorted, $l); - - local $_; - while (<$f>) { - /^\s*$/ || /^#/ and next; - s/#.*//; - - if (/^(\S.*)/) { - my $verbatim = $_; - my ($icon, $descr, $path, $selected); - /^(.*?)\s*\[path=(.*?)\](.*)/ and $_ = "$1$3", $path = $2; - /^(.*?)\s*\[icon=(.*?)\](.*)/ and $_ = "$1$3", $icon = $2; - /^(.*?)\s*\[descr=(.*?)\](.*)/ and $_ = "$1$3", $descr = $2; - /^(.*?)\s*\[selected=(.*?)\](.*)/ and $_ = "$1$3", $selected = $2; - $compssUsers{"$path|$_"} = { label => $_, verbatim => $verbatim, - path => $path, icons => $icon, descr => $descr, - if_(defined $selected, selected => [ split /[\s,]+/, $selected ]), flags => $l = [] }; - push @sorted, "$path|$_"; - } elsif (/^\s+(.*?)\s*$/) { - push @$l, $1; - } + my ($compssUsers, $gtk_display_compssUsers) = eval join('', <$f>); + if ($@) { + log::l("ERROR: bad $file: $@"); + } else { + log::l("compssUsers.pl got: ", join(', ', map { qq("$_->{path}|$_->{label}") } @$compssUsers)); } - \%compssUsers, \@sorted; + ($compssUsers, $gtk_display_compssUsers); } + sub saveCompssUsers { - my ($prefix, $packages, $compssUsers, $sorted) = @_; + my ($prefix, $packages, $compssUsers) = @_; my $flat; - foreach (@$sorted) { - my @fl = @{$compssUsers->{$_}{flags}}; - my %fl; $fl{$_} = 1 foreach @fl; - $flat .= $compssUsers->{$_}{verbatim}; + foreach (@$compssUsers) { + my %fl = map { $_ => 1 } @{$_->{flags}}; + $flat .= "$_->{label} [icon=xxx] [path=$_->{path}]\n"; foreach my $p (@{$packages->{depslist}}) { my @flags = $p->rflags; if ($p->rate && any { any { !/^!/ && $fl{$_} } split('\|\|') } @flags) { @@ -637,14 +615,14 @@ sub saveCompssUsers { } sub setSelectedFromCompssList { - my ($packages, $compssUsersChoice, $min_level, $max_size) = @_; - $compssUsersChoice->{TRUE} = 1; #- ensure TRUE is set + my ($packages, $rpmsrate_flags_chosen, $min_level, $max_size) = @_; + $rpmsrate_flags_chosen->{TRUE} = 1; #- ensure TRUE is set my $nb = selectedSize($packages); foreach my $p (sort { $b->rate <=> $a->rate } @{$packages->{depslist}}) { my @flags = $p->rflags; next if !$p->rate || $p->rate < $min_level || - any { !any { /^!(.*)/ ? !$compssUsersChoice->{$1} : $compssUsersChoice->{$_} } split('\|\|') } @flags; + any { !any { /^!(.*)/ ? !$rpmsrate_flags_chosen->{$1} : $rpmsrate_flags_chosen->{$_} } split('\|\|') } @flags; #- determine the packages that will be selected when #- selecting $p. the packages are not selected. @@ -665,7 +643,7 @@ sub setSelectedFromCompssList { last; } } - log::l("setSelectedFromCompssList: reached size ", formatXiB($nb), ", up to indice $min_level (less than ", formatXiB($max_size), ")"); + log::l("setSelectedFromCompssList: reached size ", formatXiB($nb), ", up to indice $min_level (less than ", formatXiB($max_size), ") for flags ", map_each { if_($::b, $::a) } %$rpmsrate_flags_chosen); log::l("setSelectedFromCompssList: ", join(" ", sort map { $_->name } grep { $_->flag_selected } @{$packages->{depslist}})); $min_level; } @@ -731,6 +709,8 @@ sub computeGroupSize { } my (%group, %memo, $slowpart_counter); + log::l("pkgs::computeGroupSize"); + foreach my $p (@{$packages->{depslist}}) { my @flags = $p->rflags; next if !$p->rate || $p->rate < $min_level; diff --git a/perl-install/share/compssUsers b/perl-install/share/compssUsers deleted file mode 100644 index f6171b4a3..000000000 --- a/perl-install/share/compssUsers +++ /dev/null @@ -1,89 +0,0 @@ - # --- Workstation - -Office Workstation [icon=office] [path=Workstation] [selected=all] [descr=Office programs: wordprocessors (kword, abiword), spreadsheets (kspread, gnumeric), pdf viewers, etc] - OFFICE - SPELLCHECK - PUBLISHING - PIM - ARCHIVING - PRINTER - -Game station [icon=arcade] [path=Workstation] [descr=Amusement programs: arcade, boards, strategy, etc] - GAMES - -Multimedia station [icon=multimedia] [path=Workstation] [selected=all] [descr=Sound and video playing/editing programs] - AUDIO - VIDEO - GRAPHICS - -Internet station [icon=networking] [path=Workstation] [selected=all] [descr=Set of tools to read and send mail and news (mutt, tin..) and to browse the Web] - NETWORKING_WWW - NETWORKING_MAIL - NETWORKING_NEWS - COMMUNICATIONS - NETWORKING_CHAT - NETWORKING_FILE_TRANSFER - NETWORKING_IRC - NETWORKING_INSTANT_MESSAGING - NETWORKING_DNS - -Network Computer (client) [icon=terminals] [path=Workstation] [descr=Clients for different protocols including ssh] - NETWORKING_REMOTE_ACCESS - NETWORKING_FILE - -Configuration [icon=configuration] [path=Workstation] [selected=all] [descr=Tools to ease the configuration of your computer] - CONFIG - -Console Tools [icon=terminals] [path=Workstation] [selected=all] [descr=Editors, shells, file tools, terminals] - EDITORS - TERMINALS - TEXT_TOOLS - SHELLS - FILE_TOOLS - - # --- Graphical Environment - -KDE Workstation [icon=kde] [path=Graphical Environment] [selected=all] [descr=The K Desktop Environment, the basic graphical environment with a collection of accompanying tools] - KDE - X - -GNOME Workstation [icon=gnome] [path=Graphical Environment] [descr=A graphical environment with user-friendly set of applications and desktop tools] - GNOME - X - -Other Graphical Desktops [icon=windowmanager] [path=Graphical Environment] [descr=Icewm, Window Maker, Enlightenment, Fvwm, etc] - GRAPHICAL_DESKTOP - X - - - # --- Development - -Development [icon=editors] [path=Development] [descr=C and C++ development libraries, programs and include files] - DEVELOPMENT - EDITORS - -Documentation [icon=documentation] [path=Development] [descr=Books and Howto's on Linux and Free Software] - BOOKS - -LSB [icon=documentation] [path=Development] [descr=Linux Standard Base. Third party applications support] - LSB - - # --- Server - -Web/FTP [icon=file_transfer] [path=Server] [descr=Apache, Pro-ftpd] - NETWORKING_WWW_SERVER - NETWORKING_FILE_TRANSFER_SERVER - -Mail [icon=mail] [path=Server] [descr=Postfix mail server] - NETWORKING_MAIL_SERVER - -Database [icon=archiving] [path=Server] [descr=PostgreSQL or MySQL database server] - DATABASES - DATABASES_SERVER - -Firewall/Router [icon=networking] [path=Server] [descr=Internet gateway] - NETWORKING_FIREWALLING_SERVER - -Network Computer server [icon=networking] [path=Server] [descr=NFS server, SMB server, Proxy server, ssh server] - NETWORKING_FILE_SERVER - NETWORKING_REMOTE_ACCESS_SERVER diff --git a/perl-install/share/compssUsers.pl b/perl-install/share/compssUsers.pl new file mode 100644 index 000000000..f0830ae76 --- /dev/null +++ b/perl-install/share/compssUsers.pl @@ -0,0 +1,136 @@ +package tmp::compssUsers; + +use common; +use ugtk2 qw(:helpers :wrappers :create); + +my $h = { + +N_("Server") => +[ + { label => N_("Web/FTP"), + descr => N_("Apache, Pro-ftpd"), + flags => [ qw(NETWORKING_WWW_SERVER NETWORKING_FILE_TRANSFER_SERVER) ], + }, + { label => N_("Mail"), + descr => N_("Postfix mail server"), + flags => [ qw(NETWORKING_MAIL_SERVER) ], + }, + { label => N_("Database"), + descr => N_("PostgreSQL or MySQL database server"), + flags => [ qw(DATABASES DATABASES_SERVER) ], + }, + { label => N_("Firewall/Router"), + descr => N_("Internet gateway"), + flags => [ qw(NETWORKING_FIREWALLING_SERVER) ], + }, + { label => N_("Network Computer server"), + descr => N_("NFS server, SMB server, Proxy server, ssh server"), + flags => [ qw(NETWORKING_FILE_SERVER NETWORKING_REMOTE_ACCESS_SERVER) ], + }, +], + +N_("Development") => +[ + { label => N_("Development"), + descr => N_("C and C++ development libraries, programs and include files"), + flags => [ qw(DEVELOPMENT EDITORS) ], + }, + { label => N_("Documentation"), + descr => N_("Books and Howto's on Linux and Free Software"), + flags => [ qw(BOOKS) ], + }, + { label => N_("LSB"), + descr => N_("Linux Standard Base. Third party applications support"), + flags => [ qw(LSB) ], + }, +], + +N_("Workstation") => +[ + { label => N_("Office Workstation"), + descr => N_("Office programs: wordprocessors (kword, abiword), spreadsheets (kspread, gnumeric), pdf viewers, etc"), + flags => [ qw(OFFICE SPELLCHECK PUBLISHING PIM ARCHIVING PRINTER) ], + selected => 1, + }, + { label => N_("Game station"), + descr => N_("Amusement programs: arcade, boards, strategy, etc"), + flags => [ qw(GAMES) ], + }, + { label => N_("Multimedia station"), + descr => N_("Sound and video playing/editing programs"), + flags => [ qw(AUDIO VIDEO GRAPHICS) ], + selected => 1, + }, + { label => N_("Internet station"), + descr => N_("Set of tools to read and send mail and news (mutt, tin..) and to browse the Web"), + flags => [ qw(NETWORKING_WWW NETWORKING_MAIL NETWORKING_NEWS COMMUNICATIONS NETWORKING_CHAT NETWORKING_FILE_TRANSFER NETWORKING_IRC NETWORKING_INSTANT_MESSAGING NETWORKING_DNS) ], + selected => 1, + }, + { label => N_("Network Computer (client)"), + descr => N_("Clients for different protocols including ssh"), + flags => [ qw(NETWORKING_REMOTE_ACCESS NETWORKING_FILE) ], + }, + { label => N_("Configuration"), + descr => N_("Tools to ease the configuration of your computer"), + flags => [ qw(CONFIG) ], + selected => 1, + }, + { label => N_("Console Tools"), + descr => N_("Editors, shells, file tools, terminals"), + flags => [ qw(EDITORS TERMINALS TEXT_TOOLS SHELLS FILE_TOOLS) ], + selected => 1, + }, +], + +N_("Graphical Environment") => +[ + { label => N_("KDE Workstation"), + descr => N_("The K Desktop Environment, the basic graphical environment with a collection of accompanying tools"), + flags => [ qw(KDE X) ], + selected => 1, + }, + { label => N_("GNOME Workstation"), + descr => N_("A graphical environment with user-friendly set of applications and desktop tools"), + flags => [ qw(GNOME X) ], + }, + { label => N_("Other Graphical Desktops"), + descr => N_("Icewm, Window Maker, Enlightenment, Fvwm, etc"), + flags => [ qw(GRAPHICAL_DESKTOP X) ], + }, +], +}; + +foreach my $path (keys %$h) { + foreach (@{$h->{$path}}) { + $_->{path} = $path; + $_->{uid} = join('|', $path, $_->{label}); + } +} + +my $compssUsers = [ map { @$_ } values %$h ]; + +my $gtk_display_compssUsers = sub { + my ($entry) = @_; + + my $entries_in_path = sub { + my ($path) = @_; + translate($path), map { $entry->($_) } @{$h->{$path}}; + }; + + gtkpack_(Gtk2::VBox->new(0, 0), + 1, gtkpack_(Gtk2::HBox->new(0, 0), + 1, gtkpack(Gtk2::VBox->new(0, 0), + $entries_in_path->('Workstation'), + '', + map { $entry->($_) } @{$h->{'Development'}}, + ), + 0, gtkpack(Gtk2::VBox->new(0, 0), + $entries_in_path->('Server'), + '', + $entries_in_path->('Graphical Environment'), + ), + ), + ); +}; + +$compssUsers, $gtk_display_compssUsers; diff --git a/perl-install/share/po/Makefile b/perl-install/share/po/Makefile index 92b6613af..6c4342ba3 100644 --- a/perl-install/share/po/Makefile +++ b/perl-install/share/po/Makefile @@ -37,7 +37,6 @@ $(POFILES): DrakX.pot DrakX.pot: $(PMSFILES_HERE) cd ../.. ; perl_checker -q --generate-pot share/po/$@ $(PMSFILES) - perl i18n_compssUsers 2>/dev/null >> $@ install: for l in $(LANGS); do \ diff --git a/perl-install/share/po/i18n_compssUsers b/perl-install/share/po/i18n_compssUsers deleted file mode 100644 index 9d4fc7b84..000000000 --- a/perl-install/share/po/i18n_compssUsers +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/perl - -use MDK::Common; - -sub get { - my ($meta_class) = @_; - my @l; - - local *F; - open F, "../compssUsers$meta_class" or return; #die "can't open file ../compssUsers$meta_class"; - foreach (<F>) { - /^\s*$/ || /^#/ and next; - - if (/^(\S.*)/) { - my ($icon, $path, $descr, $selected); - /^(.*?)\s*\[icon=(.*?)\](.*)/ and $_ = "$1$3", $icon = $2; - /^(.*?)\s*\[path=(.*?)\](.*)/ and $_ = "$1$3", $path = $2; - /^(.*?)\s*\[descr=(.*?)\](.*)/ and $_ = "$1$3", $descr = $2; - /^(.*?)\s*\[selected=(.*?)\](.*)/ and $_ = "$1$3", $selected = $2; - push @l, $_, $descr, $path; - } - } - close F; - - @l; -} - -my @l = map { if_(/msgid "(.*)"/, $1) } cat_("DrakX.pot"); -my %l; @l{@l} = (); - -foreach (uniq(get(''), get('.desktop'))) { - if ($_) { - s/"/\"/g; - s/\n//g; - next if exists $l{$_}; - print qq( -#: ../../share/compssUsers:999 -msgid "$_" -msgstr "" -); - } -} |