summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtools/closurepkgs66
1 files changed, 28 insertions, 38 deletions
diff --git a/tools/closurepkgs b/tools/closurepkgs
index d9e63af8e..e7a1907b9 100755
--- a/tools/closurepkgs
+++ b/tools/closurepkgs
@@ -1,31 +1,11 @@
#!/usr/bin/perl
+use rpmtools;
+
sub chop_version($) {
($_[0] =~ /(.*)-[^-]+-[^-]+/)[0] || $_[0];
}
-sub read_depslist {
- my ($file) = @_;
- my $depslist = { 'ordered' => [], 'packages' => {} };
- my $id = 0;
-
- local *F;
- open F, $file or die "closurepkgs: unable to open ordered dependencies list file $file\n";
- foreach (<F>) {
- my ($name, $size, @deps) = split;
- push @{$depslist->{ordered}}, { id => $id++, name => $name, size => $size, deps => \@deps };
- }
- close F;
-
- foreach (@{$depslist->{ordered}}) {
- $depslist->{packages}{chop_version($_->{name})} = $_;
- }
-
- print STDERR "closurepkgs: read " . scalar(@{$depslist->{ordered}}) . " package dependancies\n";
-
- $depslist;
-}
-
sub read_compsslist {
my ($file) = @_;
my %compsslist;
@@ -42,9 +22,17 @@ sub read_compsslist {
}
sub main {
- my ($depslist_file, $compsslist_file, $lang) = @_;
- my $depslist = read_depslist($depslist_file);
- my $compsslist = read_compsslist($compsslist_file);
+ my ($dir, $lang) = @_;
+
+ #- compute depslist on line directly.
+ my $params = new rpmtools;
+ foreach (glob("$dir/*.cz*")) { $params->read_hdlists($_) }
+ $params->keep_only_cleaned_provides_files();
+ foreach (glob("$dir/*.cz*")) { $params->read_hdlists($_) }
+ $params->compute_depslist();
+ $params->write_depslist(\*STDERR);
+
+ my $compsslist = read_compsslist("$dir/compssList");
#- DO NOT FORGET TO UPDATE HERE ACCORDING TO gi/perl-install/install_any.pm
my @pkgs = qw(XFree86 XFree86-glide-module Device3Dfx Glide_V3-DRI Glide_V5 Mesa
@@ -58,7 +46,7 @@ sub main {
my %closure;
foreach (@pkgs) {
$closure{$_} = 1;
- map { $closure{chop_version($_->{name})} = 1 } map { $depslist->{ordered}[$_] } map { split /\|/ } @{$depslist->{packages}{$_}{deps}};
+ map { $closure{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{$_}{deps};
}
#- only if dependancy is ok.
$closure{$_} = 1 foreach qw(xpp kups kisdn);
@@ -66,31 +54,31 @@ sub main {
#- closure the list of package to always install for oem. (level >= 50)...
my %install;
my @force_install;
- if ($depslist->{packages}{"locales-$lang"}) {
- foreach (keys %{$depslist->{packages}}) {
- push @force_install, $_ if grep { $_ == $depslist->{packages}{"locales-$lang"}{id} } @{$depslist->{packages}{$_}{deps}};
+ if ($params->{info}{"locales-$lang"}) {
+ foreach (keys %{$params->{info}}) {
+ push @force_install, $_ if grep { $_ == $params->{info}{"locales-$lang"}{id} } split ' ', $params->{info}{$_}{deps};
}
}
push @force_install, qw(cups cups-drivers drakprofile draksync irda-utils numlock raidtools reiserfs-utils
Mesa Mesa-demos alsa alsa-utils);
foreach (qw(
Aurora xawtv kwintv xscreensaver-gl Mesa-demos xmms-mesa bzflag csmash gltron spacecup chromium tuxracer
- ), @force_install, grep { $compsslist->{$_} >= 50 } keys %{$depslist->{packages}}) {
+ ), @force_install, grep { $compsslist->{$_} >= 50 } keys %{$params->{info}}) {
$install{$_} = 1;
- map { $install{chop_version($_->{name})} = 1 } map { $depslist->{ordered}[$_] } map { split /\|/ } @{$depslist->{packages}{$_}{deps}};
+ map { $install{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{$_}{deps};
}
#- remove base packages, which have to be installed, according to basesystem.
delete $closure{'basesystem'};
$install{'basesystem'} = 1;
map { delete $closure{chop_version($_->{name})};
- $install{chop_version($_->{name})} = 1 } map { $depslist->{ordered}[$_] } map { split /\|/ } @{$depslist->{packages}{'basesystem'}{deps}};
+ $install{chop_version($_->{name})} = 1 } map { $params->{depslist}[$_] } map { split /\|/ } split ' ', $params->{info}{'basesystem'}{deps};
#- special packages that are to be move to closure always ...
foreach (qw(kernel-smp kernel-linus kernel-secure hackkernel-smp hackkernel-linus hackkernel-secure
Aurora xawtv kwintv xscreensaver-gl xmms-mesa bzflag csmash gltron spacecup chromium tuxracer
)) {
- $depslist->{packages}{$_} or next;
+ $params->{info}{$_} or next;
$closure{$_} = 1;
delete $install{$_};
}
@@ -98,14 +86,16 @@ sub main {
#- dump out the list of package according to the 2 lists defined above.
my $total_install = 0;
my $total_closure = 0;
- foreach (@{$depslist->{ordered}}) {
+ foreach (@{$params->{depslist}}) {
my $tiny_name = chop_version($_->{name});
if (exists $install{$tiny_name}) {
- $total_install += $depslist->{packages}{$tiny_name}{size};
- print "I:", $depslist->{packages}{$tiny_name}{name}, "\n";
+ my $p = $params->{info}{$tiny_name};
+ $total_install += $p->{size};
+ print "I:$p->{name}-$p->{version}-$p->{release}\n";
} elsif (exists $closure{$tiny_name}) {
- $total_closure += $depslist->{packages}{$tiny_name}{size};
- print "C:", $depslist->{packages}{$tiny_name}{name}, "\n";
+ my $p = $params->{info}{$tiny_name};
+ $total_closure += $p->{size};
+ print "C:$p->{name}-$p->{version}-$p->{release}\n";
}
}
print "\n\ntotal_install=$total_install\n";