[pmg-devel] [PATCH pmg-docs 1/8] bsys: refactor build process

Stoiko Ivanov s.ivanov at proxmox.com
Wed Feb 27 20:37:26 CET 2019


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

ported from pve-docs:fa764571f6a0c5bfc62ee1cda6bffcfae40e9ec9
and pve-docs:60955877b11cde0865a258ece040bd124fb07bdc

Additionally I added the fixups from Thomas in
pve-docs:2d11c86883c4b1150afcc97eedfbf1b2a07de105
pve-docs:fd880d44c7d3876add7acd659641668bfa09c71b

Signed-off-by: Stoiko Ivanov <s.ivanov at proxmox.com>
---
 Makefile                         | 84 ++++++++++++++++++----------------------
 debian/control                   | 22 +++++++++++
 debian/control.in                |  6 ---
 debian/pmg-doc-generator.control |  8 ----
 debian/pmg-docs.control          |  5 ---
 debian/rules                     |  3 ++
 6 files changed, 62 insertions(+), 66 deletions(-)
 create mode 100644 debian/control
 delete mode 100644 debian/control.in
 delete mode 100644 debian/pmg-doc-generator.control
 delete mode 100644 debian/pmg-docs.control

diff --git a/Makefile b/Makefile
index c3548ba..fd011e7 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,12 @@ DOC_PACKAGE=pmg-docs
 # also update debian/changelog
 PKGREL=4
 
+GITVERSION:=$(shell git rev-parse HEAD)
+
 ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
 GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
 DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
-DOC_BUILDDEPS := dblatex, source-highlight, imagemagick, librsvg2-bin
 
 
 all: index.html
@@ -30,7 +31,7 @@ pmg-doc-generator.mk: .pmg-doc-depends pmg-doc-generator.mk.in
 	cat pmg-doc-generator.mk.in .pmg-doc-depends > $@.tmp
 	mv $@.tmp $@
 
-include ./pmg-doc-generator.mk
+-include ./pmg-doc-generator.mk
 
 GEN_DEB_SOURCES=				\
 	pmg-doc-generator.mk			\
@@ -128,61 +129,50 @@ dinstall: ${GEN_DEB} ${DOC_DEB}
 	dpkg -i ${GEN_DEB} ${DOC_DEB}
 
 .PHONY: deb
-deb:
-	rm -f ${GEN_DEB} ${DOC_DEB}
-	make all-debs
+deb: ${DOC_DEB}
 
-.PHONY: all-debs
-all-debs: ${GEN_DEB} ${DOC_DEB}
+${GEN_DEB}: ${DOC_DEB}
+
+${DOC_DEB}:
+	rm -f ${GEN_DEB} ${DOC_DEB}
+	rm -rf build
+	rsync -a * build/
+	echo "git clone git://git.proxmox.com/git/pmg-docs.git\\ngit checkout ${GITVERSION}" > build/debian/SOURCE
+	cd build; dpkg-buildpackage -b -us -uc
+	lintian $(DOC_DEB) $(GEN_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
-	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-pmg
-	$(call prepare_build,$(GEN_PACKAGE))
-	install -dm755 build-$(GEN_PACKAGE)/usr/bin
+.PHONY: install
+install: gen-install doc-install
+
+.PHONY: gen-install
+gen-install: $(GEN_DEB_SOURCES) asciidoc-pmg
+	install -dm755 ${DESTDIR}/usr/bin
+	install -dm755 $(DESTDIR)/usr/share/${GEN_PACKAGE}
 	# 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-pmg
-	install -m 0755 asciidoc-pmg build-$(GEN_PACKAGE)/usr/bin/
-	install -dm755 build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
-	install -m 0644 asciidoc/asciidoc-pmg.conf build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/
-	install -m 0644 asciidoc/pmg-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 $(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-pmg $(DESTDIR)/usr/bin/
+	install -dm755 $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
+	install -m 0644 asciidoc/asciidoc-pmg.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
+	install -m 0644 asciidoc/pmg-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
+
+.PHONY: doc-install
+doc-install: index.html $(API_VIEWER_SOURCES) verify-images
 	# install files for pmgdocs 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 -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 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}
+	install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
+	install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
 
 .PHONY: upload
 upload: ${GEN_DEB} ${DOC_DEB}
@@ -201,4 +191,4 @@ clean:
 	rm -f api-viewer/apidoc.js chapter-*.html *-plain.html chapter-*.html pmg-admin-guide.chunked asciidoc-pmg link-refs.json .asciidoc-pmg-tmp_* pmg-smtp-filter.8-synopsis.adoc pmgpolicy.8-synopsis.adoc pmgsh.1-synopsis.adoc
 	rm -rf .pmg-doc-depends 
 	rm -f pmg-doc-generator.mk chapter-index-table.adoc man1-index-table.adoc man5-index-table.adoc man8-index-table.adoc pmg-admin-guide-docinfo.xml
-	rm -rf build-*
+	rm -rf build*
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..9c9253b
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,22 @@
+Source: pmg-docs
+Section: perl
+Priority: extra
+Maintainer: Proxmox Support Team <support at proxmox.com>
+Build-Depends: asciidoc-dblatex, debhelper (>= 9~), libdbi-perl, libfile-sync-perl, liblockfile-simple-perl, libmime-tools-perl, libnet-ldap-perl, librrds-perl, lintian
+Standards-Version: 3.8.4
+
+
+Package: pmg-doc-generator
+Section: perl
+Architecture: any
+Depends: ${perl:Depends}, libpve-common-perl, asciidoc-base, xmlto
+Description: Proxmox Mail Gateway Documentation helpers
+ Tool to auto-generate various Proxmox Mail gateway Documentation files and
+ manual pages. This package is required to build most other Proxmox Mail
+ Gateway packages.
+
+Package: pmg-docs
+Section: doc
+Architecture: all
+Description: Proxmox Mail Gateway Documentation
+ This package contains the Proxmox Mail Gateway documentation files.
diff --git a/debian/control.in b/debian/control.in
deleted file mode 100644
index 76e3f3c..0000000
--- a/debian/control.in
+++ /dev/null
@@ -1,6 +0,0 @@
-Source: pmg-docs
-Section: perl
-Priority: extra
-Maintainer: Proxmox Support Team <support at proxmox.com>
-Build-Depends: asciidoc-dblatex, debhelper (>= 9~), libdbi-perl, libfile-sync-perl, liblockfile-simple-perl, libmime-tools-perl, libnet-ldap-perl, librrds-perl, lintian
-Standards-Version: 3.8.4
diff --git a/debian/pmg-doc-generator.control b/debian/pmg-doc-generator.control
deleted file mode 100644
index 1c5b450..0000000
--- a/debian/pmg-doc-generator.control
+++ /dev/null
@@ -1,8 +0,0 @@
-Package: pmg-doc-generator
-Section: perl
-Architecture: any
-Depends: ${perl:Depends}, libpve-common-perl, asciidoc-base, xmlto
-Description: Proxmox Mail Gateway Documentation helpers
- Tool to auto-generate various Proxmox Mail gateway Documentation files and
- manual pages. This package is required to build most other Proxmox Mail
- Gateway packages.
diff --git a/debian/pmg-docs.control b/debian/pmg-docs.control
deleted file mode 100644
index 3608e49..0000000
--- a/debian/pmg-docs.control
+++ /dev/null
@@ -1,5 +0,0 @@
-Package: pmg-docs
-Section: doc
-Architecture: all
-Description: Proxmox Mail Gateway Documentation
- This package contains the Proxmox Mail Gateway 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.11.0




More information about the pmg-devel mailing list