On Wed, Oct 19, 2011 at 10:26:50AM -0700, Joey Hess wrote:
> Marcin Owsiany wrote:
> > Consider a following snippet:
> > 
> > | ifneq (,$(findstring libgadu-doc, $(shell dh_listpackages)))
> > | override_dh_installdocs:
> > |   dh_installdocs
> > |   # nicer name for api docs directory
> > |   mv debian/libgadu-doc/usr/share/doc/libgadu-doc/html \
> > |      debian/libgadu-doc/usr/share/doc/libgadu-doc/api
> > | endif
> 
> How can this possibly work? the ifneq is parsed when make parses the
> makefile, well before dh does anything. So of course it lists all
> packages.

Correct me if I'm wrong, but I was under the impression that make is ran
twice on debian/rules:

dpkg-buildpackage
 |
 \_ make -f debian/rules <target> (1)
    |
    \_ dh <target>
       |
       \_ make -Rrnspf debian/rules debhelper-fail-me (2)

I also thought that in (1) the override_* targets do not play any role.  It's
only in (2) that it matters what override_* targets are defined, because that's
how dh decides which of them to call instead of the dh_* commands. And I
assumed that dh sets up the environment in such way that dh_listpackage knows
what <target> is being built. Isn't that how this works?

> > I've noticed that the example in the 8.9.0 manpage has the ifneq/endif
> 
> There is no such example in debhelper 8.9.0,

I mean this piece:

|       Sometimes, you may need to make an override target only run commands
|       when a particular package is being built. This can be accomplished
|       using dh_listpackages(1) to test what is being built. For example:
|
|               #!/usr/bin/make -f
|               %:
|                       dh $@
|
|               override_dh_fixperms:
|                       dh_fixperms
|               ifneq (,$(filter foo, $(shell dh_listpackages)))
|                       chmod 4755 debian/foo/usr/bin/foo
|               endif

Perhaps that was added by ubuntu?

mowsiany@beczulka:~$ LANG=C dpkg -l debhelper
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  debhelper      8.9.0ubuntu1   helper programs for debian/rules


> except possibly a fuzzy one
> in the Spanish man page, and that one puts the ifneq inside the target,
> which I think probably does work. 

Right, that's what I meant by "part of the rule".

> The new way to accomplish this is to use override_dh_installdocs-indep

Oh, nice. Which version is this available from?

-- 
Marcin Owsiany <porri...@debian.org>             http://marcin.owsiany.pl/
GnuPG: 1024D/60F41216  FE67 DA2D 0ACA FC5E 3F75  D6F6 3A0D 8AA0 60F4 1216



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to