From d7fa9ea42b29b97b49ccc6931c93202a21c78d2a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 25 May 2023 09:47:32 +0200 Subject: [PATCH] buildsys: improve resolving package meta info use the full version for the cache invalidation technique and fall back to the commit ID and current time. With that we can drop the exports in the top-level makefile, which would only work for local direct builds anyway, but not for building from DSC source package. Signed-off-by: Thomas Lamprecht --- Makefile | 3 +-- debian/rules | 4 ++++ src/Makefile | 4 +++- src/defines.mk | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b9cd2c2..ecd96b8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ include /usr/share/dpkg/pkg-info.mk -export DEB_VERSION_UPSTREAM_REVISION -export PACKAGE=proxmox-widget-toolkit +PACKAGE=proxmox-widget-toolkit DEB=$(PACKAGE)_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb DEV_DEB=$(PACKAGE)-dev_$(DEB_VERSION_UPSTREAM_REVISION)_all.deb diff --git a/debian/rules b/debian/rules index 2a6e77d..7932c57 100755 --- a/debian/rules +++ b/debian/rules @@ -3,6 +3,10 @@ # output every command that modifies files on the build system. #DH_VERBOSE = 1 +include /usr/share/dpkg/pkg-info.mk + +export DEB_SOURCE +export DEB_VERSION %: dh $@ diff --git a/src/Makefile b/src/Makefile index 66167fe..c0c99c0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -120,9 +120,11 @@ lint: $(JSSRC) eslint --strict $(JSSRC) touch ".lint-incremental" +BUILD_TIME=$(or $(SOURCE_DATE_EPOCH),$(shell date '+%s.%N')) +BUILD_VERSION=$(or $(DEB_VERSION),$(shell git rev-parse HEAD),unknown version) proxmoxlib.js: .lint-incremental $(JSSRC) # add the version as comment in the file - echo "// $(DEB_VERSION_UPSTREAM_REVISION)" > $@.tmp + echo "// v$(BUILD_VERSION) - t$(BUILD_TIME)" > $@.tmp cat $(JSSRC) $(MARKEDJS) >> $@.tmp mv $@.tmp $@ diff --git a/src/defines.mk b/src/defines.mk index c186edc..36d5353 100644 --- a/src/defines.mk +++ b/src/defines.mk @@ -1,3 +1,5 @@ +PACKAGE ?= $(or $(DEB_SOURCE), proxmox-widget-toolkit) + DESTDIR= DOCDIR=$(DESTDIR)/usr/share/doc/$(PACKAGE) WWWBASEDIR=$(DESTDIR)/usr/share/javascript/$(PACKAGE) -- 2.39.2