On Fri, 24 Feb 2023 at 22:42:09 +0200, Jussi Pakkanen wrote:
> Using the log info I managed to find out why it does not work. The
> tests that I have specifically pass --debarch=xxx to debcrossgen which
> then passes it on to env2mfile and things work. However the package
> builds do not do that, instead they call `debcrossgetn -oXXX` which
> then fails.

The common case is that debhelper invokes debcrossgen, via
/usr/share/perl5/Debian/Debhelper/Buildsystem/meson.pm, and you'll
see that in the current version of debhelper it never specifies the --arch
option.

The option seems to be debcrossgen --arch rather than --debarch, although
it becomes meson env2mfile --debarch.

The current interface when no --arch is specified appears to be that
debcrossgen runs dpkg-architecture with no arguments, and parses its
output, which is documented to vary depending on the value of the
DEB_HOST_ARCH environment variable (which should always be set to some
suitable value while cross-compiling a Debian package, and debcrossgen
only makes sense during cross-compilation, so I think it would be OK
for debcrossgen to fail or even crash if it's unset).

> The proper fix for this would require knowing how Debian intends to
> use things. If it is ok to require package builders to pass
> --debarch=armhf or somesuch or does it need to work by detecting magic
> envvars (which I personally do not like as envvars are an endless
> source of pain, but they are fairly entrenched so sometimes you have
> to use them).

The way debhelper currently invokes debcrossgen (without --arch) should
continue to behave as if --arch=$DEB_HOST_ARCH had been used, unless
someone changes debhelper to always give it the --arch argument (or use
meson env2mfile more directly) during a post-bookworm release cycle.
If a version of meson makes an incompatible change to the debcrossgen
interface, then that version will need a Breaks: debhelper (<< x.y~)
where x.y is the first version of debhelper that used the new interface
(whatever that new interface is).

As someone who backports meson into derivatives of (much) older Debian
versions during my day job, without usually backporting debhelper,
I'd personally prefer it if the current debcrossgen interface continues
to work indefinitely, even if it's considered deprecated. If a change
is necessary then so be it, but it seems to me as though logic in
debcrossgen like

    parser.add_argument('--arch', default=os.environ['DEB_HOST_ARCH'])

would be an easy way to make the old interface work forever, while also
providing an "explicit is better than implicit" interface for specifying
the architecture more directly.

    smcv

Reply via email to