Patchwork [V2,evolve-ext] debian: clean up rules file

login
register
mail settings
Submitter Faheem Mitha
Date Aug. 16, 2014, 10:35 p.m.
Message ID <7568048c9776085be3af.1408228513@orwell.homelinux.org>
Download mbox | patch
Permalink /patch/5456/
State Not Applicable
Headers show

Comments

Faheem Mitha - Aug. 16, 2014, 10:35 p.m.
# HG changeset patch
# User Faheem Mitha <faheem@faheem.info>
# Date 1408227240 -19800
#      Sun Aug 17 03:44:00 2014 +0530
# Branch stable
# Node ID 7568048c9776085be3af4cc05668a57664c08bcd
# Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
debian: clean up rules file

* Add DH_VERBOSE, commented out, for debugging convenience.

* Remove clean target before implicit match rule. This is redundant
  because it is a match-everything rule. Possibly a typo.

* Replace build line with a dh_override_auto_build line. This is more
  in line with how dh is supposed to work. In particular,
  dh_auto_build is functionally equivalent to the repeated "dh build
  --with python2 --buildsystem=python_distutils" used currently.

* Similarly, replace clean with override_dh_auto_clean. The current
  version does not call the default dh_auto_build, which is a bug.
  This is required in particular for cleaning the build directories.

* Remove .PHONY line completely. This does not work in the case of
  implicit pattern matching rules as used by dh. Consider this example
  from Dr. Geoffrey Thomas:

      faheem@orwell:/tmp/test$ ls -l
      total 16
      -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 blue.c
      -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 green.c
      -rw-r--r-- 1 faheem faheem 35 Aug 16 20:26 Makefile
      -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 red.c
      faheem@orwell:/tmp/test$ cat Makefile
      %: %.c
              gcc -o $@ $<
      .PHONY: blue

      faheem@orwell:/tmp/test$ make red
      gcc -o red red.c
      faheem@orwell:/tmp/test$ make green
      gcc -o green green.c
      faheem@orwell:/tmp/test$ make blue
      make: Nothing to be done for blue'.

  The Make manual
  (http://www.gnu.org/software/make/manual/make.html#Phony-Targets) says

      Since it knows that phony targets do not name actual files that
      could be remade from other files, make skips the implicit rule
      search for phony targets (see Implicit Rules).

Thanks to the good folks on #debian-mentors on OFTC for instruction
and explanation in these matters.
Pierre-Yves David - Sept. 2, 2014, 7:10 p.m.
On 08/17/2014 12:35 AM, Faheem Mitha wrote:
> # HG changeset patch
> # User Faheem Mitha <faheem@faheem.info>
> # Date 1408227240 -19800
> #      Sun Aug 17 03:44:00 2014 +0530
> # Branch stable
> # Node ID 7568048c9776085be3af4cc05668a57664c08bcd
> # Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
> debian: clean up rules file

Can I get this as a series with each change in its own patches?

>
> * Add DH_VERBOSE, commented out, for debugging convenience.
>
> * Remove clean target before implicit match rule. This is redundant
>    because it is a match-everything rule. Possibly a typo.
>
> * Replace build line with a dh_override_auto_build line. This is more
>    in line with how dh is supposed to work. In particular,
>    dh_auto_build is functionally equivalent to the repeated "dh build
>    --with python2 --buildsystem=python_distutils" used currently.
>
> * Similarly, replace clean with override_dh_auto_clean. The current
>    version does not call the default dh_auto_build, which is a bug.
>    This is required in particular for cleaning the build directories.
>
> * Remove .PHONY line completely. This does not work in the case of
>    implicit pattern matching rules as used by dh. Consider this example
>    from Dr. Geoffrey Thomas:
>
>        faheem@orwell:/tmp/test$ ls -l
>        total 16
>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 blue.c
>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 green.c
>        -rw-r--r-- 1 faheem faheem 35 Aug 16 20:26 Makefile
>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 red.c
>        faheem@orwell:/tmp/test$ cat Makefile
>        %: %.c
>                gcc -o $@ $<
>        .PHONY: blue
>
>        faheem@orwell:/tmp/test$ make red
>        gcc -o red red.c
>        faheem@orwell:/tmp/test$ make green
>        gcc -o green green.c
>        faheem@orwell:/tmp/test$ make blue
>        make: Nothing to be done for blue'.
>
>    The Make manual
>    (http://www.gnu.org/software/make/manual/make.html#Phony-Targets) says
>
>        Since it knows that phony targets do not name actual files that
>        could be remade from other files, make skips the implicit rule
>        search for phony targets (see Implicit Rules).
>
> Thanks to the good folks on #debian-mentors on OFTC for instruction
> and explanation in these matters.
>
> diff -r f3867e60d072 -r 7568048c9776 debian/rules
> --- a/debian/rules
> +++ b/debian/rules
> @@ -1,10 +1,11 @@
>   #!/usr/bin/make -f
> +#export DH_VERBOSE=1
>
> -clean %:
> +%:
>   	dh $@ --with python2 --buildsystem=python_distutils
>
> -build:
> -	dh build --with python2 --buildsystem=python_distutils
> +override_dh_auto_build:
> +	dh_auto_build
>   	$(MAKE) -C docs
>
>   ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
> @@ -17,12 +18,11 @@
>   	find debian -name __init__.py -delete
>   	dh_python2
>
> -clean: clean-docs
> +override_dh_auto_clean: clean-docs
> +	dh_auto_clean
>   	rm -f tests/*.err
>
>   clean-docs:
>   	rm -rf html
>   	rm -f docs/static/logo-evolve.ico
>   	rm -f docs/tutorials/tutorial.rst
> -
> -.PHONY: build clean clean-docs
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
Faheem Mitha - Sept. 2, 2014, 7:25 p.m.
Hi Pierre-Yves,

See below.

On Tue, 2 Sep 2014, Pierre-Yves David wrote:

>
>
> On 08/17/2014 12:35 AM, Faheem Mitha wrote:
>> # HG changeset patch
>> # User Faheem Mitha <faheem@faheem.info>
>> # Date 1408227240 -19800
>> #      Sun Aug 17 03:44:00 2014 +0530
>> # Branch stable
>> # Node ID 7568048c9776085be3af4cc05668a57664c08bcd
>> # Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
>> debian: clean up rules file
>
> Can I get this as a series with each change in its own patches?

Ok. You want each of the 4 items below in their own patch?

>> * Add DH_VERBOSE, commented out, for debugging convenience.
>>
>> * Remove clean target before implicit match rule. This is redundant
>>    because it is a match-everything rule. Possibly a typo.
>>
>> * Replace build line with a dh_override_auto_build line. This is more
>>    in line with how dh is supposed to work. In particular,
>>    dh_auto_build is functionally equivalent to the repeated "dh build
>>    --with python2 --buildsystem=python_distutils" used currently.
>>
>> * Similarly, replace clean with override_dh_auto_clean. The current
>>    version does not call the default dh_auto_build, which is a bug.
>>    This is required in particular for cleaning the build directories.
>>
>> * Remove .PHONY line completely. This does not work in the case of
>>    implicit pattern matching rules as used by dh. Consider this example
>>    from Dr. Geoffrey Thomas:
>>
>>        faheem@orwell:/tmp/test$ ls -l
>>        total 16
>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 blue.c
>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 green.c
>>        -rw-r--r-- 1 faheem faheem 35 Aug 16 20:26 Makefile
>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 red.c
>>        faheem@orwell:/tmp/test$ cat Makefile
>>        %: %.c
>>                gcc -o $@ $<
>>        .PHONY: blue
>>
>>        faheem@orwell:/tmp/test$ make red
>>        gcc -o red red.c
>>        faheem@orwell:/tmp/test$ make green
>>        gcc -o green green.c
>>        faheem@orwell:/tmp/test$ make blue
>>        make: Nothing to be done for blue'.
>>
>>    The Make manual
>>    (http://www.gnu.org/software/make/manual/make.html#Phony-Targets) says
>>
>>        Since it knows that phony targets do not name actual files that
>>        could be remade from other files, make skips the implicit rule
>>        search for phony targets (see Implicit Rules).
>>
>> Thanks to the good folks on #debian-mentors on OFTC for instruction
>> and explanation in these matters.

[snip]

                                                                 Faheem
Pierre-Yves David - Sept. 3, 2014, 7:31 a.m.
On 09/02/2014 09:25 PM, Faheem Mitha wrote:
>
> Hi Pierre-Yves,
>
> See below.
>
> On Tue, 2 Sep 2014, Pierre-Yves David wrote:
>
>>
>>
>> On 08/17/2014 12:35 AM, Faheem Mitha wrote:
>>> # HG changeset patch
>>> # User Faheem Mitha <faheem@faheem.info>
>>> # Date 1408227240 -19800
>>> #      Sun Aug 17 03:44:00 2014 +0530
>>> # Branch stable
>>> # Node ID 7568048c9776085be3af4cc05668a57664c08bcd
>>> # Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
>>> debian: clean up rules file
>>
>> Can I get this as a series with each change in its own patches?
>
> Ok. You want each of the 4 items below in their own patch?

Yes, they looks like independent changes, don't they?

>
>>> * Add DH_VERBOSE, commented out, for debugging convenience.
>>>
>>> * Remove clean target before implicit match rule. This is redundant
>>>    because it is a match-everything rule. Possibly a typo.
>>>
>>> * Replace build line with a dh_override_auto_build line. This is more
>>>    in line with how dh is supposed to work. In particular,
>>>    dh_auto_build is functionally equivalent to the repeated "dh build
>>>    --with python2 --buildsystem=python_distutils" used currently.
>>>
>>> * Similarly, replace clean with override_dh_auto_clean. The current
>>>    version does not call the default dh_auto_build, which is a bug.
>>>    This is required in particular for cleaning the build directories.
>>>
>>> * Remove .PHONY line completely. This does not work in the case of
>>>    implicit pattern matching rules as used by dh. Consider this example
>>>    from Dr. Geoffrey Thomas:
>>>
>>>        faheem@orwell:/tmp/test$ ls -l
>>>        total 16
>>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 blue.c
>>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 green.c
>>>        -rw-r--r-- 1 faheem faheem 35 Aug 16 20:26 Makefile
>>>        -rw-r--r-- 1 faheem faheem 17 Aug 16 20:27 red.c
>>>        faheem@orwell:/tmp/test$ cat Makefile
>>>        %: %.c
>>>                gcc -o $@ $<
>>>        .PHONY: blue
>>>
>>>        faheem@orwell:/tmp/test$ make red
>>>        gcc -o red red.c
>>>        faheem@orwell:/tmp/test$ make green
>>>        gcc -o green green.c
>>>        faheem@orwell:/tmp/test$ make blue
>>>        make: Nothing to be done for blue'.
>>>
>>>    The Make manual
>>>    (http://www.gnu.org/software/make/manual/make.html#Phony-Targets)
>>> says
>>>
>>>        Since it knows that phony targets do not name actual files that
>>>        could be remade from other files, make skips the implicit rule
>>>        search for phony targets (see Implicit Rules).
>>>
>>> Thanks to the good folks on #debian-mentors on OFTC for instruction
>>> and explanation in these matters.
>
> [snip]
>
>                                                                  Faheem
Faheem Mitha - Oct. 10, 2014, 11:48 p.m.
On Wed, 3 Sep 2014, Pierre-Yves David wrote:

> On 09/02/2014 09:25 PM, Faheem Mitha wrote:

>> On Tue, 2 Sep 2014, Pierre-Yves David wrote:

>>> On 08/17/2014 12:35 AM, Faheem Mitha wrote:
>>>> # HG changeset patch
>>>> # User Faheem Mitha <faheem@faheem.info>
>>>> # Date 1408227240 -19800
>>>> #      Sun Aug 17 03:44:00 2014 +0530
>>>> # Branch stable
>>>> # Node ID 7568048c9776085be3af4cc05668a57664c08bcd
>>>> # Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
>>>> debian: clean up rules file

>>> Can I get this as a series with each change in its own patches?

>> Ok. You want each of the 4 items below in their own patch?

> Yes, they looks like independent changes, don't they?

Finally submitted, as a series of 5 different patches. Please use V2.

                                                       Thanks, Faheem

Patch

diff -r f3867e60d072 -r 7568048c9776 debian/rules
--- a/debian/rules
+++ b/debian/rules
@@ -1,10 +1,11 @@ 
 #!/usr/bin/make -f
+#export DH_VERBOSE=1
 
-clean %:
+%:
 	dh $@ --with python2 --buildsystem=python_distutils
 
-build:
-	dh build --with python2 --buildsystem=python_distutils
+override_dh_auto_build:
+	dh_auto_build
 	$(MAKE) -C docs
 
 ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
@@ -17,12 +18,11 @@ 
 	find debian -name __init__.py -delete
 	dh_python2
 
-clean: clean-docs
+override_dh_auto_clean: clean-docs
+	dh_auto_clean
 	rm -f tests/*.err
 
 clean-docs:
 	rm -rf html
 	rm -f docs/static/logo-evolve.ico
 	rm -f docs/tutorials/tutorial.rst
-
-.PHONY: build clean clean-docs