Hi!
On Thu, 2024-02-22 at 19:32:21 +0100, Niels Thykier wrote:
[...]
Right, this is annoying. This was actually brought up some time
ago (2010) in debian-devel as part of #597340. There was not much
reaction at the time (one good, a couple bad).
# How do we get here?
High level, any helper framework above dpkg can provide this feature if it
wants to. It is basically a question of parsing d/*.substvars to figure out
which substvars are relevant, compute a new field from substvars file + the
static provided data from d/control, and then passing -DField=<...> to
dpkg-gencontrol.
There are probably a bunch of nitty gritty implementation details in
practice, but the overall approach stands.
I think each helper stack (debhelper, cdbs, debputy, etc.) would define
their own rule set for how to get there. As an example, I could see this be
the new default in the next debhelper compat level, possibly with a way to
be early adopter on existing compat levels.
If we agree we want this implicit mechanism of adding some substvars
to fields, then doing it in helpers seems like a suboptimal path, as
each one would need to replicate the logic, and implement substvar
substitution logic. I think if this is to be done, it should be done
at the dpkg-dev level.
[...]
## Alternative solutions
We could also make unused substvars a hard failure (FTBFS). Personally, I
feel auto-managing them will be less painful for users. But if the consensus
goes down this direction, then I would be behind it as it is still better
than the status quo in my book.
I also implemented in that branch another operator !=, which marks a
substvar as required, so failure to use it will generate an error. I
might have to move the error emission into some other function that
is not called warn_about_unused() though… :)