#1059529 pybuild-autopkgtest: before-pybuild-autopkgtest target presence breaks autopkgtest

#1059529#5
Date:
2023-12-27 15:51:52 UTC
From:
To:
I have a package where I used a before-pybuild-autopkgtest in the
debian/rules file, but when I run autopkgtest, it fails with the error
message (see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1059334):

dh before-pybuild-autopkgtest --buildsystem=pybuild
dh: error: Unknown sequence before-pybuild-autopkgtest (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep)
make: *** [debian/rules:13: before-pybuild-autopkgtest] Error 25
pybuild-autopkgtest: error: /tmp/pJ8OcCInAE/run before-pybuild-autopkgtest returned exit code 2

That's clearly wrong!  It appears that that "%:" recipe overrides
every other recipe in debian/rules, and is called when "debian/rules
before-pybuild-autopkgtest" is called.  I don't know if there's any
way to override this behaviour.

Best wishes,

   Julian

#1059529#10
Date:
2024-02-29 02:51:31 UTC
From:
To:
Hi Antonio,

Any thoughts on this bug?

It seems dh doesn't like our hacks...

#1059529#15
Date:
2024-02-29 14:17:00 UTC
From:
To:
This was a bug in the python-bytecode debian/rules at that point:

  40   │ before-pybuild-autopkgtest:
  41   │ ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
  42   │ ifeq ($(DEB_BUILD_ARCH),armhf)
  43   │     patch -p1 < debian/armhf.patch
  44   │ endif
  45   │ endif

when the ifeq's don't evaluate to true (what happens everywhere but on
armhf), the body of the `before-pybuild-autopkgtest` target is empty,
and this causes make to call the default (%) target, which then calls
`dh`.

This can be reproduced in the following minimal example:
----------------8<----------------8<----------------8<----------------- $ cat Makefile ───────┬─────────────────────────────────────────────────────────────── │ File: Makefile ───────┼─────────────────────────────────────────────────────────────── 1 │ %: 2 │ @echo COMMON: $@ 3 │ 4 │ foo: 5 │ @echo FOO 6 │ 7 │ bar: ───────┴─────────────────────────────────────────────────────────────── $ make foo FOO $ make bar COMMON: bar ----------------8<----------------8<----------------8<----------------- This could have been fixed at the time by making the patching unconditional, or by patching the test itself to cause a skip on armhf.
#1059529#20
Date:
2024-02-29 21:05:12 UTC
From:
To:
Thanks for the analysis, Antonio; I completely hadn't realised that.
So no bug in dh_python after all!

Best wishes,

   Julian

#1059529#25
Date:
2024-02-29 21:07:12 UTC
From:
To:
Let's close this.

Stefano