build: refactor build process
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Wed, 12 Sep 2018 17:41:53 +0000 (19:41 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Thu, 13 Sep 2018 06:40:01 +0000 (08:40 +0200)
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@proxmox.com>
Makefile
debian/control [new file with mode: 0644]
debian/control.in [deleted file]
debian/pve-doc-generator.control [deleted file]
debian/pve-docs-mediawiki.control [deleted file]
debian/pve-docs-mediawiki.install
debian/pve-docs.control [deleted file]
debian/rules

index 781acb28b30e28ac921821d8d036ea7cec4c5ef1..025093e41d0dd48129d2e85eea4bb0ff1de58bae 100644 (file)
--- 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 b/debian/control
new file mode 100644 (file)
index 0000000..920c4cb
--- /dev/null
@@ -0,0 +1,30 @@
+Source: pve-docs
+Section: perl
+Priority: extra
+Maintainer: Proxmox Support Team <support@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/control.in b/debian/control.in
deleted file mode 100644 (file)
index 39f4af5..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-Source: pve-docs
-Section: perl
-Priority: extra
-Maintainer: Proxmox Support Team <support@proxmox.com>
-Build-Depends: debhelper (>= 7.0.50~), lintian
-Standards-Version: 3.8.4
diff --git a/debian/pve-doc-generator.control b/debian/pve-doc-generator.control
deleted file mode 100644 (file)
index 2c73fb9..0000000
+++ /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 (file)
index 09e4b67..0000000
+++ /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.
index 41cea59f030dfa9db1a2d211865bd8121c640041..2898e75a49aebbe98a0115475f352aec10265ddc 100644 (file)
@@ -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 (file)
index 3a30f4e..0000000
+++ /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.
index 736b14ecf6ca8aa5dd9fe739d0f3797874ed9011..abe10fffb41931b69e93cacabee24c403a544634 100755 (executable)
@@ -5,3 +5,6 @@
 
 %:
        dh $@ 
+
+.PHONY: override_dh_auto_build
+override_dh_auto_build: