[debhelper-devel] Bug#863961: Optimisation to avoid calling Getopt makes some CDBS packages (and CDBS itself) FTBFS

Iain Lane laney at debian.org
Fri Jun 2 10:58:29 UTC 2017


Package: debhelper
Version: 10.4
Severity: serious
Tags: patch

Hi,

tl;dr this is caused by 91b064a0baea0ef37937bce56e5b080ac5a52595.

When building cdbs from sid with 10.4:

   14: build hdparm                                    FAILED (hdparm.at:18)

This package has a "common-install-prehook-arch::" rule. That rule is no
longer being called. I had a look and here's what I think is happening:

Dh_Getopt has code like this:

  if (! defined $dh{DOPACKAGES} || ! @{$dh{DOPACKAGES}}) {
    if ($dh{DOINDEP} || $dh{DOARCH}) {
      # User specified that all arch (in)dep package be
      # built, and there are none of that type.
      if (! $dh{BLOCK_NOOP_WARNINGS}) {
        warning("You asked that all arch in(dep) packages be built, but there are none of that type.");
      }
      exit(0);
    }
    push @{$dh{DOPACKAGES}},getpackages("both");
  }

to exit if there's no arch/indep packages but you've given -a/-i. This
wasn't being done in the optimised loop introduced by that commit. So we
were continuing to run commands even when there was nothing for them to
act on. Somehow(! don't know exactly why) that confused CDBS.

We can copy that short circuit into the optimised loop and then things
seem good. Here's a patch.

Cheers,

-- 
Iain Lane                                  [ iain at orangesquash.org.uk ]
Debian Developer                                   [ laney at debian.org ]
Ubuntu Developer                                   [ laney at ubuntu.com ]
-------------- next part --------------
>From ce55f9c5888dbc7e3ab2403e41fdc43675d4996b Mon Sep 17 00:00:00 2001
From: Iain Lane <laney at debian.org>
Date: Fri, 2 Jun 2017 11:40:47 +0100
Subject: [PATCH] Dh_Lib: When passing -a/-i only, and there are no arch/indep
 packages, exit

This was accidentally removed when optimising a common case.
---
 Debian/Debhelper/Dh_Lib.pm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Debian/Debhelper/Dh_Lib.pm b/Debian/Debhelper/Dh_Lib.pm
index fb5752d7..1f6d6e8c 100644
--- a/Debian/Debhelper/Dh_Lib.pm
+++ b/Debian/Debhelper/Dh_Lib.pm
@@ -73,6 +73,13 @@ sub init {
 			push(@{$dh{DOPACKAGES}}, getpackages('arch'));
 			$dh{DOARCH} = 1;
 		}
+
+		if (! @{$dh{DOPACKAGES}}) {
+			if (! $dh{BLOCK_NOOP_WARNINGS}) {
+				warning("You asked that all arch in(dep) packages be built, but there are none of that type.");
+			}
+			exit(0);
+		}
 		# Clear @ARGV so we do not hit the expensive case below
 		@ARGV = ();
 	}
-- 
2.11.0



More information about the debhelper-devel mailing list