Get deb-closure.pl to work with the latest dpkg

This commit is contained in:
Eelco Dolstra 2012-12-04 19:56:31 +01:00
parent 6751fac418
commit b29d424115
2 changed files with 11 additions and 10 deletions

View File

@ -1,5 +1,5 @@
use strict; use strict;
use Dpkg::Cdata; use Dpkg::Control;
use Dpkg::Deps; use Dpkg::Deps;
use File::Basename; use File::Basename;
@ -7,6 +7,7 @@ my $packagesFile = shift @ARGV;
my $urlPrefix = shift @ARGV; my $urlPrefix = shift @ARGV;
my @toplevelPkgs = @ARGV; my @toplevelPkgs = @ARGV;
my %packages; my %packages;
@ -14,10 +15,10 @@ my %packages;
open PACKAGES, "<$packagesFile" or die; open PACKAGES, "<$packagesFile" or die;
while (1) { while (1) {
my $cdata = parsecdata(\*PACKAGES, $packagesFile); my $cdata = Dpkg::Control->new(type => CTRL_INFO_PKG);
last unless defined $cdata; last if not $cdata->parse(\*PACKAGES, $packagesFile);
#print $cdata->{Package}, "\n";
die unless defined $cdata->{Package}; die unless defined $cdata->{Package};
#print STDERR $cdata->{Package}, "\n";
$packages{$cdata->{Package}} = $cdata; $packages{$cdata->{Package}} = $cdata;
} }
@ -50,7 +51,7 @@ my %provides;
foreach my $cdata (values %packages) { foreach my $cdata (values %packages) {
next unless defined $cdata->{Provides}; next unless defined $cdata->{Provides};
my @provides = getDeps(Dpkg::Deps::parse($cdata->{Provides})); my @provides = getDeps(Dpkg::Deps::deps_parse($cdata->{Provides}));
foreach my $name (@provides) { foreach my $name (@provides) {
#die "conflicting provide: $name\n" if defined $provides{$name}; #die "conflicting provide: $name\n" if defined $provides{$name};
#warn "provide by $cdata->{Package} conflicts with package with the same name: $name\n"; #warn "provide by $cdata->{Package} conflicts with package with the same name: $name\n";
@ -83,7 +84,7 @@ sub closePackage {
$donePkgs{$pkgName} = 1; $donePkgs{$pkgName} = 1;
if (defined $cdata->{Provides}) { if (defined $cdata->{Provides}) {
foreach my $name (getDeps(Dpkg::Deps::parse($cdata->{Provides}))) { foreach my $name (getDeps(Dpkg::Deps::deps_parse($cdata->{Provides}))) {
$provides{$name} = $cdata->{Package}; $provides{$name} = $cdata->{Package};
} }
} }
@ -92,14 +93,14 @@ sub closePackage {
if (defined $cdata->{Depends}) { if (defined $cdata->{Depends}) {
print STDERR " $pkgName: $cdata->{Depends}\n"; print STDERR " $pkgName: $cdata->{Depends}\n";
my $deps = Dpkg::Deps::parse($cdata->{Depends}); my $deps = Dpkg::Deps::deps_parse($cdata->{Depends});
die unless defined $deps; die unless defined $deps;
push @depNames, getDeps($deps); push @depNames, getDeps($deps);
} }
if (defined $cdata->{'Pre-Depends'}) { if (defined $cdata->{'Pre-Depends'}) {
print STDERR " $pkgName: $cdata->{'Pre-Depends'}\n"; print STDERR " $pkgName: $cdata->{'Pre-Depends'}\n";
my $deps = Dpkg::Deps::parse($cdata->{'Pre-Depends'}); my $deps = Dpkg::Deps::deps_parse($cdata->{'Pre-Depends'});
die unless defined $deps; die unless defined $deps;
push @depNames, getDeps($deps); push @depNames, getDeps($deps);
} }

View File

@ -761,7 +761,7 @@ rec {
debClosureGenerator = debClosureGenerator =
{name, packagesLists, urlPrefix, packages}: {name, packagesLists, urlPrefix, packages}:
runCommand "${name}.nix" {} '' runCommand "${name}.nix" { buildInputs = [ perl dpkg ]; } ''
for i in ${toString packagesLists}; do for i in ${toString packagesLists}; do
echo "adding $i..." echo "adding $i..."
bunzip2 < $i >> ./Packages bunzip2 < $i >> ./Packages
@ -770,7 +770,7 @@ rec {
# Work around this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452279 # Work around this bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=452279
sed -i ./Packages -e s/x86_64-linux-gnu/x86-64-linux-gnu/g sed -i ./Packages -e s/x86_64-linux-gnu/x86-64-linux-gnu/g
${perl}/bin/perl -I${dpkg} -w ${deb/deb-closure.pl} \ perl -w ${deb/deb-closure.pl} \
./Packages ${urlPrefix} ${toString packages} > $out ./Packages ${urlPrefix} ${toString packages} > $out
''; '';