Complete revision to how RawTherapee's version is handled in CMake and in other files, #3628

This commit is contained in:
Morgan Hardwood
2017-01-25 00:18:52 +01:00
parent 9fbbb052ee
commit e5c00f0a9d
20 changed files with 217 additions and 193 deletions

View File

@@ -83,7 +83,7 @@ while getopts "bc:fnp:s:t:uvh?-" opt; do
" -s <string>" \
"Suffix of destination build directory, so that if you have applied a patch, say \"dustremoval-1.patch\", and want to have RawTherapee compiled to a folder whose name ends with \"_dustremoval1\", you would set \"-s dustremoval1\" (the underscore is automated)." "" \
" -t \"<string>\"" \
"Suffix displayed next to the RawTherapee version in the window titlebar. It is recommended that you include the changeset of the newest public commit (the one you would see if you cloned the repository anew) so it is clear which commit you applied the patches to. E.g.:" "-t \": ee72ddbcfd4e + dustremoval-1.patch + mustafa ibrahim\"" "" \
"Suffix displayed next to the RawTherapee version in the window titlebar. It is recommended that you include the commit of the newest public commit (the one you would see if you cloned the repository anew) so it is clear which commit you applied the patches to. E.g.:" "-t \": ee72ddbcfd4e + dustremoval-1.patch + mustafa ibrahim\"" "" \
" -u" \
"Check for an update of buildRT on GitHub." "" \
" -v" \
@@ -193,7 +193,7 @@ if [[ ! -d "${repo}" ]]; then
currentBranch="$(git branch | grep "*" | sed -e 's/.* \+//')"
rev="$(git rev-list --all --count)"
node="$(git rev-parse --short HEAD)"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Changeset: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Commit: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
alert "Repository cloned succesfully. What would you like to do next?"
printf "%b" "Repository cloned succesfully.\n" "Press 'q' to quit or any other key to continue... "
read -r -n 1
@@ -239,7 +239,7 @@ verLatesttagdistance="$(git describe --tags | sed -e 's/.*-\([0-9]\+\)-.*/\1/')"
currentBranch="$(git branch | grep "*" | sed -e 's/.* \+//')"
rev="$(git rev-list --all --count)"
node="$(git rev-parse --short HEAD)"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Changeset: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
printf "\nRepository state:\n Branch: ${currentBranch}\n RawTherapee-${verLatesttag}.${verLatesttagdistance}\n Commit: ${rev}:${node}\n Latest tag: ${verLatesttag}\n\n"
#--- Print the menu
branches=()

View File

@@ -37,8 +37,8 @@ for rtDir in "${rtDirs[@]}"; do
c=1
pp3name=${pp3%.*}
pp3name=${pp3name#*/}
v+=("$(grep "Changeset:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Changeset: //")")
printf "%s\n" "Developing images using RawTherapee changeset ${v[$i]} - ${rtDir}"
v+=("$(grep "Commit:.*" "${rtDir}/AboutThisBuild.txt" | sed "s/Commit: //")")
printf "%s\n" "Developing images using RawTherapee commit ${v[$i]} - ${rtDir}"
for img in "${imgs[@]}"; do
printf "%s" "${c}/${#imgs[@]} - "
"${rtDir}rawtherapee" -o "${outDir}${img%.*}_${v[i]}_${pp3%.*}.tif" -p "${pp3}" -t -Y -c "$img" | grep Processing

View File

@@ -1,12 +1,76 @@
#!/usr/bin/env bash
gitBranch="`git symbolic-ref --short -q HEAD`"
gitVersion="`git describe --tags --always`"
gitLatesttag="`echo $gitVersion | sed 's/-.*//'`"
gitLatesttagdistance="`echo $gitVersion | sed 's/.*-\(.*\)-g.*/\1/'`"
gitChangeset="`git rev-parse --verify HEAD`"
# This script is called from tools/generateSourceTarball
# It is used to generate a ReleaseInfo.cmake file with commit information which
# enables compilation without needing to have git installed.
echo "set(GIT_BRANCH $gitBranch)
set(GIT_VERSION $gitLatesttag.$gitLatesttagdistance)
set(GIT_CHANGESET $gitChangeset)
set(GIT_TAGDISTANCE $gitLatesttagdistance)" > ReleaseInfo.cmake
rm -f ReleaseInfo.cmake
# Get version description.
# Depending on whether you checked out a branch (dev) or a tag (release),
# "git describe" will return "5.0-gtk2-2-g12345678" or "5.0-gtk2", respectively.
gitDescribe="$(git describe --tags --always)"
# Get branch name.
# Will return empty if you checked out a commit or tag. Empty string handled later.
gitBranch="$(git symbolic-ref --short -q HEAD)"
# Get commit hash.
gitCommit="$(git rev-parse --short --verify HEAD)"
# Get commit date, YYYY-MM-DD.
gitCommitDate="$(git show -s --format=%cd --date=format:%Y-%m-%d)"
# Get number of commits since tagging. This is what gitDescribe uses.
# Works when checking out branch, tag or commit.
gitCommitsSinceTag="$(git rev-list --count HEAD --not $(git tag --merged HEAD))"
# Get number of commits since branching.
# Works when checking out branch, tag or commit.
gitCommitsSinceBranch="$(git rev-list --count HEAD --not --tags)"
if [[ -z $gitDescribe ]]; then
printf '%s\n' "Failed finding commit description, aborting."
exit 1
fi
if [[ -z $gitBranch ]]; then
printf '%s\n' "No branch found. Using commit description as branch name."
gitBranch="$gitDescribe"
fi
if [[ -z $gitCommit ]]; then
printf '%s\n' "Failed finding commit hash, aborting."
exit 1
fi
if [[ -z $gitCommitDate ]]; then
printf '%s\n' "Failed finding commit date, aborting."
exit 1
fi
# Create numeric version.
# This version is nonsense, either don't use it at all or use it only where you have no other choice, e.g. Inno Setup's VersionInfoVersion.
# Strip everything after hyphen, e.g. "5.0-gtk2" -> "5.0", "5.1-rc1" -> "5.1" (ergo BS).
if [[ -z $gitCommitsSinceTag ]]; then
gitVersionNumericBS="0.0.0"
else
gitVersionNumericBS="${gitDescribe%%-*}" # Remove everything after first hyphen.
gitVersionNumericBS="${gitVersionNumericBS}.${gitCommitsSinceTag}" # Remove everything until after first hyphen: 5.0
fi
cat <<EOF > ReleaseInfo.cmake
set(GIT_DESCRIBE $gitDescribe)
set(GIT_BRANCH $gitBranch)
set(GIT_COMMIT $gitCommit)
set(GIT_COMMIT_DATE $gitCommitDate)
set(GIT_COMMITS_SINCE_TAG $gitCommitsSinceTag)
set(GIT_COMMITS_SINCE_BRANCH $gitCommitsSinceBranch)
set(GIT_VERSION_NUMERIC_BS $gitVersionNumericBS)
EOF
printf '%s\n' "Git information extracted:" \
" Description: ${gitDescribe}" \
" Branch: ${gitBranch}" \
" Commit: ${gitCommit}" \
" Commit date: ${gitCommitDate}" \
" Commits since tag: ${gitCommitsSinceTag}" \
" Commits since branch: ${gitCommitsSinceBranch}" \
" Unreliable verison: ${gitVersionNumericBS}" \
""

View File

@@ -1,17 +1,24 @@
#!/usr/bin/env bash
# Run from the root of the cloned repository.
# This script is used to generate a source code tarball which includes commit
# metadata so that RawTherapee can be compiled without needing to install git.
# It is meant to be used every time a release is made after creating an
# annotated tag in git.
# It is your job to checkout the tag before running this script.
if [[ ! "$1" ]]; then
printf "%s\n" "Usage: $0 <git tag>" "Example: $0 4.2"
exit
./tools/generateReleaseInfo
ret=$?
if [[ $ret -ne 0 ]]; then
printf '%s\n' "Something went wrong while running tools/generateReleaseInfo" "Aborting."
exit 1
fi
desc="$(grep GIT_DESCRIBE ReleaseInfo.cmake)" # Gets whole string: set(GIT_DESCRIBE 5.0-gtk2-1-g96bf9129)
desc="${desc#*GIT_DESCRIBE }" # Removes front: 5.0-gtk2-1-g96bf9129)
desc="${desc%)}" # Removes back: 5.0-gtk2-1-g96bf9129
git checkout "$1" || exit 0
tools/generateReleaseInfo
mkdir rawtherapee-"$1"
mv ReleaseInfo.cmake rawtherapee-"$1"
#hg archive -X ".hg*" -X "rtgui/config.h" -X "rtgui/version.h" -X "rtdata/rawtherapee.desktop" rawtherapee-"$1".tar
git archive --format=tar "$1" > rawtherapee-"$1".tar
tar --append --file=rawtherapee-"$1".tar rawtherapee-"$1"/ReleaseInfo.cmake
xz -z -9e rawtherapee-"$1".tar
rm -r rawtherapee-"$1"
git checkout
mkdir "rawtherapee-${desc}" || exit 1
mv ReleaseInfo.cmake "rawtherapee-${desc}" || exit 1
git archive --format=tar --prefix="rawtherapee-${desc}/" -o "rawtherapee-${desc}.tar" HEAD || exit 1
tar --append --file="rawtherapee-${desc}.tar" "rawtherapee-${desc}/ReleaseInfo.cmake" || exit 1
xz -z -9e "rawtherapee-${desc}.tar" || exit 1
rm -r "rawtherapee-${desc}"

View File

@@ -1,30 +1,26 @@
; Script initially generated by the Inno Setup Script Wizard
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; This script has to be used by "INNO Setup" (http://www.jrsoftware.org/) to create a setup executable.
; When the "make install" process ends, you can double click on this file to load it into
; INNO Setup, then execute it to create the archive. It expect to find all the dependency libs
; in the root destination folder (the one of the 'make install' process), and the usual 'lib' directory.
; Please note that all *.dll files will be added, so be carefull on which dll are present in the directory
; before compiling the INNO Setup script.
; Script initially generated by the Inno Setup Script Wizard.
; Documentation: http://www.jrsoftware.org/ishelp/
;
; It also search for and bundles all "rawtherapee*.exe" files, which mean that you can bundle a Release and
; a Debug build at the same time (for conveniency), but official downloads must only contain the Release
; version.
; This script is used by "Inno Setup" (http://www.jrsoftware.org/) to create a
; setup executable. When the "make install" process ends, double-click on this
; file to load it into Inno Setup, then execute it to create the installer. It
; expects to find all the dependency libs in the root destination folder (the
; one from the 'make install' process), and the usual 'lib' directory.
; Note that all *.dll files will be added, so be careful which DLLs are present
; in the folder before running this script.
;
; In all cases, you have to bundle at least one file named "rawtherapee.exe", which INNO Setup will require
; as a default executable to run.
; This script searches for and bundles all "rawtherapee*.exe" files, allowing
; you to bundle a "release" as well as a "debug" version at the same time.
; At least one "rawtherapee.exe" file is required.
;
; This script is configured to check that the operating system's bit depth is the same than the executable file.
; Please note that the ia64 architecture is not supported (is it really necessary?)
; This script is configured to check that the operating system's bit depth is
; the same as that of the executable file.
;
; The IA-64 architecture is not supported.
#define MyAppName "RawTherapee"
#define MyAppVersion "${GIT_VERSION}"
#define MyAppFullVersion "${GIT_VERSION}.${GIT_TAGDISTANCE}"
#define MyAppVersion "${GIT_DESCRIBE}"
#define MyAppVersionNumeric "${GIT_NUMERIC_VERSION_BS}"
#define MyAppPublisher "rawtherapee.com"
#define MyAppURL "http://www.rawtherapee.com/"
#define MyAppExeName "rawtherapee.exe"
@@ -42,18 +38,17 @@
AppId={{128459AB-59A7-430A-8BD0-3D8803D50400}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
VersionInfoVersion={#MyAppFullVersion}
;AppVerName={#MyAppName} {#MyAppVersion}
VersionInfoVersion={#MyAppVersionNumeric}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\{#MyAppName}-{#MyAppFullVersion}
DefaultGroupName={#MyAppName} {#MyAppFullVersion}
DefaultDirName={pf}\{#MyAppName}\{#MyAppVersion}
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile={#MyBuildBasePath}\LICENSE.txt
OutputDir={#MyBuildBasePath}\..\
OutputBaseFilename={#MyAppName}_{#MySystemName}_{#MyBitDepth}_{#MyAppFullVersion}
OutputBaseFilename={#MyAppName}_{#MyAppVersion}_{#MySystemName}_{#MyBitDepth}
SetupIconFile={#MySourceBasePath}\rtdata\icons\RT.ico
WizardImageFile={#MySourceBasePath}\tools\win\InnoSetup\installerStrip.bmp
WizardImageBackColor=$2A2A2A
@@ -97,7 +92,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: "{#MyBuildBasePath}\rawtherapee.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\rawtherapee*.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\camconst.json"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#MyBuildBasePath}\dcpprofiles\*"; DestDir: "{app}\dcpprofiles\"; Flags: ignoreversion recursesubdirs createallsubdirs
;Source: "{#MyBuildBasePath}\etc\*"; DestDir: "{app}\etc\"; Flags: ignoreversion recursesubdirs createallsubdirs
@@ -122,11 +117,11 @@ Source: "{#MyBuildBasePath}\fonts\DroidSansMonoSlashed.ttf"; DestDir: "{fonts}";
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName} {#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppName}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppName}{#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName} {#MyAppFullVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
Name: "{commondesktop}\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppName} {#MyAppVersion}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent