[pve-devel] [PATCH docs 2/7] build: refactor build process

Fabian Grünbichler f.gruenbichler at proxmox.com
Wed Sep 12 19:41:53 CEST 2018


build packages in one go by moving individual .deb targets into install
targets called by dpkg-buildpackage.

all three binary packages are bootstrappable on a straight Debian host,
so there is no need to call dpkg-buildpackage separately for each of
them.

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
 Makefile                          | 101 +++++++++++++-----------------
 debian/control.in                 |   6 --
 debian/control                    |  30 +++++++++
 debian/pve-doc-generator.control  |   8 ---
 debian/pve-docs-mediawiki.control |   7 ---
 debian/pve-docs-mediawiki.install |   2 +-
 debian/pve-docs.control           |   6 --
 debian/rules                      |   3 +
 8 files changed, 79 insertions(+), 84 deletions(-)
 delete mode 100644 debian/control.in
 create mode 100644 debian/control
 delete mode 100644 debian/pve-doc-generator.control
 delete mode 100644 debian/pve-docs-mediawiki.control
 delete mode 100644 debian/pve-docs.control

diff --git a/Makefile b/Makefile
index 781acb2..025093e 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,6 @@ ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
 MEDIAWIKI_DEB=${MEDIAWIKI_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
-DOC_BUILDDEPS := asciidoc-dblatex, source-highlight, librsvg2-bin
 
 export SOURCE_DATE_EPOCH ?= $(shell dpkg-parsechangelog -STimestamp)
 SOURCE_DATE_HUMAN := $(shell date -d "@${SOURCE_DATE_EPOCH}")
@@ -149,73 +148,63 @@ dinstall: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
 	dpkg -i ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
 
 .PHONY: deb
-deb:
+deb: $(DOC_DEB)
+$(MEDIAWIKI_DEB) $(GEN_DEB): $(DOC_DEB)
+$(DOC_DEB):
 	rm -f ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
-	make all-debs
-
-.PHONY: all-debs
-all-debs: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
+	rm -rf build
+	rsync -a * build/
+	echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
+	cd build; dpkg-buildpackage -b -us -uc
+	lintian $(DOC_DEB) $(GEN_DEB) $(MEDIAWIKI_DEB)
 
 .PHONY: clean-build
 clean-build:
 	rm -rf build
 
-define prepare_build
-	rm -rf build-$1
-	mkdir build-$1
-	cp -a debian build-$1/debian
-	mv build-$1/debian/control.in build-$1/debian/control
-	echo >> build-$1/debian/control
-	cat debian/$1.control >> build-$1/debian/control
-	echo "git clone git://git.proxmox.com/git/pve-docs.git\\ngit checkout ${GITVERSION}" > build-$1/debian/SOURCE
-	install -dm755 build-$1/usr/share/$1
-	install -dm755 build-$1/usr/share/doc/$1
-endef
-
-.PHONY: gen-deb
-gen-deb: $(GEN_DEB)
-$(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
-	$(call prepare_build,$(GEN_PACKAGE))
-	install -dm755 build-$(GEN_PACKAGE)/usr/bin
+.PHONY: install
+install: gen-install doc-install mediawiki-install
+
+.PHONY: gen-install
+gen-install: $(GEN_DEB_SOURCES) asciidoc-pve asciidoc/mediawiki.conf
+	install -dm755 $(DESTDIR)/usr/share/$(GEN_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/share/doc/$(GEN_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/bin
 	# install files
-	install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
-	install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}
+	install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
+	install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
 	# install asciidoc-pve
-	install -m 0755 asciidoc-pve build-$(GEN_PACKAGE)/usr/bin/
-	install -D -m 0644 asciidoc/mediawiki.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
-	install -m 0644 asciidoc/asciidoc-pve.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
-	install -m 0644 asciidoc/pve-html.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
-	cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
-	lintian ${GEN_DEB}
-
-.PHONY: doc-deb
-doc-deb: $(DOC_DEB)
-$(DOC_DEB): index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images
-	$(call prepare_build,$(DOC_PACKAGE))
-	sed -i -e '/^Build-Depends/{s/$$/, $(DOC_BUILDDEPS)/}' build-$(DOC_PACKAGE)/debian/control
+	install -m 0755 asciidoc-pve $(DESTDIR)/usr/bin/
+	install -D -m 0644 asciidoc/mediawiki.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/mediawiki.conf
+	install -m 0644 asciidoc/asciidoc-pve.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
+	install -m 0644 asciidoc/pve-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
+
+.PHONY: doc-install
+doc-install: index.html $(WIKI_IMPORTS) $(API_VIEWER_SOURCES) verify-images
+	install -dm755 $(DESTDIR)/usr/share/$(DOC_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/share/doc/$(DOC_PACKAGE)
 	# install files for pvedocs package
-	install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
-	install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE}
-	install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
-	install -m 0644 ${WIKI_IMPORTS} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}
+	install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}
+	install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
+	install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
+	install -m 0644 ${WIKI_IMPORTS} $(DESTDIR)/usr/share/${DOC_PACKAGE}
 	# install images
-	make -C images DESTDIR=../build-$(DOC_PACKAGE) install
+	make -C images install
 	# install screenshot images
-	install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
-	install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot
+	install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
+	install -m 0644 images/screenshot/*.png $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
 	# install api doc viewer
-	install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
-	install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer
-	cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
-	lintian ${DOC_DEB}
-
-.PHONY: mediawiki-deb
-mediawiki-deb: $(MEDIAWIKI_DEB)
-$(MEDIAWIKI_DEB): pve-docs-mediawiki-import
-	$(call prepare_build,$(MEDIAWIKI_PACKAGE))
-	cp pve-docs-mediawiki-import build-$(MEDIAWIKI_PACKAGE)/debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import
-	cd build-$(MEDIAWIKI_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
-	lintian ${MEDIAWIKI_DEB}
+	install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
+	install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
+
+.PHONY: mediawiki-install
+mediawiki-install: pve-docs-mediawiki-import
+	install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/bin
+	install -dm755 $(DESTDIR)/usr/share/$(MEDIAWIKI_PACKAGE)
+	install -dm755 $(DESTDIR)/usr/share/doc/$(MEDIAWIKI_PACKAGE)
+	install -m 0755 pve-docs-mediawiki-import $(DESTDIR)/usr/bin/
 
 .PHONY: upload
 upload: ${GEN_DEB} ${DOC_DEB} ${MEDIAWIKI_DEB}
diff --git a/debian/control.in b/debian/control.in
deleted file mode 100644
index 39f4af5..0000000
--- a/debian/control.in
+++ /dev/null
@@ -1,6 +0,0 @@
-Source: pve-docs
-Section: perl
-Priority: extra
-Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: debhelper (>= 7.0.50~), lintian
-Standards-Version: 3.8.4
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..920c4cb
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,30 @@
+Source: pve-docs
+Section: perl
+Priority: extra
+Maintainer: Proxmox Support Team <support at proxmox.com>
+Build-Depends: debhelper (>= 7.0.50~), lintian, asciidoc-dblatex, source-highlight, librsvg2-bin, graphviz
+Standards-Version: 3.8.4
+
+Package: pve-docs
+Section: doc
+Depends: libjs-extjs
+Architecture: all
+Description: Proxmox VE Documentation
+ This package contains the Proxmox VE Documentation files.
+
+Package: pve-doc-generator
+Section: perl
+Architecture: any
+Depends: ${perl:Depends}, libpve-common-perl, asciidoc-dblatex, source-highlight, xmlto
+Description: Proxmox VE Documentation helpers
+ Tool to auto-generate various Proxmox VE Documentation files and
+ manual pages. This package is required to build most other Proxmox VE
+ packages.
+
+Package: pve-docs-mediawiki
+Architecture: all
+Section: doc
+Depends: ${misc:Depends}, pve-docs, libhtml-parser-perl
+Suggests: apache2
+Description: Proxmox VE Documentation - mediawiki plugin
+ This package contains tools to view Proxmox VE Documentation with mediakiki.
diff --git a/debian/pve-doc-generator.control b/debian/pve-doc-generator.control
deleted file mode 100644
index 2c73fb9..0000000
--- a/debian/pve-doc-generator.control
+++ /dev/null
@@ -1,8 +0,0 @@
-Package: pve-doc-generator
-Section: perl
-Architecture: any
-Depends: ${perl:Depends}, libpve-common-perl, asciidoc-dblatex, source-highlight, xmlto
-Description: Proxmox VE Documentation helpers
- Tool to auto-generate various Proxmox VE Documentation files and
- manual pages. This package is required to build most other Proxmox VE
- packages.
diff --git a/debian/pve-docs-mediawiki.control b/debian/pve-docs-mediawiki.control
deleted file mode 100644
index 09e4b67..0000000
--- a/debian/pve-docs-mediawiki.control
+++ /dev/null
@@ -1,7 +0,0 @@
-Package: pve-docs-mediawiki
-Architecture: all
-Section: doc
-Depends: ${misc:Depends}, pve-docs, libhtml-parser-perl
-Suggests: apache2
-Description: Proxmox VE Documentation - mediawiki plugin
- This package contains tools to view Proxmox VE Documentation with mediakiki.
diff --git a/debian/pve-docs-mediawiki.install b/debian/pve-docs-mediawiki.install
index 41cea59..2898e75 100644
--- a/debian/pve-docs-mediawiki.install
+++ b/debian/pve-docs-mediawiki.install
@@ -1,3 +1,3 @@
 debian/tree/pve-docs-mediawiki/pvedocs-include.php /usr/lib/pve-docs/
-debian/tree/pve-docs-mediawiki/pve-docs-mediawiki-import /usr/bin/
+/usr/bin/pve-docs-mediawiki-import
 debian/tree/pve-docs-mediawiki/pve-docs.conf /etc/apache2/sites-available/
diff --git a/debian/pve-docs.control b/debian/pve-docs.control
deleted file mode 100644
index 3a30f4e..0000000
--- a/debian/pve-docs.control
+++ /dev/null
@@ -1,6 +0,0 @@
-Package: pve-docs
-Section: doc
-Depends: libjs-extjs
-Architecture: all
-Description: Proxmox VE Documentation
- This package contains the Proxmox VE Documentation files.
diff --git a/debian/rules b/debian/rules
index 736b14e..abe10ff 100755
--- a/debian/rules
+++ b/debian/rules
@@ -5,3 +5,6 @@
 
 %:
 	dh $@ 
+
+.PHONY: override_dh_auto_build
+override_dh_auto_build:
-- 
2.18.0





More information about the pve-devel mailing list