[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Debhelper doesn't know the ‘build-stamp’ target, but Lintian recommends it

On Wed, Jul 27, 2011 at 09:12:37PM +1000, Ben Finney wrote:
> Roger Leigh <rleigh@codelibre.net> writes:
> > On Wed, Jul 27, 2011 at 08:23:42AM +1000, Ben Finney wrote:
> > > Kilian Krause <kilian@debian.org> writes:
> > > 
> > > > Hi Ben,
> > > >
> > > > On Tue, 2011-07-26 at 17:10 +1000, Ben Finney wrote:
> > > > > Lintian recommends (via tag ‘debian-rules-missing-recommended-target’):
> > > > > 
> > > > > =====
> > > > > N:   Note that the following form is recommended however:
> > > > > N:   
> > > > > N:     build: build-arch build-indep
> > > > > N:     build-arch: build-stamp
> > > > > N:     build-indep: build-stamp
> > > > > N:     build-stamp:
> > > > > N:   build here
> > > > > =====
> […]
> > > Should Lintian's recommendation be changed?
> >
> > Quite possibly, I'm sure the lintian maintainers would be happy to
> > have improved help text. I didn't write it with dh in mind
> Okay. (Thanks for writing it.)
> If you were to write it with ‘dh’ in mind, what would be the recommended
> set of explicit targets?

For an idealised package, there would be no explicit targets, except
for any overrides required.

Using schroot and gutenprint as examples:

Neither of these need explicit build targets.  They do need explicit
install targets, but only due to the need to autogenerate .install
files via a separate rule for multiarch dirs, which I'm triggering via
a make dependency.  In both cases, I am simply using
"override_dh_auto_build" to make it do the particular build command for
the package, and at least for gutenprint, it's probably entirely
redundant since the default would do the same.

> > The main problems with
> >    build-arch: build
> >    build-indep: build
> I'm not sure who suggested that; it doesn't seem to be in this thread.

It's the first part of the lintian message; I just mentioned it for
completeness in case it got trimmed out of the first message I saw
in the thread, in particular because of the dh-related recursion gotcha
that might catch people unawares.

> > since dh works with build-arch and build-indep automatically since
> > 8.1.0
> Ah, thank you. I now need to increase the ‘debhelper’ dependency and
> ‘compat’ level to correctly rely on its support for those targets.

Yes.  v8 will support build-arch and build-indep as "sequences", v9
will allow you to use the rules in debian/rules (and have dh realise
that and use them in place of its build-in sequences) in addition.

> > and since 8.9.0 with v9 compatibility mode, dh supports proper
> > overriding of sequences with make targets. But unless you're doing
> > something really different, you shouldn't need to specify any build
> > rules at all
> Both of those are rather too much magic. One of the great benefits of
> using debhelper( as opposed to CDBS) is that one can look at a
> ‘debian/rules’ file without specific knowledge about debhelper, and see
> at least what commands will be run when.
> So, if Lintian is going to recommend these targets, what text would make
> it a suitable recommendation for both no-helper and ‘debhelper’ rules
> styles?

Without any helper:

build: build-arch build-indep

	# Build arch-dep here

	# Build arch-indep here

And this can include additional dependencies for build-arch and
build-indep such as the build-stamp suggested in the lintian text
(saves building twice if both rules use the same logic).  build
can't have any additional dependencies, since it's optional--it can
only depends on build-arch and build-indep, and should do nothing else
(since it's not guaranteed to be called if you used build-arch and/or
build-indep directly).

With dh v8 compat:

Same command for arch and indep:
	$(MAKE) foobar

If you have different commands for arch and indep:
ifneq (,$(shell dh_listpackages -a 2>/dev/null))
	$(MAKE) -C debian/build all
ifneq (,$(shell dh_listpackages -i 2>/dev/null))
	$(MAKE) -C debian/build doc

With dh v9 compat:

Same command for arch and indep:
        $(MAKE) foobar

If you have different commands for arch and indep:
	$(MAKE) arch-foo

	$(MAKE) indep-foo

Or the same logic as v8.

As you can see, the "magic" is really only required for v8 compat mode.
In v9, we can safely use rules directly as we would for non-dh rules.
(You can use rules directly in v8, but dh won't always use them since
the "sequence" is just a list of dh commands, so "dh binary" won't use
any install or build targets; in v9 it will use the appropriate
targets if present, and skip the sequence for that target, giving you
more control and using all standard targets as expected.)


  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Attachment: signature.asc
Description: Digital signature

Reply to: