summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>1999-09-03 12:32:53 +0000
committerPascal Rigaux <pixel@mandriva.com>1999-09-03 12:32:53 +0000
commit874f08a1316d73d6f09f0ca2df235dac495a387b (patch)
tree04b7d9263f63437f879dede82bfdd29ae6db4414 /perl-install
parent3635161f628098787b71456e735c9ad87578930f (diff)
downloaddrakx-backup-do-not-use-874f08a1316d73d6f09f0ca2df235dac495a387b.tar
drakx-backup-do-not-use-874f08a1316d73d6f09f0ca2df235dac495a387b.tar.gz
drakx-backup-do-not-use-874f08a1316d73d6f09f0ca2df235dac495a387b.tar.bz2
drakx-backup-do-not-use-874f08a1316d73d6f09f0ca2df235dac495a387b.tar.xz
drakx-backup-do-not-use-874f08a1316d73d6f09f0ca2df235dac495a387b.zip
no_comment
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile2
-rw-r--r--perl-install/install_any.pm6
-rw-r--r--perl-install/modules.pm4
-rw-r--r--perl-install/pkgs.pm76
4 files changed, 59 insertions, 29 deletions
diff --git a/perl-install/Makefile b/perl-install/Makefile
index eb0a1d48f..dde389a4f 100644
--- a/perl-install/Makefile
+++ b/perl-install/Makefile
@@ -68,7 +68,7 @@ gendepslist: %: %.cc
$(CXX) -I/usr/include/rpm $(CFLAGS) $< -lrpm -ldb1 -lz -o $@
depslist: gendepslist
- ./gendepslist $(ROOTDEST)/Mandrake/base/depslist /tmp/rhimage/Mandrake/RPMS/*.rpm
+ ./gendepslist $(ROOTDEST)/Mandrake/base/depslist $(ROOTDEST)/Mandrake/RPMS/*.rpm
install_pms: all
for i in `perl -ne 's/sub (\w+?)_? {.*/$$1/ and print' commands.pm`; do ln -sf commands $(DEST)/usr/bin/$$i; done
diff --git a/perl-install/install_any.pm b/perl-install/install_any.pm
index 06779960b..ff36b8e5c 100644
--- a/perl-install/install_any.pm
+++ b/perl-install/install_any.pm
@@ -90,12 +90,14 @@ sub setPackages {
pkgs::getDeps($o->{packages});
- $o->{compss} = pkgs::readCompss($o->{packages});
+ $o->{compss} = pkgs::readCompss ($o->{packages});
+ $o->{compssList} = pkgs::readCompssList($o->{packages});
push @{$o->{base}}, "kernel-smp" if smp::detect();
$o->{packages}{$_}{base} = 1 foreach @{$o->{base}};
- pkgs::setCompssSelected($o->{compss}, $o->{packages}, $o->{installClass}, $o->{lang});
+ pkgs::setShowFromCompss($o->{compss}, $o->{installClass}, $o->{lang});
+ pkgs::setSelectedFromCompssList($o->{compssList}, $o->{packages}, $size, $o->{installClass}, $o->{lang});
}
sub addToBeDone(&$) {
diff --git a/perl-install/modules.pm b/perl-install/modules.pm
index 59947da67..7e5b1cac2 100644
--- a/perl-install/modules.pm
+++ b/perl-install/modules.pm
@@ -225,14 +225,14 @@ sub text2driver($) {
}
-sub load($;$) {
+sub load($;$@) {
my ($name, $type, @options) = @_;
$conf{$name}{loaded} and return;
$type ||= $drivers{$name}{type};
- load($_, 'prereq', $minor) foreach @{$deps{$name}};
+ load($_, 'prereq') foreach @{$deps{$name}};
load_raw($name, @options);
}
diff --git a/perl-install/pkgs.pm b/perl-install/pkgs.pm
index 54091896e..c3ccabe05 100644
--- a/perl-install/pkgs.pm
+++ b/perl-install/pkgs.pm
@@ -24,10 +24,7 @@ sub Package {
sub select($$;$) {
my ($packages, $p, $base) = @_;
$p->{selected} = -1; # selected by user
- unless ($p->{deps}) {
- 1;
- }
- my @l = @{$p->{deps}};
+ my @l = @{$p->{deps} || die "missing deps file"};
while (@l) {
my $n = shift @l;
$n =~ /|/ and $n = first(split '\|', $n); #TODO better handling of choice
@@ -147,51 +144,82 @@ sub getDeps($) {
sub readCompss($) {
my ($packages) = @_;
- my (@compss, $ps, $category);
+ my (@compss, $ps);
my $f = install_any::getFile("compss") or die "can't find compss";
foreach (<$f>) {
/^\s*$/ || /^#/ and next;
s/#.*//;
- my ($options, $name) = /^(\S*)\s+(.*?)\s*$/ or die "bad line in compss: $_";
+ my ($options, $name) = /^(\S*)\s+(.*?)\s*$/ or log::l("bad line in compss: $_"), next;
if ($name =~ /(.*):$/) {
- push @compss, $category if $category;
$ps = [];
- $category = { options => $options, name => $1, packages => $ps };
+ push @compss, { options => $options, name => $1, packages => $ps };
} else {
my $p = $packages->{$name} or log::l("unknown package $name (in compss)"), next;
$p->{options} = $options;
push @$ps, $p;
}
}
- [ @compss, $category ];
+ \@compss;
}
-sub setCompssSelected($$$$) {
- my ($compss, $packages, $install_class, $lang) = @_;
+sub readCompssList($) {
+ my ($packages) = @_;
+ my ($list, %compssList);
- my $l = substr($install_class, 0, 1);
- my $L = uc $l;
+ my $f = install_any::getFile("compssList") or die "can't find compssList";
+ foreach (<$f>) {
+ /^\s*$/ || /^#/ and next;
- my $verif_lang = sub {
- local $SIG{__DIE__} = 'none';
- $_[0] =~ /-([^-]*)$/;
- $1 eq $lang || eval { lang::text2lang($1) eq $lang } && !$@;
- };
+ if (/(.*):$/) {
+ $compssList{$1} = $list = [];
+ } else {
+ my $p = $packages->{$_} or log::l("unknown package $_ (in compss)"), next;
+ push @$list, $p;
+ }
+ }
+ \%compssList;
+}
+
+sub verif_lang($$) {
+ local $_ = shift;
+ my $lang = shift;
+ local $SIG{__DIE__} = 'none';
+ /-([^-]*)$/ && ($1 eq $lang || eval { lang::text2lang($1) eq $lang } && !$@);
+}
+
+sub setShowFromCompss($$$) {
+ my ($compss, $install_class, $lang) = @_;
+
+ my $l = substr($install_class, 0, 1);
foreach my $c (@$compss) {
$c->{show} = bool($c->{options} =~ /($l|\*)/);
- my $nb = 0;
foreach my $p (@{$c->{packages}}) {
local $_ = $p->{options};
- $p->{show} = ! (/$L/);
+ $p->{show} = /$l|\*/ && (!/l/ || verif_lang($p->{name}, $lang));
+ }
+ }
+}
+
+sub setSelectedFromCompssList($$$$$) {
+ my ($compssList, $packages, $size, $install_class, $lang) = @_;
+
+ my $l = $compssList->{$install_class} or log::l("no $_ entry in compssList"), return;
+ foreach (@$l) {
+ local $_ = $_->{options};
+ /l/ && !verif_lang($_->{name}, $lang) and next;
- &select($packages, $p, $p->{base}), $nb++
- if /$l|\*/ && (!/l/ || &$verif_lang($p->{name})) ||
- $p->{base};
+ &select($packages, $_);
+
+ my $nb = 0; foreach (values %$packages) {
+ $nb += $_->{size} if $_->{selected};
+ }
+ if ($nb > $size) {
+ unselect($packages, $_);
+ last;
}
- $c->{selected} = $nb;
}
}