[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.49-97-gd829c0a
Andreas Beckmann
anbe at debian.org
Sun Feb 24 16:23:26 UTC 2013
The following commit has been merged in the develop branch:
commit b6ed47cc3244b7154bb30e01276e7237c1bfcc4c
Author: Andreas Beckmann <anbe at debian.org>
Date: Sun Feb 24 00:58:33 2013 +0100
Makefile: overhaul, install targets depend on build-stamp
Signed-off-by: Andreas Beckmann <anbe at debian.org>
diff --git a/.gitignore b/.gitignore
index 62fdc01..0d20b64 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1 @@
*.pyc
-piuparts
-piuparts.1
-piuparts.1.html
-README.html
-docbook-xsl.css
diff --git a/Makefile b/Makefile
index f30ac85..767ccaf 100644
--- a/Makefile
+++ b/Makefile
@@ -18,23 +18,58 @@ version := ${shell dpkg-parsechangelog | sed -n 's/^Version: *//p'}
endif
+# generate several scripts, conffiles, ... from templates (*.in, *.py)
+# by substituting placeholders
+SCRIPTS_TEMPLATES = $(wildcard master-bin/*.in slave-bin/*.in conf/*.in)
+SCRIPTS_PYTHON_BINARY = $(wildcard *.py)
+SCRIPTS_GENERATED = $(SCRIPTS_TEMPLATES:.in=) $(SCRIPTS_PYTHON_BINARY:.py=)
+DOCS_GENERATED = piuparts.1 piuparts.1.html README.html
+
+define placeholder_substitution
+ sed -r \
+ -e 's/__PIUPARTS_VERSION__/$(version)/g' \
+ -e 's%@sharedir@%$(sharedir)%g' \
+ $< > $@
+endef
+
+%: %.in Makefile
+ $(placeholder_substitution)
+
+%: %.py Makefile
+ $(placeholder_substitution)
+
+
all: install install-doc
-build-doc:
+python-syntax-check:
+ @set -e -x; $(foreach py,$(wildcard *.py piupartslib/*.py),python -m py_compile $(py);)
+
+build: build-stamp
+
+build-stamp: $(SCRIPTS_GENERATED) $(DOCS_GENERATED) Makefile
+ $(MAKE) python-syntax-check
+ touch $@
+
+build-doc: $(DOCS_GENERATED)
+
+README.html: README.txt
a2x --copy -a toc -a toclevels=3 -f xhtml -r /etc/asciidoc/ README.txt
+
+piuparts.1: piuparts.1.txt
a2x -f manpage piuparts.1.txt
+
+piuparts.1.html: piuparts.1.txt
a2x --copy -f xhtml piuparts.1.txt
-install-doc:
+install-doc: build-stamp
install -d $(DESTDIR)$(docdir)/
- for file in README.txt README.html docbook-xsl.css ; do \
- install -m 0644 $$file $(DESTDIR)$(docdir)/ ; done
+ install -m 0644 README.txt README.html docbook-xsl.css $(DESTDIR)$(docdir)/
install -d $(DESTDIR)$(man1dir)
install -m 0644 piuparts.1 $(DESTDIR)$(man1dir)/
gzip -9f $(DESTDIR)$(man1dir)/piuparts.1
install -m 0644 piuparts.1.html $(DESTDIR)$(docdir)/
-install-conf:
+install-conf: build-stamp
install -d $(DESTDIR)$(etcdir)/piuparts
install -m 0644 conf/piuparts.conf.sample $(DESTDIR)$(etcdir)/piuparts/piuparts.conf
@@ -50,7 +85,7 @@ install-conf:
install -d $(DESTDIR)$(etcdir)/apache2/conf.d
install -m 0644 conf/piuparts.apache $(DESTDIR)$(etcdir)/apache2/conf.d/
-install-conf-4-running-from-git:
+install-conf-4-running-from-git: build-stamp
install -d $(DESTDIR)$(etcdir)/piuparts
install -m 0644 conf/crontab-master $(DESTDIR)$(etcdir)/piuparts/
install -m 0644 conf/crontab-slave $(DESTDIR)$(etcdir)/piuparts/
@@ -59,23 +94,7 @@ install-conf-4-running-from-git:
install -d $(DESTDIR)$(sharedir)/piuparts/slave
install -m 0755 update-piuparts-setup $(DESTDIR)$(sharedir)/piuparts/slave/
-SCRIPTS_TEMPLATES = $(wildcard master-bin/*.in slave-bin/*.in conf/*.in)
-SCRIPTS_GENERATED = $(SCRIPTS_TEMPLATES:.in=)
-
-%: %.in
- sed -r \
- -e "s%@sharedir@%$(sharedir)%g" \
- $< > $@
-
-python-syntax-check:
- @set -e -x; $(foreach py,$(wildcard *.py piupartslib/*.py),python -m py_compile $(py);)
-
-build: python-syntax-check $(SCRIPTS_GENERATED)
- @set -e -x ; \
- for file in piuparts piuparts-slave piuparts-master piuparts-report piuparts-analyze; do \
- sed -e 's/__PIUPARTS_VERSION__/$(version)/g' $$file.py > $$file ; done
-
-install:
+install: build-stamp
install -d $(DESTDIR)$(sbindir)
install -m 0755 piuparts $(DESTDIR)$(sbindir)/
@@ -90,12 +109,14 @@ install:
install -d $(DESTDIR)$(sharedir)/piuparts/lib
install -m 0644 lib/*.sh $(DESTDIR)$(sharedir)/piuparts/lib/
+ # do not install the templates (*.in)
install -d $(DESTDIR)$(sharedir)/piuparts/master
install -m 0755 $(filter-out %.in,$(wildcard master-bin/*)) $(DESTDIR)$(sharedir)/piuparts/master/
install -d $(DESTDIR)$(sharedir)/piuparts/known_problems
install -m 0644 known_problems/*.conf $(DESTDIR)$(sharedir)/piuparts/known_problems/
+ # do not install the templates (*.in)
install -d $(DESTDIR)$(sharedir)/piuparts/slave
install -m 0755 $(filter-out %.in,$(wildcard slave-bin/*)) $(DESTDIR)$(sharedir)/piuparts/slave/
@@ -125,7 +146,7 @@ check:
python unittests.py
clean:
- rm -f piuparts piuparts-slave piuparts-master piuparts-report piuparts-analyze
+ rm -f build-stamp
rm -f piuparts.1 piuparts.1.xml piuparts.1.html README.xml README.html docbook-xsl.css piuparts.html
rm -f *.pyc piupartslib/*.pyc
rm -f $(SCRIPTS_GENERATED)
diff --git a/debian/changelog b/debian/changelog
index b5d41b9..5e39c0d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -37,8 +37,9 @@ piuparts (0.50) UNRELEASED; urgency=low
- Call r.dev_off() after generating a plot. (Closes: #657799)
* Makefile:
- Add DESTDIR support.
+ - Overhaul. Add dependencies between build and install targets.
+ - Add support for placeholder substitution in scripts and config.
- Perform syntax check on *.py before installation.
- - Add support for applying substitutions in master/slave scripts.
* debian/rules: Set 'prefix' and 'DESTDIR' for build and install.
* lib/read_config.sh: Factored out the piuparts.conf reading function that
is used by all master/slave shell scripts. Shipped in piuparts.common.
--
piuparts git repository
More information about the Piuparts-commits
mailing list