Since conan 1.18.0 the scm attribute is broken for Git tags. Setting revision to a branch – eg. master – still works, but tags fail.
The following recipe (excerpt) worked up to conan 1.17.0 but fails since 1.18.0:
class RestclientcppConan(ConanFile):+
name = "restclient-cpp"
version = "0.5.1"
_source_dir = "{}-{}".format(name, version)
scm = {
"type": "git",
"subfolder": _source_dir,
"url": "https://github.com/mrtazz/restclient-cpp.git",
"revision": "0.5.1"
}
_(The full example recipe is available here.)_
Building locally as well as via Travis CI / Conan Build Tools Container fail with this error:
ERROR: Command 'git -c http.sslVerify=false checkout "0.5.1"' returned non-zero exit status 1.
/bin/sh: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
error: pathspec '0.5.1' did not match any file(s) known to git
It turned out that branches still work. Removing the scm attribute and putting the scm part into source() works too.
_Note:_ There's a source() method in all that cases to apply patches.
scm = {
...
"revision": "0.5.1" # Tag, broken
}
Fails with the error mentioned above
scm = {
...
"revision": "master" # Branch, ok
}
Builds without an error.
source() with tag# scm part removed
def source(self):
git = tools.Git(folder=self._source_dir)
git.clone("https://github.com/mrtazz/restclient-cpp.git", "0.5.1") # Tag, ok
Builds without an error too – even though a tag is used.
scm attribute and git tag as mentioned (ready to use exampleconan create . restclient-cpp/0.5.1_(From a failed Travis CI build)_
Traceback (most recent call last):
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/source.py", line 182, in _run_source
_run_scm(conanfile, src_folder, local_sources_path, output, cache=cache)
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/source.py", line 243, in _run_scm
scm.checkout()
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/model/scm.py", line 99, in checkout
submodule=self._data.submodule)
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/tools/scm.py", line 149, in checkout
output = self.run('checkout "%s"' % element)
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/tools/scm.py", line 100, in run
return super(Git, self).run(command)
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/tools/scm.py", line 66, in run
return check_output(command).strip()
File "/opt/pyenv/versions/3.7.1/lib/python3.7/site-packages/conans/client/tools/oss.py", line 507, in check_output
raise CalledProcessErrorWithStderr(process.returncode, cmd, output=stderr)
conans.errors.CalledProcessErrorWithStderr: Command 'git -c http.sslVerify=false checkout "0.5.1"' returned non-zero exit status 1.
error: pathspec '0.5.1' did not match any file(s) known to git.
Thanks very much @offa for reporting this. We have already prepared a fix for it, and it will soon be released in 1.18.1.
Great, thanks! :tada:
Conan 1.18.1 has been released with the fix for this issue! https://github.com/conan-io/conan/releases/tag/1.18.1
Thanks
Thanks, I can confirm the issue has been fixed.
Most helpful comment
Thanks, I can confirm the issue has been fixed.