closure: fix package ordering

We cannot use perl 'keys', because that return a list with random
order. Some packages use preinst scripts (run at unpack time), so
package order is important.
This commit is contained in:
Dietmar Maurer 2017-06-26 09:58:53 +02:00
parent 61888137e1
commit a922f88f4a

18
DAB.pm
View File

@ -1008,18 +1008,19 @@ sub closure {
# first, record provided packages
__record_provides ($pkginfo, $closure, $list, 1);
my $pkgs = {};
my $pkghash = {};
my $pkglist = [];
# then resolve dependencies
foreach my $pname (@$list) {
__closure_single ($pkginfo, $closure, $pkgs, $pname, $self->{excl});
__closure_single ($pkginfo, $closure, $pkghash, $pkglist, $pname, $self->{excl});
}
return [ keys %$pkgs ];
return $pkglist;
}
sub __closure_single {
my ($pkginfo, $closure, $pkgs, $pname, $excl) = @_;
my ($pkginfo, $closure, $pkghash, $pkglist, $pname, $excl) = @_;
$pname =~ s/^\s+//;
$pname =~ s/\s+$//;
@ -1037,7 +1038,10 @@ sub __closure_single {
$url || die "$pname: no url for package '$pname'";
$pkgs->{$pname} = 1;
if (!$pkghash->{$pname}) {
unshift @$pkglist, $pname;
$pkghash->{$pname} = 1;
}
__record_provides ($pkginfo, $closure, [$pname]) if $info->{provides};
@ -1073,7 +1077,7 @@ sub __closure_single {
#printf (STDERR "$pname: $p --> $found\n");
__closure_single ($pkginfo, $closure, $pkgs, $found, $excl);
__closure_single ($pkginfo, $closure, $pkghash, $pkglist, $found, $excl);
}
}
@ -1151,7 +1155,7 @@ sub bootstrap {
push @$important, "postfix";
}
foreach my $p (keys %$pkginfo) {
foreach my $p (sort keys %$pkginfo) {
next if grep { $p eq $_ } @{$self->{excl}};
my $pri = $pkginfo->{$p}->{priority};
next if !$pri;