How to specify the Conan 2 package version when building binary package?

73 views Asked by At

I am developing a binary package for a commercial SDK where I have the source for the SDK in a private repository.

This repository is set up so that each version of the SDK is in a branch where the branch name is the same as the version. i.e. 1.2.0, 1.3.0.

In the source for my Conan 2 Package I currently have a conandata.yml file which contains the url for the respository and the version i.e.

sources:
   "1.2.0":
      url: "http:myscm/scm/mysdk.git"
   "1.3.0":
      url: "http:myscm/scm.mysdk.git"

but i think this can be removed as there is no significant change between versions. The conanfile.py reads in this file to determine what the the git url is. i.e.

    def build(self):
        data = self.conan_data["sources"][self.version]
        git = Git(self)
        git.clone(url=data["url"], target=".")
        git.checkout(self.version)

What I would like to be able to do is specify the version for the package when I run conan create . and for it to set the version in the package as I would like to keep one version of the package source. Is this possible? or have I missed something? Any recommendations to managing & maintaining private packages where both the package and source for the packages are in private repositories also welcome?

0

There are 0 answers