3
0
Fork 0
forked from mirrors/nixpkgs

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 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);
}

View file

@ -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
'';