Bug#1019693: dpkg-buildpackage: fails with unknown sequence when including missing file

2022-09-17 Thread Niels Thykier

Control: tags -1 wontfix

Guillem Jover:

On Tue, 2022-09-13 at 15:50:07 +0200, Fab Stz wrote:

Package: dpkg-dev
Version: 1.29.9
Severity: normal
File: /usr/bin/dpkg-buildpackage



This may be a regression because I don't have this problem with 1.20.12 which
is on bullseye.


When in debian/rules, I include a file that doesn't exists, dpkg will try to
run

dh /path/to/missing/file 

which leads to this failure & error:

dh: error: unknown sequence/path/to/missing/file (choose from: binary binary-
arch binary-indep build build-arch build-indep clean install install-arch
install-indep)


for example, in your debian/rules, at the top, put

-include /path/to/missing/file

then, run dpkg-buildpackage



Hi,

This seems to be a feature interaction between make and the `dh $@` 
style.  GNU Make appears to be attempting to create the missing file for 
you and I guess it ends up hitting the `catch all %:` rule calling dh 
(which I assume you have in your rules file).


This happens *before* dh is called so debhelper cannot do anything about 
it.  Your only option is to look at having make or your `debian/rules` 
file handle this case.  Options might include:


 * Ensure there is a (.PHONY) target for the missing file to ensure Make
   does not pick up the default rule.
 * Add Make conditionals around the include so the include is skipped
   when the file is not present.

I tested a simple `.PHONY: foo` + `-include foo` and that seemed to work 
locally. But you will have to figure out what works for you.


Either way, this is two products independently working as designed 
ending up in a bad feature interaction that cannot be solved - only 
worked around (for as long as we rely on make and debhelper in Debian 
packaging). Therefore closing this as "wontfix" (read: "cantfix").


Thanks,
~Niels



Bug#1019693: dpkg-buildpackage: fails with unknown sequence when including missing file

2022-09-13 Thread Guillem Jover
Control: reassign -1 debhelper

On Tue, 2022-09-13 at 15:50:07 +0200, Fab Stz wrote:
> Package: dpkg-dev
> Version: 1.29.9
> Severity: normal
> File: /usr/bin/dpkg-buildpackage

> This may be a regression because I don't have this problem with 1.20.12 which 
> is on bullseye.
> 
> 
> When in debian/rules, I include a file that doesn't exists, dpkg will try to
> run
> 
> dh /path/to/missing/file 
> 
> which leads to this failure & error:
> 
> dh: error: unknown sequence/path/to/missing/file (choose from: binary binary-
> arch binary-indep build build-arch build-indep clean install install-arch
> install-indep)
> 
> 
> for example, in your debian/rules, at the top, put
> 
> -include /path/to/missing/file
> 
> then, run dpkg-buildpackage

This seems like an issue with debhelper, if at all. As
dpkg-buildpackage does not call dh directly, debian/rules does.
Reassigning.

Thanks,
Guillem