Hi,
you might want to consider bringing up what you think are problems with sbuild
on on the Debian BTS of sbuild instead of d-devel unless you think that this
topic deserves wider discussion. I put the relevant bug in CC. Maybe drop
debian-***@lists.debian.org unless you think that this issue deserves being
discussed by all DDs.
Quoting Scott Talbert (2025-02-14 03:01:29)
It seems that something changed in the last month or so with sbuild such that
when building a package, it now seems to run dpkg-checkbuilddeps _outside_
the chroot and will fail all the build deps aren't installed.
this is not what is happening. Not *all* the build dependencies need to be
installed. Those needed to run the clean target need to be installed. The
change in behaviour you see happened due to this commit in November 2024:
https://salsa.debian.org/debian/sbuild/-/commit/4da64ffbb800230ad7c84ab0c701d84ea35794cd
This commit fixed two issues:
- the clean target was run without making sure that the packages required to
run the clean target are installed. In the past this led to situations in
which you ran sbuild but then you got an error from d/rules at the point
where it tried to run a tool as part of the clean target that was not
installed
- the clean target was run inside fakeroot and unconditionally. By letting
dpkg-buildpackage run the clean target, we let dpkg figure out if that is
really needed or not.
Is there a way to avoid this behavior, other than by using --no-clean-source?
If you want sbuild to run the clean target without checking whether the
packages required to run the clean target according to d/control are installed
then no, this is not going to happen. You can see this wontfix bug for details:
#1033626. Essentially your options are:
a) add $clean_source=0; to your ~/.config/sbuild/config.pl
b) install those dependencies required to run the clean target on your machine
c) if you use gbp buildpackage to run sbuild, configure it such that it passes
--no-clean-source to sbuild (gbp will only work in a clean state anyways)
d) move move build dependencies from Build-Depends to Build-Depends-Arch and
Build-Depends-Indep leaving in Build-Depends only those dependencies which are
required to run the clean target (see Debian Policy §7.7)
e) pack up the dsc yourself manually and call sbuild with the .dsc as input
f) teach sbuild to accept a source *directory* as input instead of the dsc
(patches welcome) and then it can run the clean target inside the chroot
g) teach gbp to pass the --no-clean-source to sbuild if the directory is
already clean (i'm sure guido would accept patches too)
The fact that sbuild creates the dsc for you is a convenience option. The input
to sbuild is the source package not the unpacked directory. So before sbuild
runs it needs to create the source package. For that to happen without messing
up, the unpacked source directory must be clean. You can achieve this without
running the clean target if you do your packaging with git but then you might
want to use "gbp buildpackage" and let it do the right thing. sbuild is also
used for packages that are not maintained in git, so it cannot know that your
unpacked source directory is probably clean already.
Thanks!
cheers, josch