From b29d424115dbfada0597376a1a3868a78da3f8e3 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 4 Dec 2012 19:56:31 +0100 Subject: [PATCH] Get deb-closure.pl to work with the latest dpkg --- pkgs/build-support/vm/deb/deb-closure.pl | 17 +++++++++-------- pkgs/build-support/vm/default.nix | 4 ++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pkgs/build-support/vm/deb/deb-closure.pl b/pkgs/build-support/vm/deb/deb-closure.pl index 1d41f89218bd..887077037e28 100644 --- a/pkgs/build-support/vm/deb/deb-closure.pl +++ b/pkgs/build-support/vm/deb/deb-closure.pl @@ -1,5 +1,5 @@ use strict; -use Dpkg::Cdata; +use Dpkg::Control; use Dpkg::Deps; use File::Basename; @@ -7,6 +7,7 @@ my $packagesFile = shift @ARGV; my $urlPrefix = shift @ARGV; my @toplevelPkgs = @ARGV; + my %packages; @@ -14,10 +15,10 @@ my %packages; open PACKAGES, "<$packagesFile" or die; while (1) { - my $cdata = parsecdata(\*PACKAGES, $packagesFile); - last unless defined $cdata; - #print $cdata->{Package}, "\n"; + my $cdata = Dpkg::Control->new(type => CTRL_INFO_PKG); + last if not $cdata->parse(\*PACKAGES, $packagesFile); die unless defined $cdata->{Package}; + #print STDERR $cdata->{Package}, "\n"; $packages{$cdata->{Package}} = $cdata; } @@ -50,7 +51,7 @@ my %provides; foreach my $cdata (values %packages) { 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) { #die "conflicting provide: $name\n" if defined $provides{$name}; #warn "provide by $cdata->{Package} conflicts with package with the same name: $name\n"; @@ -83,7 +84,7 @@ sub closePackage { $donePkgs{$pkgName} = 1; 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}; } } @@ -92,14 +93,14 @@ sub closePackage { if (defined $cdata->{Depends}) { 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; push @depNames, getDeps($deps); } if (defined $cdata->{'Pre-Depends'}) { 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; push @depNames, getDeps($deps); } diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix index e8de915e7889..4a543ba91fed 100644 --- a/pkgs/build-support/vm/default.nix +++ b/pkgs/build-support/vm/default.nix @@ -761,7 +761,7 @@ rec { debClosureGenerator = {name, packagesLists, urlPrefix, packages}: - runCommand "${name}.nix" {} '' + runCommand "${name}.nix" { buildInputs = [ perl dpkg ]; } '' for i in ${toString packagesLists}; do echo "adding $i..." bunzip2 < $i >> ./Packages @@ -770,7 +770,7 @@ rec { # 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 - ${perl}/bin/perl -I${dpkg} -w ${deb/deb-closure.pl} \ + perl -w ${deb/deb-closure.pl} \ ./Packages ${urlPrefix} ${toString packages} > $out '';