Update versioning scheme

This commit is contained in:
Adam Honse
2025-01-16 17:51:20 +00:00
parent 7f04d34179
commit ae248d6d32
6 changed files with 61 additions and 26 deletions

View File

@@ -300,15 +300,12 @@ before_script:
image: fedora:40
stage: build
script:
- dnf install rpmdevtools dnf-plugins-core libcurl-devel qt5-qtbase-devel -y
- dnf install rpmdevtools dnf-plugins-core libcurl-devel qt5-qtbase-devel git -y
- rpmdev-setuptree
- ./scripts/build-package-files.sh fedora/OpenRGB.spec
- ls /root/
- cp fedora/OpenRGB.spec /root/rpmbuild/SPECS
- cp ../OpenRGB /root/rpmbuild/SOURCES/ -r
- cd /root/rpmbuild/SOURCES
- tar -cf OpenRGB.tar.gz OpenRGB/
- cd ..
- cp -rp . /root/rpmbuild/SOURCES/OpenRGB
- cd /root/rpmbuild
- dnf builddep SPECS/OpenRGB.spec -y
- rpmbuild -ba SPECS/OpenRGB.spec
- cd RPMS/x86_64/

View File

@@ -26,11 +26,44 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
#-----------------------------------------------------------------------------------------------#
MAJOR = 0
MINOR = 9
REVISION = 1
VERSION = $$MAJOR"."$$MINOR$$REVISION
SUFFIX = git
SHORTHASH = $$system("git rev-parse --short=7 HEAD")
LASTTAG = "release_"$$MAJOR"."$$MINOR
COMMAND = "git rev-list --count "$$LASTTAG"..HEAD"
COMMITS = $$system($$COMMAND)
VERSION_NUM = $$MAJOR"."$$MINOR"."$$COMMITS
VERSION_STR = $$MAJOR"."$$MINOR
VERSION_DEB = $$VERSION_NUM
VERSION_WIX = $$VERSION_NUM".0"
VERSION_AUR = $$VERSION_NUM
VERSION_RPM = $$VERSION_NUM
equals(SUFFIX, "git") {
VERSION_STR = $$VERSION_STR"+ ("$$SUFFIX$$COMMITS")"
VERSION_DEB = $$VERSION_DEB"~git"$$SHORTHASH
VERSION_AUR = $$VERSION_AUR"-g"$$SHORTHASH
VERSION_RPM = $$VERSION_RPM"^git"$$SHORTHASH
} else {
!isEmpty(SUFFIX) {
VERSION_STR = $$VERSION_STR"+ ("$$SUFFIX")"
VERSION_DEB = $$VERSION_DEB"~"$$SUFFIX
VERSION_AUR = $$VERSION_AUR"-"$$SUFFIX
VERSION_RPM = $$VERSION_RPM"^"$$SUFFIX
}
}
TARGET = OpenRGB
TEMPLATE = app
message("VERSION_NUM: "$$VERSION_NUM)
message("VERSION_STR: "$$VERSION_STR)
message("VERSION_DEB: "$$VERSION_DEB)
message("VERSION_WIX: "$$VERSION_WIX)
message("VERSION_AUR: "$$VERSION_AUR)
message("VERSION_RPM: "$$VERSION_RPM)
#-----------------------------------------------------------------------------------------------#
# Automatically generated build information #
#-----------------------------------------------------------------------------------------------#
@@ -40,10 +73,11 @@ freebsd:BUILDDATE = $$system(date -j -R -r "${SOURCE_DATE_EPOCH:-$(date +%
macx:BUILDDATE = $$system(date -j -R -r "${SOURCE_DATE_EPOCH:-$(date +%s)}")
GIT_COMMIT_ID = $$system(git log -n 1 --pretty=format:"%H")
GIT_COMMIT_DATE = $$system(git log -n 1 --pretty=format:"%ci")
GIT_BRANCH = $$system(git branch --show-current)
GIT_BRANCH = $$system(scripts/git-get-branch.sh)
message("GIT_BRANCH: "$$GIT_BRANCH)
DEFINES += \
VERSION_STRING=\\"\"\"$$VERSION\\"\"\" \
VERSION_STRING=\\"\"\"$$VERSION_STR\\"\"\" \
BUILDDATE_STRING=\\"\"\"$$BUILDDATE\\"\"\" \
GIT_COMMIT_ID=\\"\"\"$$GIT_COMMIT_ID\\"\"\" \
GIT_COMMIT_DATE=\\"\"\"$$GIT_COMMIT_DATE\\"\"\" \

View File

@@ -7,7 +7,6 @@ Summary: Open source RGB lighting control that doesn't depend on manufact
License: GPLv2
URL: https://gitlab.com/CalcProgrammer1/%{_name}
Source0: OpenRGB.tar.gz
BuildRequires: gcc-c++ libusbx-devel libstdc++-devel qt5-qtbase-devel qt5-linguist desktop-file-utils hidapi-devel mbedtls-devel systemd-rpm-macros
Requires: hicolor-icon-theme
@@ -18,7 +17,7 @@ Open source RGB lighting control that doesn't depend on manufacturer software. S
ASUS, ASRock, Corsair, G.Skill, Gigabyte, HyperX, MSI, Razer, ThermalTake, and more supported
%prep
cp %{_sourcedir}/%{_name}/* %{_builddir} -r
cp -r %{_sourcedir}/%{_name}/. %{_builddir}
%build
cd %{_builddir}

View File

@@ -7,19 +7,14 @@ LICENSEFILE="scripts/License.rtf"
BANNERIMAGE="scripts/banner.bmp"
DIALOGBACKGROUND="scripts/dialog_background.bmp"
ZIP="/jobs/artifacts/master/download?job=Windows+64"
PROJECT_FILE="OpenRGB.pro"
PRODUCTID=$(uuidgen -n @url -N ${WEBSITE} --sha1 | awk '{ print toupper($0) }')
PRODUCTNAME="OpenRGB"
VENDOR=$PRODUCTNAME
PRODUCTCOMMENT="Open source RGB lighting control that doesn't depend on manufacturer software."
MAJOR=$(grep "MAJOR\ *=" OpenRGB.pro | cut -d= -f 2 | tr -d [:space:])
MINOR=$(grep "MINOR\ *=" OpenRGB.pro | cut -d= -f 2 | tr -d [:space:])
REVISION=$(grep "REVISION\ *=" OpenRGB.pro | cut -d= -f 2 | tr -d [:space:])
#The commit count since last tag. The commit ID can be added with group \3 however Wix only accepts integers
RELEASE=$(git describe --tags --abbrev=8 | sed -E "s/(.*)-([0-9]*)-g(\w*)/\2/g")
VERSION="${MAJOR}.${MINOR}.${REVISION}.${RELEASE}"
VERSION=$(qmake ${PROJECT_FILE} 2>&1 | grep VERSION_WIX | cut -d ':' -f 3 | tr -d ' ')
XMLOUTFILE=${PRODUCTNAME,,}".wxs"
@@ -99,4 +94,4 @@ echo -e "\t...Done!\n\n"
#Once the XML file manifest is created create the package
candle -arch x64 ${PRODUCTNAME,,}.wxs
light -sval -ext WixUIExtension ${PRODUCTNAME,,}.wixobj -out ${PRODUCTNAME}_Windows_64.msi
light -sval -ext WixUIExtension ${PRODUCTNAME,,}.wixobj -out ${PRODUCTNAME}_Windows_64.msi

View File

@@ -19,13 +19,20 @@ if [ -e ${1} ]; then
echo "Warning: File ${1} exists and will be overwritten"
fi
MAJOR=$(grep MAJOR\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:])
MINOR=$(grep MINOR\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:])
REVISION=$(grep REVISION\ ${PROJECT_FILE} | cut -d= -f 2 | tr -d [:space:])
VERSION_VAR="VERSION_NUM"
QMAKE_EXE="qmake"
#Convert Revision to a nummber in case it is blank in the project file
REVISION=$(( ${REVISION} + 0 ))
if [[ ${1} == *"debian"* ]]; then
VERSION_VAR="VERSION_DEB"
QMAKE_EXE="qmake"
fi
PACKAGE_VERSION="${MAJOR}.${MINOR}.${REVISION}"
if [[ ${1} == *"fedora"* ]]; then
VERSION_VAR="VERSION_RPM"
QMAKE_EXE="qmake-qt5"
fi
PACKAGE_VERSION=$(${QMAKE_EXE} ${PROJECT_FILE} 2>&1 | grep ${VERSION_VAR} | cut -d ':' -f 3 | tr -d ' ')
echo $PACKAGE_VERSION
sed -e "s/${VERSION_PATTERN}/${PACKAGE_VERSION}/g" ${INFILE_PATH} > ${1}

3
scripts/git-get-branch.sh Executable file
View File

@@ -0,0 +1,3 @@
#! /bin/bash
git show-ref | grep $(git log --pretty=%h -1) | sed 's|.*/\(.*\)|\1|' | sort -u | grep -v HEAD