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

Commit

Permalink
fix: Version information if built in Buildroot
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zehnm committed Oct 2, 2020
1 parent b30383f commit 86ffa74
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions openhab.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,24 @@ TEMPLATE = lib
CONFIG += plugin
QT += core quick network

# Plugin VERSION
GIT_HASH = "$$system(git log -1 --format="%H")"
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
# === Version and build information ===========================================
# If built in Buildroot use custom package version, otherwise Git
isEmpty(YIO_BUILD_VERSION) {
GIT_VERSION = "$$system(git describe --match "v[0-9]*" --tags HEAD --always)"
GIT_HASH = "$$system(git log -1 --format="%H")"
GIT_BRANCH = "$$system(git rev-parse --abbrev-ref HEAD)"
} else {
GIT_VERSION = $$YIO_BUILD_VERSION
contains(GIT_VERSION, "^v?(0|[1-9]\d*)\..*") {
# (simplified) version string = regular release
GIT_HASH = ""
GIT_BRANCH = "master"
} else {
# git hash as version = custom build
GIT_HASH = $$YIO_BUILD_VERSION
GIT_BRANCH = ""
}
}
OH_VERSION = $$replace(GIT_VERSION, v, "")
DEFINES += PLUGIN_VERSION=\\\"$$OH_VERSION\\\"

Expand All @@ -16,6 +30,8 @@ win32 {
} else {
BUILDDATE=$$system(date +"%Y-%m-%dT%H:%M:%S")
}
# =============================================================================

CONFIG(debug, debug|release) {
DEBUG_BUILD = true
} else {
Expand Down

0 comments on commit 86ffa74

Please sign in to comment.