Helmut Grohne: > Package: debhelper > Version: 12.2.2 > Severity: wishlist > > Hi Niels, > > I've noticed myself writing the following debian/rules pattern more than > once: > > ifneq (,$(filter somepackage,$(shell dh_listpackages))) > somecommand > endif > > For dh_* commands this can be improved to > > dh_foo -psomepackage ... > > because debhelper automatically skips the invocation when somepackage is > not build. This is a great feature. In a similar vein, one can pass -a > or -i to turn dh_* commands into noops. > > I think this concept is worth extending. We conditionalize debian/rules > using override_*-arch and override_*-indep already, but in the presence > of build profiles, this often proves insufficient. The package selection > provided by -p, -a and -i helps for dh_* commands, but does not work for > others. How about adding a "dh_do" helper whose sole purpose is to > conditionalize other commands? > > dh_do -psomepackage -- some shell command relevant to somepackage > > This is a powerful feature with potential to abuse. If you don't like > it, please close this bug as wontfix. > > Helmut >
Hi Helmut, Can you show me some concrete of the examples, where this would be useful. I am most interested in the "blob" disguised as "somecommand" in your examples above (I can fully appreciate the value of getting rid of the if.../endif-bits). My first take would be something like: dh_runcmdforpkg -- some-cmd --with-arg1 --with-arg2 But if you use a lot of shell pipelines, then you would need to do sh -c '<shellpayload>' a lot. Then it might be better to have: dh_runcmdforpkg --exec-mode=command -- some-cmd --with-arg dh_runcmdforpkg --exec-mode=command -- 'raw-shell payload | process' Will you need support for: * chdir * flagging certain exit codes as acceptable/non-errors * special-exit code if dh_runcmdforpkg does nothing (default would be 0) * negated package selection * redirects of stdout/stderr * something else I have not thought off (Not all of these are equally trivial with the debhelper library design) Thanks, ~Niels