Skip to content
This repository was archived by the owner on Jan 28, 2022. It is now read-only.

Commit 86ffa74

Browse files
committed
fix: Version information if built in Buildroot
The Buildroot custom package build used the wrong version information from remote-os instead of the module's git repository. Since the git metadata information is not available during Buildroot build, a QMake parameter is used instead.
1 parent b30383f commit 86ffa74

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

openhab.pro

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,24 @@ TEMPLATE = lib
22
CONFIG += plugin
33
QT += core quick network
44

5-
# Plugin VERSION
6-
GIT_HASH = "$$system(git log -1 --format="%H")"
7-
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
8-
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
5+
# === Version and build information ===========================================
6+
# If built in Buildroot use custom package version, otherwise Git
7+
isEmpty(YIO_BUILD_VERSION) {
8+
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
9+
GIT_HASH = "$$system(git log -1 --format="%H")"
10+
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
11+
} else {
12+
GIT_VERSION = $$YIO_BUILD_VERSION
13+
contains(GIT_VERSION, "^v?(0|[1-9]\d*)\..*") {
14+
# (simplified) version string = regular release
15+
GIT_HASH = ""
16+
GIT_BRANCH = "master"
17+
} else {
18+
# git hash as version = custom build
19+
GIT_HASH = $$YIO_BUILD_VERSION
20+
GIT_BRANCH = ""
21+
}
22+
}
923
OH_VERSION = $$replace(GIT_VERSION, v, "")
1024
DEFINES += PLUGIN_VERSION=\\\"$$OH_VERSION\\\"
1125

@@ -16,6 +30,8 @@ win32 {
1630
} else {
1731
BUILDDATE=$$system(date +"%Y-%m-%dT%H:%M:%S")
1832
}
33+
# =============================================================================
34+
1935
CONFIG(debug, debug|release) {
2036
DEBUG_BUILD = true
2137
} else {

0 commit comments

Comments
 (0)