]> git.proxmox.com Git - proxmox-widget-toolkit.git/commitdiff
buildsys: improve resolving package meta info
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 07:47:32 +0000 (09:47 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Thu, 25 May 2023 08:13:39 +0000 (10:13 +0200)
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 <t.lamprecht@proxmox.com>
Makefile
debian/rules
src/Makefile
src/defines.mk

index b9cd2c2b7966aa9c5e08f26529ef666174dc7ab2..ecd96b849e2e638b7a0cb82f4203a92c71192b67 100644 (file)
--- 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
index 2a6e77daaef0a1144b4cb21a0e8f42690c9224aa..7932c57c60099a7994d06583286661f42d410615 100755 (executable)
@@ -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 $@
index 66167fee4995486742481e886dc26ca1c9bf5d4b..c0c99c071483b76b64432a248fba65493def0ea2 100644 (file)
@@ -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 $@
 
index c186edc5660a4801350e619e959a394750c3fcb5..36d5353534e71dc3493a3c73d00e06575d8a0015 100644 (file)
@@ -1,3 +1,5 @@
+PACKAGE ?= $(or $(DEB_SOURCE), proxmox-widget-toolkit)
+
 DESTDIR=
 DOCDIR=$(DESTDIR)/usr/share/doc/$(PACKAGE)
 WWWBASEDIR=$(DESTDIR)/usr/share/javascript/$(PACKAGE)