Re: dh 7 broken by design?

2009-02-18 Thread Russ Allbery
Joey Hess jo...@debian.org writes:
 Russ Allbery wrote:

 I really think this is a bug in make.

 Probably, but who knows. It could just be a misfeature on which ghod
 knows what somehow depends.

 .PHONY: precompiled-binary-we-cannot-regenerate-with-gcc.o

It feels like the next step is to ask make upstream whether they think
this is a bug that can be fixed.  If so, great, and we can move forward
with that approach.  If not, we can pursue the alternatives.  But it seems
like it would be worthwhile to ask.

Given that you can achieve the same goal in a much more straightforward
and traditional manner (I think) with:

precompiled-binary-we-cannot-regenerate-with-gcc.o:

it feels like an unintentional side effect of an internal implementation
to me.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


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



Re: dh 7 broken by design?

2009-02-18 Thread Bernhard R. Link
* Helmut Grohne hel...@subdivi.de [090217 21:18]:
 So will the new minimal example look like the following then?
 
 #/usr/bin/make -Bf
 %:
   dh $@

Note that there is also the possibility of

#/usr/bin/make -f
Makefile:
@#
%: Makefile
dh $@

which is another way to make things phony. (and avoids dh being called
for the Makefile target as it is when naming that target FORCE as
make's info file suggest).

But I definitly think a debian/rules file should list all the required
and optional rules it supports via a .PHONY: line.

Even better the % rule should already list which targets it actually
supports as

#include /usr/share/debhelper/bla
$(SUPPORTED_RULES): %:
dh $@
.PHONY: $(SUPPORTED_RULES)

everything else is just very fragile...

Hochachtungsvoll,
Bernhard R. Link


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



dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
Hi,

I recently tried converting my packages to dh 7 and ... failed.

The simple rule
%:
dh $@
will fail miserably if there is any file named like a target. Try `touch
build' in your favourite dh-7-package to see it break.

GNU make users probably know that this is why there is a .PHONY: ...
rule. However that one does not work with implicit dependencies and
results in make thinking there is nothing to be done.

Another idea was to supply the -B switch to make:
  -B, --always-make   Unconditionally make all targets.

However `make -Bf ./debian/rules clean' does not seem to work since make
executes `dh ./debian/rules'. I did not find out why.

Any ideas? (And no, removing all files named after targets is a
non-option for the general case.)

I reverted to the customisation dh 7 example defining all targets and
.PHONY for now.

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Ben Finney
Helmut Grohne hel...@subdivi.de writes:

 The simple rule
 %:
   dh $@
 will fail miserably if there is any file named like a target. Try
 `touch build' in your favourite dh-7-package to see it break.

 GNU make users probably know that this is why there is a .PHONY: ...
 rule.

Yes. For this reason, I avoid the three-line rules file (despite its
cuteness), and use the .PHONY feature.

 However that one does not work with implicit dependencies and
 results in make thinking there is nothing to be done.

Can you give an example of a ‘debian/rules’ that does not work, and
what the desired behaviour would be?

-- 
 \“You can't have everything; where would you put it?” —Steven |
  `\Wright |
_o__)  |
Ben Finney


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



Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
 Yes. For this reason, I avoid the three-line rules file (despite its
 cuteness), and use the .PHONY feature.

OK.

  However that one does not work with implicit dependencies and
  results in make thinking there is nothing to be done.
 Can you give an example of a ???debian/rules??? that does not work, and
 what the desired behaviour would be?

Well my basic idea was to add a .PHONY line to the 3-line example like:

#!/usr/bin/make -f
%:
$@
.PHONY:build clean install binary-arch binary-indep binary

This rules file is semantically equivalent to an empty one. The
intention was to force make to build everything even though files like
clean or build may exist.

BTW: This gets even worse with Joey's plans for future dh improvements
like override_foo targets. Even though it is less probable that a file
named like that exists it creates a bunch of more forbidden files.

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread George Danchev
On Tuesday 17 February 2009 14:35:27 Helmut Grohne wrote:

Hi,

  Can you give an example of a ???debian/rules??? that does not work, and
  what the desired behaviour would be?

 Well my basic idea was to add a .PHONY line to the 3-line example like:

 #!/usr/bin/make -f
 %:
   $@
 .PHONY:build clean install binary-arch binary-indep binary

There is no way of knowing in advance how a particilar .PHONY should look 
like, thus it is left to the user to decide on per package basis and populate 
it as well. You can hardly blame dh scripts about the lack of artificial 
intelligence.

 This rules file is semantically equivalent to an empty one. The
 intention was to force make to build everything even though files like
 clean or build may exist.

 BTW: This gets even worse with Joey's plans for future dh improvements
 like override_foo targets. Even though it is less probable that a file
 named like that exists it creates a bunch of more forbidden files.

citation needed...

-- 
pub 4096R/0E4BD0AB 2003-03-18 people.fccf.net/danchev/key pgp.mit.edu


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



Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
  #!/usr/bin/make -f
  %:
  $@
  .PHONY:build clean install binary-arch binary-indep binary
 There is no way of knowing in advance how a particilar .PHONY should look 
 like, thus it is left to the user to decide on per package basis and populate 
 it as well. You can hardly blame dh scripts about the lack of artificial 
 intelligence.

Could you stop ranting and try to understand the real question?

I only tried to fix the broken example by adding a .PHONY rule. What I
blame dh for is that it implements .PHONY rules without marking them as
such.

Let me explain the example in further detail:
For some reason some upstream ships a file ./clean that is invoked by
make clean. Everything else is assumed to be fine, so the simple 3-line
dh 7 example from the man page can be used. The package will then ftbfs
when built twice in a row, because ./debian/rules clean notices that
clean is already built and has no dependencies. Thus no action is
required and the build fails when creating the .diff.gz, because
binaries cannot be represented in the diff.

  BTW: This gets even worse with Joey's plans for future dh improvements
  like override_foo targets. Even though it is less probable that a file
  named like that exists it creates a bunch of more forbidden files.
 citation needed...

http://kitenet.net/~joey/blog/entry/debhelper_dh_overrides/

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Joey Hess
Helmut Grohne wrote:
 I recently tried converting my packages to dh 7 and ... failed.
 
 The simple rule
 %:
   dh $@
 will fail miserably if there is any file named like a target. Try `touch
 build' in your favourite dh-7-package to see it break.
 
 GNU make users probably know that this is why there is a .PHONY: ...
 rule. However that one does not work with implicit dependencies and
 results in make thinking there is nothing to be done.

I was not aware of this behavior of make and had assumed .PHONY could be used
as usual in this case. But I see that bug #509756 was recently opened on make
about it.

 Another idea was to supply the -B switch to make:
   -B, --always-make   Unconditionally make all targets.
 
 However `make -Bf ./debian/rules clean' does not seem to work since make
 executes `dh ./debian/rules'. I did not find out why.

Apparently make always tries to run a target with the name of the 
Makefile. So this causes it to try to build the Makefile
even though it's up-to-date.

I will make dh handle this case in the next release, by doing the equivilant
of:

debian/rules:
# no-op

-- 
see shy jo


signature.asc
Description: Digital signature


Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
On Tue, Feb 17, 2009 at 12:39:10PM -0500, Joey Hess wrote:
  GNU make users probably know that this is why there is a .PHONY: ...
  rule. However that one does not work with implicit dependencies and
  results in make thinking there is nothing to be done.
 I was not aware of this behavior of make and had assumed .PHONY could be used
 as usual in this case. But I see that bug #509756 was recently opened on make
 about it.

Oh. I found the behavior weired, but never thought about it being a bug.
Good to know it is already reported.

  However `make -Bf ./debian/rules clean' does not seem to work since make
  executes `dh ./debian/rules'. I did not find out why.
 Apparently make always tries to run a target with the name of the 
 Makefile. So this causes it to try to build the Makefile
 even though it's up-to-date.

Thanks for explaining ...

 I will make dh handle this case in the next release, by doing the equivilant
 of:
 
 debian/rules:
   # no-op

and solving. :-)

So will the new minimal example look like the following then?

#/usr/bin/make -Bf
%:
dh $@

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Ben Finney
(Please preserve attribution lines so we can see who wrote what quoted
material.)

Helmut Grohne hel...@subdivi.de writes:

   However that one does not work with implicit dependencies and
   results in make thinking there is nothing to be done.

Here, you state that something about a ‘debian/rules’ file “does not
work”.

  Can you give an example of a ???debian/rules??? that does not
  work, and what the desired behaviour would be?
 
 Well my basic idea was to add a .PHONY line to the 3-line example like:
 
 #!/usr/bin/make -f
 %:
   $@
 .PHONY:build clean install binary-arch binary-indep binary

What is it about this ‘debian/rules’ file that “does not work”, as
you said in your original message? What behaviour is expected, and
what behaviour do you get instead?

-- 
 \ “I have never imputed to Nature a purpose or a goal, or |
  `\anything that could be understood as anthropomorphic.” —Albert |
_o__)Einstein, unsent letter, 1955 |
Ben Finney


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



Re: dh 7 broken by design?

2009-02-17 Thread Ben Finney
Helmut Grohne hel...@subdivi.de writes:

 I only tried to fix the broken example by adding a .PHONY rule. What
 I blame dh for is that it implements .PHONY rules without marking
 them as such.

I don't understand this statement. ‘dh’ is a program, it doesn't
implement *any* makefile rules. That's up to the person who writes the
makefile (which in our context is named ‘debian/rules’).

I'm having trouble understanding what it is you expect to happen. What
would the result of “dh marking .PHONY rules as such” actually look
like? Should something change on the system when ‘debhelper’ version 7
or above is installed? If so, what?

-- 
 \   “Pray, v. To ask that the laws of the universe be annulled in |
  `\ behalf of a single petitioner confessedly unworthy.” —Ambrose |
_o__)   Bierce, _The Devil's Dictionary_, 1906 |
Ben Finney


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



Re: dh 7 broken by design?

2009-02-17 Thread Russ Allbery
Helmut Grohne hel...@subdivi.de writes:

 So will the new minimal example look like the following then?

 #/usr/bin/make -Bf
 %:
   dh $@

If the -B flag is necessary, this will require a change in Debian Policy;
currently, the above arguably violates a must.  I'm inclined to think this
isn't the right solution, since it also breaks invoking debian/rules as a
makefile instead of as an executable.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


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



Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
On Wed, Feb 18, 2009 at 08:35:03AM +1100, Ben Finney wrote:
 Helmut Grohne hel...@subdivi.de writes:
  I only tried to fix the broken example by adding a .PHONY rule. What
  I blame dh for is that it implements .PHONY rules without marking
  them as such.
 I don't understand this statement. ???dh??? is a program, it doesn't
 implement *any* makefile rules. That's up to the person who writes the
 makefile (which in our context is named ???debian/rules???).

Ok, you're ranting on improper wording. It of course does not implement
rules, but (common) actions. So with the simple-dh-example-rules-file
./debian/rules foo will invoke dh foo. dh implements actions for
makefile targets. These targets all do not created a target file. The
lacking marking applies to the example listed in man 1 dh. I'd
expected the example to include some code forcing make to rebuild the
targets even when files with the same name exist.

 I'm having trouble understanding what it is you expect to happen. What
 would the result of ???dh marking .PHONY rules as such??? actually look
 like? Should something change on the system when ???debhelper??? version 7
 or above is installed? If so, what?

The result would be changing the 3-line example in man 1 dh to a 4-line
example. However this is not possible, because either make is buggy
(#509756) or it just doesn't work.

rant
I don't get rid of the feeling that some people try to misunderstand me
as long as possible instead of even considering there might be bugs in
dh (I'm not saying that this is the case) while others (Joey, Russ) can
just add valuable content.
/rant

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
On Wed, Feb 18, 2009 at 08:27:33AM +1100, Ben Finney wrote:
 Helmut Grohne hel...@subdivi.de writes:
  Well my basic idea was to add a .PHONY line to the 3-line example like:
  #!/usr/bin/make -f
  %:
  $@
  .PHONY:build clean install binary-arch binary-indep binary
 What is it about this ???debian/rules??? file that ???does not work???, as
 you said in your original message? What behaviour is expected, and
 what behaviour do you get instead?

I'm sorry, but my example is very subtly wrong. It's lacking the three
characters dh  before $@. Adding these will result in the example
from man 1 dh plus a .PHONY line.

The expected behaviour would be that there is no difference to the
simple 3-line example if none of the files listed with .PHONY exist.

The observed behaviour is that all targets listed with .PHONY are
nothing to be done targes, see #509756.

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Joey Hess
Helmut Grohne wrote:
 So will the new minimal example look like the following then?
 
 #/usr/bin/make -Bf
 %:
   dh $@

Yes, that's how it's looking now.

-- 
see shy jo


signature.asc
Description: Digital signature


Re: dh 7 broken by design?

2009-02-17 Thread Helmut Grohne
On Tue, Feb 17, 2009 at 07:40:41PM -0500, Joey Hess wrote:
 Helmut Grohne wrote:
  So will the new minimal example look like the following then?
  
  #/usr/bin/make -Bf
  %:
  dh $@
 
 Yes, that's how it's looking now.

You should then take Russ Allbery's comment into account:

On Tue, Feb 17, 2009 at 02:06:09PM -0800, Russ Allbery wrote:
 If the -B flag is necessary, this will require a change in Debian Policy;
 currently, the above arguably violates a must.  I'm inclined to think this
 isn't the right solution, since it also breaks invoking debian/rules as a
 makefile instead of as an executable.

We probably need a different solution for this. :-/

Helmut


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



Re: dh 7 broken by design?

2009-02-17 Thread Russ Allbery
Helmut Grohne hel...@subdivi.de writes:
 On Tue, Feb 17, 2009 at 07:40:41PM -0500, Joey Hess wrote:
 Helmut Grohne wrote:

 So will the new minimal example look like the following then?
 
 #/usr/bin/make -Bf
 %:
 dh $@

 Yes, that's how it's looking now.

 You should then take Russ Allbery's comment into account:

 On Tue, Feb 17, 2009 at 02:06:09PM -0800, Russ Allbery wrote:
 If the -B flag is necessary, this will require a change in Debian Policy;
 currently, the above arguably violates a must.  I'm inclined to think this
 isn't the right solution, since it also breaks invoking debian/rules as a
 makefile instead of as an executable.

 We probably need a different solution for this. :-/

I really think this is a bug in make.

We can change Policy if we have to.  Arguably that line complies with
Policy, but it feels icky to me; Policy's requirement that debian/rules be
a makefile to me means that you should be able to use it as a makefile,
which means not requiring special make flags.  Policy also currently says:

It must start with the line #!/usr/bin/make -f, so that it can be
invoked by saying its name rather than invoking make explicitly.

but that's a bit more nit-picky.

More to the point, though, declaring a target as .PHONY shouldn't, I
think, cause it to not be processed by pattern rules.  That really feels
like a bug in make that should be fixed in make, and then debhelper can
just depend on a fixed version of make.  I'd much rather see that approach
than adding a workaround by adding -B.  You still then have to list the
rules as .PHONY in the minimal makefile, which is annoying, but you only
have to do that if your particular package has files by those names.

Right now, rather than changing dh, I'd recommend that people who have
packages that have such files just not use the dh 7 minimal makefile and
instead spell out the necessary rule.

-- 
Russ Allbery (r...@debian.org)   http://www.eyrie.org/~eagle/


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



Re: dh 7 broken by design?

2009-02-17 Thread Joey Hess
Russ Allbery wrote:
 I really think this is a bug in make.

Probably, but who knows. It could just be a misfeature on which ghod
knows what somehow depends.

.PHONY: precompiled-binary-we-cannot-regenerate-with-gcc.o
 
 We can change Policy if we have to.  Arguably that line complies with
 Policy, but it feels icky to me; Policy's requirement that debian/rules be
 a makefile to me means that you should be able to use it as a makefile,
 which means not requiring special make flags.

I don't remember all the examples of ways to use debian/rules as a
makefile that tend to come up whenever someone suggests that that 
(IMHO restrictive and counter-innovative) requirement be dropped. (And
would prefer recapitulating that thread..)

But I had rather thought that they all tended to involve either:

- Testing if a target exists. Ie, something like
  `make -nf debian/rules get-orig-source`
  (close to equivilant: `debian/rules -n get-orig-source`)
- Being able to rely on various make features when running debian/rules.
  Ie: `debian/rules clean build FOO=1`

Both sorts of things continue to work with rules files that pass
additional options to make. I'm having a hard time imagining a
rationalle for building a package by running
`make -f debian/rules binary`

-- 
see shy jo


signature.asc
Description: Digital signature


Re: dh 7 broken by design?

2009-02-17 Thread Ben Finney
Helmut Grohne hel...@subdivi.de writes:

 rant
 I don't get rid of the feeling that some people try to misunderstand
 me as long as possible

I can't speak for others, but my purpose on this forum is to assist
where I can and to be assisted in return. I can't see any benefit in
*trying* to misunderstand others in this forum.

Perhaps there's a language barrier involved with your communications
here; in which case, it seems far more likely that misunderstandings
are not deliberate nor wilfully maintained.

 instead of even considering there might be bugs in dh (I'm not
 saying that this is the case)

Certainly any program can have bugs, and ‘dh’ is no exception. I don't
know anyone here who would discount that possibility.

 while others (Joey, Russ) can just add valuable content.
 /rant

They certainly do. Perhaps we can all benefit from trying to emulate
the discussion styles of those whose communications we admire.

-- 
 \   “If you make people think they're thinking, they'll love you; |
  `\ but if you really make them think, they'll hate you.” —Donald |
_o__) Robert Perry Marquis |
Ben Finney


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