From a6187cce70d8f1c60e4fcaa961abc80ec5cbea86 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Tue, 21 Sep 2021 17:38:03 +0200 Subject: [PATCH] gluon-core, gluon-site: get version numbers from .config Calling git describe directly breaks isolation between the build system and packages. Replace this with proper .config variables, like we already do for GLUON_RELEASE. Also replace the PKG_VERSION hack with a static '1', as we do for other packages - while having those version numbers in opkg was cute, it was also entirely useless. Having a fixed PKG_VERSION allows us to remove the PKG_BUILD_DIR override as well. --- package/gluon-core/Makefile | 13 ++++++++----- package/gluon-site/Makefile | 14 ++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/package/gluon-core/Makefile b/package/gluon-core/Makefile index 764affb7..cba0ad3c 100644 --- a/package/gluon-core/Makefile +++ b/package/gluon-core/Makefile @@ -1,11 +1,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-core +PKG_VERSION:=1 -GLUON_VERSION = $(shell git describe --always --dirty=+ 2>/dev/null || echo unknown) -PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION)) - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) +PKG_CONFIG_DEPENDS := CONFIG_GLUON_VERSION include ../gluon.mk include $(INCLUDE_DIR)/cmake.mk @@ -22,6 +20,11 @@ define Package/gluon-core/description endef define Package/gluon-core/config +config GLUON_VERSION + string "Gluon version number" + depends on PACKAGE_gluon-core + default "" + config GLUON_MINIFY bool "Minify Gluon scripts" default y @@ -36,7 +39,7 @@ define Package/gluon-core/install $(Gluon/Build/Install) $(INSTALL_DIR) $(1)/lib/gluon - echo '$(GLUON_VERSION)' > $(1)/lib/gluon/gluon-version + echo '$(call qstrip,$(CONFIG_GLUON_VERSION))' > $(1)/lib/gluon/gluon-version endef $(eval $(call BuildPackageGluon,gluon-core)) diff --git a/package/gluon-site/Makefile b/package/gluon-site/Makefile index 9b01ec4d..d8bb6794 100644 --- a/package/gluon-site/Makefile +++ b/package/gluon-site/Makefile @@ -1,17 +1,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=gluon-site +PKG_VERSION:=1 GLUON_SITEDIR = $(call qstrip,$(CONFIG_GLUON_SITEDIR)) -GLUON_SITE_VERSION = $(shell ( cd '$(GLUON_SITEDIR)' && git --git-dir=.git describe --always --dirty=+ ) 2>/dev/null || echo unknown) -PKG_VERSION:=$(if $(DUMP),x,$(GLUON_SITE_VERSION)) -PKG_CONFIG_DEPENDS := CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR CONFIG_GLUON_MULTIDOMAIN +PKG_CONFIG_DEPENDS := CONFIG_GLUON_SITE_VERSION CONFIG_GLUON_RELEASE CONFIG_GLUON_SITEDIR CONFIG_GLUON_MULTIDOMAIN PKG_FILE_DEPENDS := $(GLUON_SITEDIR)/site.conf $(GLUON_SITEDIR)/domains/ $(GLUON_SITEDIR)/i18n/ PKG_BUILD_DEPENDS := lua-jsonc/host gluon-web/host -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - include ../gluon.mk PKG_CONFIG_DEPENDS += $(GLUON_I18N_CONFIG) @@ -21,6 +18,11 @@ define Package/gluon-site endef define Package/gluon-site/config +config GLUON_SITE_VERSION + string "Gluon site version number" + depends on PACKAGE_gluon-site + default "" + config GLUON_RELEASE string "Gluon release number" depends on PACKAGE_gluon-site @@ -83,7 +85,7 @@ define Package/gluon-site/install $(CP) $(PKG_BUILD_DIR)/domains $(1)/lib/gluon/ endif - echo '$(GLUON_SITE_VERSION)' > $(1)/lib/gluon/site-version + echo '$(call qstrip,$(CONFIG_GLUON_SITE_VERSION))' > $(1)/lib/gluon/site-version echo '$(call qstrip,$(CONFIG_GLUON_RELEASE))' > $(1)/lib/gluon/release $(GluonInstallI18N)