Bug#1088269: sbuild 0.87.1 fails on build dependencies missing from the host system

Aurélien COUDERC coucouf at debian.org
Tue Nov 26 20:35:38 GMT 2024


[+pkg-kde-talk for ideas / comments]

Le mardi 26 novembre 2024, 10:39:47 UTC+1 Johannes Schauer Marin Rodrigues a écrit :
> Hi,
> 
> Quoting Aurélien COUDERC (2024-11-26 08:44:29)
> > sbuild starting with 0.87.1 fails when build dependencies are missing
> > from the host system.
> > 
> > E.g. building kde-spectacle:
> > 
> > dpkg-source: info: using options from spectacle/debian/source/local-options: --abort-on-upstream-changes
> > dpkg-buildpackage: info: source package kde-spectacle
> > dpkg-buildpackage: info: source version 24.08.0-2
> > dpkg-buildpackage: info: source distribution unstable
> > dpkg-buildpackage: info: source changed by Aurélien COUDERC <coucouf at debian.org>
> > dpkg-checkbuilddeps: error: Unmet build dependencies: libkcolorpicker-qt6-dev libkimageannotator-qt6-dev libopencv-core-dev libopencv-dev libopencv-imgproc-dev libzxing-dev qt6-declarative-private-dev (>= 6.6.0~)
> > dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
> > dpkg-buildpackage: warning: (Use -d flag to override.)
> > E: Failed to clean source directory /home/coucouf/hack/debian/kde/gear/spectacle (/home/coucouf/hack/debian/kde/gear/kde-spectacle_24.08.0-2.dsc)
> > 
> > 
> > Reverting to 0.87.0 fixes the issue.
> > 
> > I’m running sbuild from inside a git clone of the repo [1].
> > I have :
> >     $chroot_mode = "schroot";
> >     $schroot = "schroot";
> > in my ~/.config/sbuild/config.pl.
> > 
> > Maybe I’m missing something so I’ve set the severity as important but
> > AFAIC this should be RC.
> 
> this is the result of a bug fix. In the past, sbuild ran this to clean the
> source package before running "dpkg-source -b .":
> 
>     fakeroot debian/rules clean
> 
> This is problematic because
> 
>     a) fakeroot should not be needed for packages with Rules-Requires-Root
>     b) fakeroot is buggy and should be avoided
>     c) we want to get rid of fakeroot in the long run
>     d) running the clean target requires some packages being installed to run
>        the tools that do the cleaning, and there was no check if that is the
>        case
> 
> So now what sbuild does is this:
> 
>     dpkg-buildpackage --target clean
> 
> This takes care of all of the above by only selectively running fakeroot and
> by checking for missing build dependencies.

Thanks for the detailed explanation.
I did see the change in the changelog but couldn’t relate it to the error I was seeing.

> You have several options to work around this:
> 
>    a) don't run the clean target. Either by running sbuild with --no-clean or
>       by putting $clean_source=0; into your ~/.config/sbuild/config.pl Doing
>       this is especially useful if you are running sbuild from a packaging
>       git and you thus already know that your source is clean, either becaus
>       you ran "git clean -fdx" yourself or because git-buildpackage stops you
>       from building a package in a not-clean state.
> 
>    b) Avoid putting packages in Build-Depends. I've had a look at your package
>       kde-spectacle and I'm quite sure that you do not need all these *-dev
>       packages to run the clean target. This patch would fix it for you:
> 
> --- a/debian/control
> +++ b/debian/control
> @@ -3,8 +3,8 @@ Section: kde
>  Priority: optional
>  Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>
>  Uploaders: Aurélien COUDERC <coucouf at debian.org>,
> -Build-Depends: cmake (>= 3.16~),
> -               debhelper-compat (= 13),
> +Build-Depends: debhelper-compat (= 13),
> +Build-Depends-Arch: cmake (>= 3.16~),
>                 dh-sequence-kf6,
>                 dh-sequence-qmldeps,
>                 extra-cmake-modules (>= 6.3.0~),
> 
> 
>       Have a look at Debian policy §7.7. To run the clean target, only B-D
>       and B-C must be satisfied. So you can move what is actually needed
>       for the build-arch target into B-D-A instead.
> 
>    c) Convince me that sbuild should instead run the clean target of the
>       packages it builds without making sure that the required dependencies
>       to do so are satisfied.
> 
>    d) Convince me that disabling running the clean target by default is a good
>       idea. There is this MR for that:
>       https://salsa.debian.org/debian/sbuild/-/merge_requests/71

a) Being a proponent of things that just-work™ I’d rule out a).
If I, building loads of packages every other day, cannot make up what needs to be done to get it working how will newcomers or occasional contributors get around that ?
For me sbuild should work from the source package without additional setup, as much as sensible.

b) Doable. Lot of work.
Need to change our somewhat complex tooling [1] that generates and updates the build deps from upstream’s CMakeFiles.
Also (maybe biased because we package mostly arch-dependent binaries) I would seem more logical to me to have a Build-Depends-Noarch stanza with the very few package needed so that the default Build-Depends contains the useful stuff.

c) Looks like a recipe for failure.
Maybe only for relatively corner cases but it looks unexpected.

d) If that ends up adding unexpected files to the build, clearly not a good option either.
I don’t pretend that my build environments are clean enough that I can afford that.
So maybe that’s a valid option but I’m not the one going to try and convince you. :)


You’re talking about fakeroot but is that the interesting part ?
It seems to me that sbuild previously ran the clean target inside the container having B-D installed, which is why it was working.
I think that’s a property worth keeping regardless of the use of fakeroot.

So my preferred solution would be to mimic that behaviour and have :
- the source tree is injected in the build container with the B-D installed,
- the clean and build source stages happen there,
- the container is cleaned / reverted to its initial state with only the B-D,
- then it’s reused for the actual build.



[1] https://salsa.debian.org/qt-kde-team/pkg-kde-dev-scripts/-/blob/master/function_collection/cmake_update_deps.py?ref_type=heads


Best,
--
Aurélien





More information about the pkg-kde-talk mailing list