summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-04 09:35:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-04-09 07:31:33 +0000
commitd91177c4b2ae557d2c388ef2d29abd488c4831ed (patch)
treed1fb9108760377861022ab0537abe783f0ac1dcf
parent5121334218b5a1b7e61e5b775c6d9bdf4fd8f9da (diff)
Conan: Use "scm" revision mode when exporting from .git repository
We want to match the commit ID along with the RREV (recipe revision). This way we can pin exact Conan packages to known sha1/tag which makes releasing easier. https://docs.conan.io/en/latest/reference/conanfile/attributes.html#revision-mode We have two use cases where the conan export is being executed: - Conan export from src tar ball - .git directory is not present - Coin/CI: conan export from git repository The "scm" feature will not work if the ".git" repository does not exist. If this is the case then use the default "hash" mode for the recipe revision. Task-number: QTQAINFRA-4325 Change-Id: I540ae0aa493e0568d851e5788bd2f76ff5417d50 Reviewed-by: Paul Wicking <paul.wicking@qt.io> Reviewed-by: Toni Saario <toni.saario@qt.io> (cherry picked from commit b1cbeaf43d56248da541d542f62ef8e494a012be) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--conanfile.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/conanfile.py b/conanfile.py
index fb1bc34..7b9b2f7 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -28,6 +28,7 @@
from conans import ConanFile, tools, CMake
import os
+from pathlib import Path
class QtConanError(Exception):
@@ -48,6 +49,8 @@ class QtMQTT(ConanFile):
default_options = {"shared": "default", # default: Use the value of the Qt build
"qt6": None}
exports_sources = "*", "!conan*.*"
+ # use commit ID as the RREV (recipe revision) if this is exported from .git repository
+ revision_mode = "scm" if Path(Path(__file__).parent.resolve() / ".git").exists() else "hash"
def source(self):
# sources are installed next to recipe, no need to clone etc. sources here