bsys: refactor build process

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@proxmox.com>
This commit is contained in:
Stoiko Ivanov 2019-02-27 20:37:26 +01:00 committed by Dietmar Maurer
parent 9dd45bd776
commit 1a8e71a93b
6 changed files with 60 additions and 64 deletions

View File

@ -7,11 +7,12 @@ DOC_PACKAGE=pmg-docs
# also update debian/changelog # also update debian/changelog
PKGREL=4 PKGREL=4
GITVERSION:=$(shell git rev-parse HEAD)
ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH) ARCH:=$(shell dpkg-architecture -qDEB_BUILD_ARCH)
GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb GEN_DEB=${GEN_PACKAGE}_${DOCRELEASE}-${PKGREL}_${ARCH}.deb
DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb DOC_DEB=${DOC_PACKAGE}_${DOCRELEASE}-${PKGREL}_all.deb
DOC_BUILDDEPS := dblatex, source-highlight, imagemagick, librsvg2-bin
all: index.html 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 cat pmg-doc-generator.mk.in .pmg-doc-depends > $@.tmp
mv $@.tmp $@ mv $@.tmp $@
include ./pmg-doc-generator.mk -include ./pmg-doc-generator.mk
GEN_DEB_SOURCES= \ GEN_DEB_SOURCES= \
pmg-doc-generator.mk \ pmg-doc-generator.mk \
@ -128,61 +129,50 @@ dinstall: ${GEN_DEB} ${DOC_DEB}
dpkg -i ${GEN_DEB} ${DOC_DEB} dpkg -i ${GEN_DEB} ${DOC_DEB}
.PHONY: deb .PHONY: deb
deb: deb: ${DOC_DEB}
rm -f ${GEN_DEB} ${DOC_DEB}
make all-debs
.PHONY: all-debs ${GEN_DEB}: ${DOC_DEB}
all-debs: ${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 .PHONY: clean-build
clean-build: clean-build:
rm -rf build rm -rf build
define prepare_build .PHONY: install
rm -rf build-$1 install: gen-install doc-install
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 .PHONY: gen-install
gen-deb: $(GEN_DEB) gen-install: $(GEN_DEB_SOURCES) asciidoc-pmg
$(GEN_DEB): $(GEN_DEB_SOURCES) asciidoc-pmg install -dm755 ${DESTDIR}/usr/bin
$(call prepare_build,$(GEN_PACKAGE)) install -dm755 $(DESTDIR)/usr/share/${GEN_PACKAGE}
install -dm755 build-$(GEN_PACKAGE)/usr/bin
# install files # install files
install -m 0644 ${GEN_DEB_SOURCES} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} install -m 0644 ${GEN_DEB_SOURCES} $(DESTDIR)/usr/share/${GEN_PACKAGE}
install -m 0755 ${GEN_SCRIPTS} build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE} install -m 0755 ${GEN_SCRIPTS} $(DESTDIR)/usr/share/${GEN_PACKAGE}
# install asciidoc-pmg # install asciidoc-pmg
install -m 0755 asciidoc-pmg build-$(GEN_PACKAGE)/usr/bin/ install -m 0755 asciidoc-pmg $(DESTDIR)/usr/bin/
install -dm755 build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ install -dm755 $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
install -m 0644 asciidoc/asciidoc-pmg.conf build-$(GEN_PACKAGE)/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 build-$(GEN_PACKAGE)/usr/share/${GEN_PACKAGE}/asciidoc/ install -m 0644 asciidoc/pmg-html.conf $(DESTDIR)/usr/share/${GEN_PACKAGE}/asciidoc/
cd build-$(GEN_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
lintian ${GEN_DEB}
.PHONY: doc-deb .PHONY: doc-install
doc-deb: $(DOC_DEB) doc-install: index.html $(API_VIEWER_SOURCES) verify-images
$(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 files for pmgdocs package # install files for pmgdocs package
install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}
install -dm755 build-$(DOC_PACKAGE)/usr/share/doc/${DOC_PACKAGE} install -dm755 $(DESTDIR)/usr/share/doc/${DOC_PACKAGE}
install -m 0644 index.html ${INDEX_INCLUDES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE} install -m 0644 index.html ${INDEX_INCLUDES} $(DESTDIR)/usr/share/${DOC_PACKAGE}
# install screenshot images # install screenshot images
install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
install -m 0644 images/screenshot/*.png build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/images/screenshot install -m 0644 images/screenshot/*.png $(DESTDIR)/usr/share/${DOC_PACKAGE}/images/screenshot
# install api doc viewer # install api doc viewer
install -dm755 build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer install -dm755 $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
install -m 0644 ${API_VIEWER_SOURCES} build-$(DOC_PACKAGE)/usr/share/${DOC_PACKAGE}/api-viewer install -m 0644 ${API_VIEWER_SOURCES} $(DESTDIR)/usr/share/${DOC_PACKAGE}/api-viewer
cd build-$(DOC_PACKAGE) && dpkg-buildpackage -rfakeroot -b -us -uc
lintian ${DOC_DEB}
.PHONY: upload .PHONY: upload
upload: ${GEN_DEB} ${DOC_DEB} 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 -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 -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 -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*

22
debian/control vendored Normal file
View File

@ -0,0 +1,22 @@
Source: pmg-docs
Section: perl
Priority: extra
Maintainer: Proxmox Support Team <support@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.

6
debian/control.in vendored
View File

@ -1,6 +0,0 @@
Source: pmg-docs
Section: perl
Priority: extra
Maintainer: Proxmox Support Team <support@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

View File

@ -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.

View File

@ -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.

3
debian/rules vendored
View File

@ -5,3 +5,6 @@
%: %:
dh $@ dh $@
.PHONY: override_dh_auto_build
override_dh_auto_build: