On Thu, Dec 28, 2017 at 5:11 AM, Niels Thykier <ni...@thykier.net> wrote:
> Hi Paul,
>
> Thanks for looking at improving debhelper.

Of course!

> I have been looking at this, and I am left with a concern and one piece
> of "bike-shedding".
>
> The situation:
> ==============
> dh add-ons are order sensitive.  That is, there are cases where "--with
> a,b" vs. "--with b,a" behaves different (the only know example was the
> autotools-dev and autoreconf add-ons, where you always wanted --with
> autotools-dev,autoreconf - in that order).
>
> This is a nasty misfeature.  Unfortunately, it is a design flaw and
> cannot be trivially fixed without rewriting the entire dh add-on system.
>
> The concern:
> ============
>
> A package maintainer can trivially shuffle the order of two add-ons, but
> the builder does not have this option.  With the above mentioned
> "misfeature", I foresee that eventually someone will need to place an
> add-on in a different order than this patch allows (e.g. so they can
> inject theirs in the middle of two add-ons enabled by the package
> maintainer).
>
> I think the best solution here is for someone (probably me) to sit down
> and redesign the add-on system to avoid/fix the above misfeature.  I
> suppose this can be done later if that ever becomes relevant (with this
> mail just serving to record the issue to cluebat myself if/when that
> becomes relevant).


Yeah, that's a nasty one. I added a warning in the docs for folks to not
use this envvar if at all possible, so hopefully this prevents this
from causing that situation to become more complex.

> The bike-shedding:
> ==================
>
> I would prefer that the name of the variable(s) uses "add-on" / "ADDON"
> (e.g. DH_EXTRA_ADDONS) instead of WITH (DH_WITH).  What it controls is
> which adds you enable - "WITH" says nothing about what it does (I
> appreciate it is a reference to the command line option, but I think an
> "ADDONS"-based name will be less confusing to newcomers/people with
> less/no debhelper experience).

I hated the name DH_WITH, so great name, updated patch attached! I
built and tested the new patch, and it still appears to work!

> Thanks,
> ~Niels
>

Thanks, Niels,
  Paul



-- 
:wq
From 69a26c09d5a5cbd0613b9dada5caa6a4d632c912 Mon Sep 17 00:00:00 2001
From: Paul Tagliamonte <paul...@debian.org>
Date: Tue, 12 Dec 2017 23:35:39 -0500
Subject: [PATCH] Add DH_EXTRA_ADDONS env variable to specify local addons.

This is intended to be used by downstreams or specific local configurations
that require a debhelper addon to be run during multiple builds without
having to patch a large number of rules file. If at all possible, this should
be avoided in favor of a --with flag in the rules file.
---
 debhelper.pod | 12 ++++++++++++
 dh            |  1 +
 2 files changed, 13 insertions(+)

diff --git a/debhelper.pod b/debhelper.pod
index dd73c3f9..4cb18257 100644
--- a/debhelper.pod
+++ b/debhelper.pod
@@ -958,6 +958,18 @@ your package is built.
 Multiple things to exclude can be separated with colons, as in
 B<DH_ALWAYS_EXCLUDE=CVS:.svn>
 
+=item B<DH_EXTRA_ADDONS>
+
+If set, this adds the specified dh addons to be run in the appropriate places
+in the sequence of commands. This is equivalent to specifying the addon to run
+with the --with flag in the debian/rules file. Any --without calls specifying
+an addon in this environment variable will not be run.
+
+This is intended to be used by downstreams or specific local configurations
+that require a debhelper addon to be run during multiple builds without
+having to patch a large number of rules file. If at all possible, this should
+be avoided in favor of a --with flag in the rules file.
+
 =back
 
 =head1 SEE ALSO
diff --git a/dh b/dh
index 3d268268..344d4e93 100755
--- a/dh
+++ b/dh
@@ -303,6 +303,7 @@ if (not compat(9, 1)) {
 	unshift(@ARGV, "--with=build-stamp");
 }
 
+push @{$dh{WITH}},split(",", $ENV{DH_EXTRA_ADDONS});
 
 inhibit_log();
 		
-- 
2.15.1

Reply via email to