summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIikka Eklund <iikka.eklund@qt.io>2021-03-04 11:45:08 +0200
committerIikka Eklund <iikka.eklund@qt.io>2021-04-14 09:08:18 +0200
commit57c420b461b35b89cd9866c7ade42c1f6c51e583 (patch)
treeb6a8f6642c256e447d3217da296e9a4afeeae71b
parentc5340356e3402d795f5ca77f4aefbe06fb4c1f40 (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: I5e3ac718333cd47b95d5a8886b33b1b5b7b31300 Reviewed-by: Toni Saario <toni.saario@qt.io>
-rw-r--r--conanfile.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/conanfile.py b/conanfile.py
index fbc3ac2..eea43e4 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 QtDeviceUtilities(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