On Mon, 13 Jan 2025 16:05:22 +0000 Ian Jackson <ijack...@chiark.greenend.org.uk> wrote:
Andrea Pappacoda writes ("Bug#1092929: dgit: building packages using the debputy 
Build-Driver"):
> Package: dgit
> Version: 12.4
> Severity: whishlist
...
>      debputy internal-command dpkg-build-driver-run-task clean
>        dpkg-buildtree clean
>        rm -fr debian/.debputy

I'm not familiar with debputy.  Is this a new interface supported by
dpkg-buildpackage ?  In sid, I guess ?


Some context: Guillem and I have been experimenting with ways to move out of the `debian/rules` interface to enable better feature detection between `dpkg` and the underlying package helper. As an example, the reason why the `Rules-Requires-Root` default was not pushed via debhelper compat level was that `dpkg` needed to know what way to call the `debian/rules` but `dh` inside it knew whether it supported it out of the box (and what compat level it was).

The `Build-Driver` interface is a field in `debian/control` that tells `dpkg` to use a custom build driver (Perl module, Dpkg::BuildDriver::*) with the default being the `debian-rules` driver (`Dpkg::BuildDriver::DebianRules`). The interface is experimental and added in `dpkg-dev (>= 1.22.7~)`.

Largely, a trivial `dh $@` `debian/rules` file can be replaced by `Build-Driver: debputy` with a `Build-Depends` on `dpkg-dev (>= 1.22.7~)` and `dh-debputy`. I forgot the exact version, but due to `dpkg-dev` only the version in sid/testing matters and it supports it.

Generally, if you use `dpkg-buildpackage` for all interactions with the build, it will handle this logic itself. If you ever use `debian/rules` (such as `debian/rules clean`) then `dpkg-buildpackage -d -T<target>` is a way to fix it (with `-d` being if you want to ignore missing build-depends). Note that `dpkg-buildpackage -Tclean` will respect the `Rules-Requires-Root` which might be another level of delta with `debian/rules clean`. In that sense, the following might be useful:

```
if [ -f "debian/rules" ] ; then
   debian/rules clean
else
   dpkg-buildpackage -d -Tclean
fi
```

As a backwards compatible solution. But all this assumes `dgit` is invoking `debian/rules` directly at somep

>     dgit: failed command: tar -cf 
'./oaknut_1.2.2+git20240301.94c726c-~~DGITFAKE.debian.tar' -C 
/home/tachi/dev/deb/oaknut debian/source/format debian/rules debian/control 
debian/changelog

dgit is trying to sort out the quilt patches.  I forgeet what's going
on here precisely, but dgit itxelf doesn't look at or need
debian/rules.

My memory is that it is including it here because otherwise some other
tool malfunctdioned.

> [...]

I think it is this code (https://salsa.debian.org/dgit-team/dgit/-/blob/master/dgit#L6613)

Note that @files is initialized to unconditionally include `debian/rules`. If that name was moved to the `foreach` below, then it would be filtered out when it does not exist. This list of files is later passed to tar, which will expect them all to exist.

    my @files=qw(debian/source/format debian/rules
                 debian/control debian/changelog);
    foreach my $maybe (qw(debian/patches debian/source/options
                          debian/source/include-binaries
                          debian/tests/control)) {
        next unless stat_exists "$maindir/$maybe";
        push @files, $maybe;
    }

As for a tool malfunctioning without `debian/rules`, it could very well have been `sbuild` if the build is using the `.dsc` if `sbuild` is not given a `--no-clean-source`. I cannot find `--no-clean-source` in `dgit` via the online search,

That said, current (or next?) version of `sbuild` migrated to using `dpkg-buildpackage -Tclean` and should no longer be affected. Not sure if the other build interfaces are affected (like `pbuilder`, no clue how that interacts here).

Either way, for supporting Build-Driver, flushing out breakages and filing bugs is currently part of the game given its early states.

Best regards,
Niels

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to