Patchwork [evolve-ext] debian: clean up rule file

login
register
mail settings
Submitter Faheem Mitha
Date Aug. 16, 2014, 3:49 p.m.
Message ID <8c265df790d9f17ced40.1408204168@orwell.homelinux.org>
Download mbox | patch
Permalink /patch/5452/
State Changes Requested
Headers show

Comments

Faheem Mitha - Aug. 16, 2014, 3:49 p.m.
# HG changeset patch
# User Faheem Mitha <faheem@faheem.info>
# Date 1408203573 -19800
#      Sat Aug 16 21:09:33 2014 +0530
# Branch stable
# Node ID 8c265df790d9f17ced403b95920d06ad60db6ee3
# Parent  f3867e60d0720f3f842f631317fa1cbb2ef3b5a4
debian: clean up rule 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.

Patch

diff -r f3867e60d072 -r 8c265df790d9 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
+dh_override_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