mirror of
https://git.proxmox.com/git/dab
synced 2025-10-04 19:13:09 +00:00
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:
parent
61888137e1
commit
a922f88f4a
22
DAB.pm
22
DAB.pm
@ -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+$//;
|
||||
@ -1036,8 +1037,11 @@ sub __closure_single {
|
||||
my $url = $info->{url};
|
||||
|
||||
$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;
|
||||
@ -1284,7 +1288,7 @@ sub bootstrap {
|
||||
|
||||
$self->ve_dpkg ('install', 'mawk');
|
||||
$self->ve_dpkg ('install', 'debconf');
|
||||
|
||||
|
||||
# unpack required packages
|
||||
foreach my $p (@$required) {
|
||||
$self->ve_dpkg ('unpack', $p);
|
||||
|
Loading…
Reference in New Issue
Block a user