#1113869 git-buildpackage: Please add a gbp-bp argument to pass --host-arch to pbuilder

#1113869#5
Date:
2025-09-03 15:49:58 UTC
From:
To:
It would be convenient to have an easy way to use gbp buildpackage for cross
compiling
packages. Right now, I pass the --host-arch=arm64 parameter using
GIT_PBUILDER_OPTIONS:

$ export GIT_PBUILDER_OPTIONS="--host-arch=arm64"
$ gbp buildpackage


It would be nice to have something like --git-host-arch to mirror the existing
--git-arch
option:

$ gbp buildpackage --git-host-arch=arm64

#1113869#10
Date:
2025-09-03 18:10:12 UTC
From:
To:
Hi,

Makes sense. We should also amend `git-pbuilder` slightly to read a
`GIT_PBUILDER_HOST_ARCH` to be consistent with what we do for `--git-arch`.

Am I assuming correctly that you're using plain
/var/cache/pbuilder/base.cow/ / /var/cache/pbuilder/base-$DIST.cow for
that or do you have special chroots setup for that purpose?

Cheers,
 -- Guido

#1113869#15
Date:
2025-09-03 19:12:55 UTC
From:
To:
Yup, consistency is good.

I happen to be using a special chroot for testing, but it's not required -- you
can have a multiarch base.cow and use that to create both native and
cross built packages. I created my chroot using this command:

        sudo cowbuilder create \
             --basepath /var/cache/pbuilder/base-cross.cow \
             --debootstrap mmdebstrap \
             --debootstrapopts --architectures=amd64,arm64 \
             --debootstrapopts --skip=output/dev \
             --debootstrapopts --variant=buildd \
             --debootstrapopts --include=ca-certificates

Helmut suggested that I add

#1113869#20
Date:
2025-09-03 20:28:43 UTC
From:
To:
Hi,

That's what I suspected, thanks for confirming!

I'm clear on that part. The question is how we want it to work. For
thinks like --git-arch and --git-dist we have all the chroot setup
integrated into git-builder and we want to do the same for the
--git-host-arch variant so it becomes easy to use out of the box
as well.

So maybe using dirs like `base-sid-host-$arch` or similar could work to
tell things apart and then …

…we could add something like the above to git-builder to create those
chroots. So it seems this becomes a bit more complicated than just
adding the option but looks worthwhile to have.

Cheers and thanks for the details!
 -- Guido

#1113869#25
Date:
2025-09-03 20:42:57 UTC
From:
To:
Oh, that would be cool. So cowbuilder create would be enhanced to
support multi-arch, and then git-pbuilder create would use that?

As above, that isn't necessary -- if the user wants a separate
cowbuilder chroot, there are ways to do that. Otherwise, a single
multi-arch chroot in base.cow seems like a pretty reasonable plan?

However, getting pbuilder create to support multi-arch seems like a lot
of work and isn't really necessary as we can document the process for
now. Getting gbp buildpackage to handle --git-host-arch would be
useful even without the pbuilder additions.