The following commit has been merged in the master branch:
commit 52b5b22d7503424583d90411c32e4795ec84f68d
Author: James McCoy <[email protected]>
Date:   Sat Mar 24 15:23:50 2012 -0400

    mk-build-deps: Fix handling of debian/control files.
    
    Closes: #665496
    Signed-off-by: James McCoy <[email protected]>

diff --git a/debian/changelog b/debian/changelog
index 3ff1b89..8d49f07 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+devscripts (2.11.6) UNRELEASED; urgency=low
+
+  * mk-build-deps: Fix handling of debian/control files.  (Closes: #665496)
+
+ -- James McCoy <[email protected]>  Sat, 24 Mar 2012 15:24:59 -0400
+
 devscripts (2.11.5) unstable; urgency=low
 
   [ Adam D. Barratt ]
diff --git a/scripts/mk-build-deps.pl b/scripts/mk-build-deps.pl
index 73e1b34..f9f736b 100755
--- a/scripts/mk-build-deps.pl
+++ b/scripts/mk-build-deps.pl
@@ -227,10 +227,13 @@ while ($control = shift) {
 
     my (@pkgInfo, @versions);
     until (eof $fh) {
-       my $ctrl = Dpkg::Control->new(type => CTRL_INFO_SRC);
+       my $ctrl = Dpkg::Control->new(allow_pgp => 1, type => CTRL_UNKNOWN);
        unless ($ctrl->parse($fh, $control)) {
            die "$progname: Unable to find package name in '$control'\n";
        }
+       unless (exists $ctrl->{$name}) {
+           next;
+       }
        my $args = '';
        my $arch = 'all';
        my ($build_deps, $build_dep, $build_indep);
@@ -249,7 +252,9 @@ while ($control = shift) {
 
        die "$progname: Unable to find build-deps for $ctrl->{$name}\n" unless 
$build_deps;
 
-       push(@versions, $ctrl->{Version});
+       if (exists $ctrl->{Version}) {
+           push(@versions, $ctrl->{Version});
+       }
 
        # Only build a package with both B-D and B-D-I in Depends if the
        # B-D/B-D-I specific packages weren't requested
@@ -276,12 +281,18 @@ while ($control = shift) {
                   version => $ctrl->{Version} });
        }
     }
-    # Only use the newest version
-    @versions = map { $_->[0] }
-               sort { $b->[1] <=> $a->[1] }
-               map { [$_, Dpkg::Version->new($_)] } @versions;
-    push(@packages, map { build_equiv($_) }
-                   grep { $versions[0] eq $_->{version} } @pkgInfo);
+    # Only use the newest version.  We'll only have this if processing showsrc
+    # output or a dsc file.
+    if (@versions) {
+       @versions = map { $_->[0] }
+                   sort { $b->[1] <=> $a->[1] }
+                   map { [$_, Dpkg::Version->new($_)] } @versions;
+       push(@packages, map { build_equiv($_) }
+                       grep { $versions[0] eq $_->{version} } @pkgInfo);
+    }
+    else {
+       push(@packages, build_equiv($pkgInfo[0]));
+    }
 }
 
 if ($opt_install) {

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to