]> git.proxmox.com Git - proxmox-archive-keyring.git/commitdiff
buildsys: make build-dir generation atomic
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 15:02:47 +0000 (17:02 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 15:02:47 +0000 (17:02 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Makefile

index 3e618ccae77b775ba350496f940f54815010b82e..2e3add11e815545dea4dda164a5ad17ac1784f8f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,22 +1,24 @@
 include /usr/share/dpkg/pkg-info.mk
 
 PACKAGE=proxmox-archive-keyring
+BUILDDIR=$(PACKAGE)-$(DEB_VERSION_UPSTREAM)
 
 GITVERSION:=$(shell git rev-parse HEAD)
 
 DEB=$(PACKAGE)_$(DEB_VERSION)_all.deb
 
-BUILD_DIR=build
-
 all: deb
-deb: $(DEB)
 
-$(DEB): debian
-       rm -rf $(BUILD_DIR)
-       mkdir -p $(BUILD_DIR)/debian
-       cp -ar debian/* $(BUILD_DIR)/debian/
-       echo "git clone git://git.proxmox.com/git/proxmox-archive-keyring.git\\ngit checkout $(GITVERSION)" > $(BUILD_DIR)/debian/SOURCE
-       cd $(BUILD_DIR); dpkg-buildpackage -b -uc -us
+$(BUILDDIR):
+       rm -rf $@ $@.tmp
+       mkdir -p $@.tmp/debian
+       cp -ar debian/* $@.tmp/debian/
+       echo "git clone git://git.proxmox.com/git/proxmox-archive-keyring.git\\ngit checkout $(GITVERSION)" > $@.tmp/debian/SOURCE
+       mv $@.tmp $@
+
+deb: $(DEB)
+$(DEB): $(BUILDDIR)
+       cd $(BUILDDIR); dpkg-buildpackage -b -uc -us
        lintian $(DEB)
 
 .PHONY: upload
@@ -28,4 +30,5 @@ distclean: clean
 
 .PHONY: clean
 clean:
-       rm -rf *~ $(BUILD_DIR) *.deb *.dsc *.changes *.buildinfo
+       rm -rf $(PACKAGE)-[0-9]*/
+       rm -f $(PACKAGE)*.tar* *.deb *.dsc *.changes *.build *.buildinfo