aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xpackaging-tools/bld_qtcreator.py4
-rwxr-xr-xpackaging-tools/bld_qtcreator_plugins.py5
-rw-r--r--packaging-tools/bld_utils.py12
-rw-r--r--packaging-tools/build_wrapper.py6
4 files changed, 20 insertions, 7 deletions
diff --git a/packaging-tools/bld_qtcreator.py b/packaging-tools/bld_qtcreator.py
index 4a1326560..f82d9e385 100755
--- a/packaging-tools/bld_qtcreator.py
+++ b/packaging-tools/bld_qtcreator.py
@@ -52,7 +52,7 @@ import sys
# own imports
from threadedwork import ThreadedWork
-from bld_utils import gitSHA, runBuildCommand, runCommand, runInstallCommand, stripVars
+from bld_utils import get_commit_SHA, runBuildCommand, runCommand, runInstallCommand, stripVars
import bldinstallercommon
def add_commandline_arguments(parser):
@@ -264,7 +264,7 @@ if __name__ == "__main__":
buildType = 'debug'
else:
buildType = 'release'
- buildGitSHA = gitSHA(qtCreatorSourceDirectory, callerArguments)
+ buildGitSHA = get_commit_SHA(qtCreatorSourceDirectory, callerArguments)
qtCreatorProFile = os.path.join(qtCreatorSourceDirectory, 'qtcreator.pro')
qmakeCommand = [qmakeBinary, qtCreatorProFile,
diff --git a/packaging-tools/bld_qtcreator_plugins.py b/packaging-tools/bld_qtcreator_plugins.py
index 12faad075..244f24ace 100755
--- a/packaging-tools/bld_qtcreator_plugins.py
+++ b/packaging-tools/bld_qtcreator_plugins.py
@@ -52,7 +52,7 @@ import sys
# own imports
from threadedwork import ThreadedWork
-from bld_utils import gitSHA, runBuildCommand, runInstallCommand, runCommand, stripVars
+from bld_utils import get_commit_SHA, runBuildCommand, runInstallCommand, runCommand, stripVars
import bldinstallercommon
from bld_qtcreator import add_common_commandline_arguments, patch_qt_pri_files, qmake_binary, get_common_environment
@@ -168,7 +168,8 @@ def build_plugins(caller_arguments):
# environment
environment = get_common_environment(paths.qt5, caller_arguments)
- buildGitSHA = gitSHA(paths.source, caller_arguments)
+ # get SHA either via git, or if that fails look for a .tag file
+ buildGitSHA = get_commit_SHA(paths.source, caller_arguments)
# build plugins
print('------------')
diff --git a/packaging-tools/bld_utils.py b/packaging-tools/bld_utils.py
index 9957d6da1..3935227c7 100644
--- a/packaging-tools/bld_utils.py
+++ b/packaging-tools/bld_utils.py
@@ -420,6 +420,18 @@ def gitSHA(path, callerArguments = None):
return getReturnValue(gitBinary + " rev-list -n1 HEAD", currentWorkingDirectory = path, callerArguments = callerArguments).strip()
return ''
+
+# get commit SHA either directly from git, or from a .tag file in the source directory
+def get_commit_SHA(source_path, callerArguments = None):
+ buildGitSHA = gitSHA(source_path, callerArguments)
+ if not buildGitSHA:
+ tagfile = os.path.join(source_path, '.tag')
+ if os.path.exists(tagfile):
+ with open(tagfile, 'r') as f:
+ buildGitSHA = f.read().strip()
+ return buildGitSHA
+
+
def isGitDirectory(repository_path):
if not repository_path:
return False
diff --git a/packaging-tools/build_wrapper.py b/packaging-tools/build_wrapper.py
index 06151c130..5cefdf30b 100644
--- a/packaging-tools/build_wrapper.py
+++ b/packaging-tools/build_wrapper.py
@@ -694,7 +694,7 @@ def collect_qt_creator_plugin_sha1s(plugins):
sha1s = []
for name in [p.name for p in plugins if p.build and os.path.isdir(os.path.join(work_dir, p.path))]:
with open(os.path.join(work_dir, name + '.7z.git_sha'), 'r') as f:
- sha = f.read()
+ sha = f.read().strip()
sha1s.append(name + ': ' + sha)
return sorted(sha1s)
@@ -1062,8 +1062,8 @@ def handle_qt_creator_build(optionDict, qtCreatorPlugins):
sha1s = collect_qt_creator_plugin_sha1s(additional_plugins)
licensemanaging_source = os.path.join(work_dir, 'license-managing')
if os.path.exists(licensemanaging_source):
- sha1s.append('license-managing: ' + bld_utils.gitSHA(licensemanaging_source))
- sha1s.append('qt-creator: ' + bld_utils.gitSHA(qtcreator_source))
+ sha1s.append('license-managing: ' + bld_utils.get_commit_SHA(licensemanaging_source))
+ sha1s.append('qt-creator: ' + bld_utils.get_commit_SHA(qtcreator_source))
with open(os.path.join(work_dir, 'SHA1'), 'w') as f:
f.writelines([sha + '\n' for sha in sha1s])
# Create opensource source package