Merge pull request #2316 from freifunk-gluon/gluon-version

Clean up Gluon version number handling, allow .scmversion override
This commit is contained in:
Matthias Schiffer 2021-10-09 13:14:50 +02:00 committed by GitHub
commit f910cab618
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 50 additions and 88 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@
.bash_history
.subversion
.wget-hsts
/.scmversion

View File

@ -52,6 +52,9 @@ $(eval $(call mkabspath,GLUON_PACKAGEDIR))
$(eval $(call mkabspath,GLUON_TARGETSDIR))
$(eval $(call mkabspath,GLUON_PATCHESDIR))
GLUON_VERSION := $(shell scripts/getversion.sh '.')
GLUON_SITE_VERSION := $(shell scripts/getversion.sh '$(GLUON_SITEDIR)')
GLUON_MULTIDOMAIN ?= 0
GLUON_AUTOREMOVE ?= 0
GLUON_DEBUG ?= 0
@ -64,6 +67,7 @@ src-link gluon_base ../../package
endef
GLUON_VARS = \
GLUON_VERSION GLUON_SITE_VERSION \
GLUON_RELEASE GLUON_REGION GLUON_MULTIDOMAIN GLUON_AUTOREMOVE GLUON_DEBUG GLUON_MINIFY GLUON_DEPRECATED \
GLUON_DEVICES GLUON_TARGETSDIR GLUON_PATCHESDIR GLUON_TMPDIR GLUON_IMAGEDIR GLUON_PACKAGEDIR GLUON_DEBUGDIR \
GLUON_SITEDIR GLUON_RELEASE GLUON_AUTOUPDATER_BRANCH GLUON_AUTOUPDATER_ENABLED GLUON_LANGS GLUON_BASE_FEEDS \

View File

@ -88,3 +88,17 @@ update.sh
source and installs it into *packages/* directory. It simply tries to set the *base*
branch of the cloned repo to the correct commit. If this fails it fetches the
upstream branch and tries again to set the local *base* branch.
getversion.sh
Used to determine the version numbers of the repositories of Gluon and the
site configuraiton, to be included in the built firmware images as
*/lib/gluon/gluon-version* and */lib/gluon/site-version*.
By default, this uses ``git describe`` to generate a version number based
on the last git tag. This can be overridden by putting a file called
*.scmversion* into the root of the respective repositories.
A command like ``rm -f .scmversion; echo "$(./scripts/getversion.sh .)" > .scmversion``
can be used before applying local patches to ensure that the reported
version numbers refer to an upstream commit ID rather than an arbitrary
local one after ``git am``.

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-alfred
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-authorized-keys
PKG_VERSION:=2
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-autoupdater
PKG_VERSION:=4
PKG_CONFIG_DEPENDS := CONFIG_GLUON_AUTOUPDATER_BRANCH CONFIG_GLUON_AUTOUPDATER_ENABLED

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-client-bridge
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-autoupdater
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-contact-info
PKG_VERSION:=1
include ../gluon.mk

View File

@ -4,7 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-core
PKG_VERSION:=2
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-domain-select
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-geo-location-osm
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-geo-location
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-hostname
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-mesh-vpn
PKG_VERSION:=2
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-outdoor
PKG_VERSION:=1
include ../gluon.mk

View File

@ -4,7 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-config-mode-theme
PKG_VERSION:=1
include ../gluon.mk

View File

@ -2,10 +2,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-core
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 +19,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 +38,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))

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-ebtables-filter-multicast
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-ebtables-filter-ra-dhcp
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-ebtables-limit-arp
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-ebtables-source-filter
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-ebtables
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -2,9 +2,6 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-hoodselector
GLUON_VERSION:=3
PKG_VERSION:=2
include ../gluon.mk
define Package/gluon-hoodselector

View File

@ -2,9 +2,6 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-iptables-clamp-mss-to-pmtu
GLUON_VERSION = $(shell git describe --always --dirty=+ 2>/dev/null || echo unknown)
PKG_VERSION:=$(if $(DUMP),x,$(GLUON_VERSION))
include ../gluon.mk
define Package/$(PKG_NAME)

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-l3roamd
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-lock-password
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-logging
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-babel
PKG_VERSION:=1
PKG_BUILD_DEPENDS := libbabelhelper
PKG_BUILD_DEPENDS += libjson-c

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-batman-adv
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-core
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-fastd
PKG_VERSION:=3
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-tunneldigger
PKG_VERSION:=3
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-vpn-wireguard
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mesh-wireless-sae
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-mmfd
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-neighbour-info
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-node-info
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-private-wifi
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-radv-filterd
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-radvd
PKG_VERSION:=3
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-respondd
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-scheduled-domain-switch
PKG_VERSION:=1
include ../gluon.mk

View File

@ -4,7 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-setup-mode
PKG_VERSION:=1
include ../gluon.mk

View File

@ -3,15 +3,11 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-site
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 +17,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 +84,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)

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-state-check
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-status-page-mesh-batman-adv
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-status-page
PKG_VERSION:=3
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-wan-dnsmasq
PKG_VERSION:=1
include ../gluon.mk

View File

@ -4,8 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-admin
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -4,8 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-autoupdater
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-logging
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-mesh-vpn-fastd
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-model
PKG_VERSION:=1
include ../gluon.mk

View File

@ -4,8 +4,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-network
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-node-role
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-osm
PKG_VERSION:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-private-wifi
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,8 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web-wifi-config
PKG_VERSION:=1
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-web
PKG_VERSION:=1
PKG_INSTALL:=1

View File

@ -1,7 +1,6 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=gluon-wireless-encryption
PKG_RELEASE:=1
include ../gluon.mk

View File

@ -1,6 +1,8 @@
GLUON_MK := $(abspath $(lastword $(MAKEFILE_LIST)))
PKG_FILE_DEPENDS += $(GLUON_MK)
PKG_VERSION ?= 1
PKG_BUILD_DEPENDS += luasrcdiet/host
ifneq ($(wildcard ./luasrc/.),)

13
scripts/getversion.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
if [ $# -ne 1 ]; then
echo >&2 "Usage: getversion.sh <directory>"
exit 1
fi
cd "$1" || exit 1
cat .scmversion 2>/dev/null && exit 0
git --git-dir=.git describe --always --abbrev=7 --dirty=+ 2>/dev/null && exit 0
echo unknown

View File

@ -2,6 +2,8 @@ assert(env.GLUON_LANGS)
config('GLUON_SITEDIR', env.GLUON_SITEDIR)
config('GLUON_VERSION', env.GLUON_VERSION)
config('GLUON_SITE_VERSION', env.GLUON_SITE_VERSION)
config('GLUON_RELEASE', env.GLUON_RELEASE)
try_config('GLUON_AUTOUPDATER_BRANCH', env.GLUON_AUTOUPDATER_BRANCH)