I have a recipe for a toolchain which retrieves sources based on the compiler.version setting:
def source(self):
git_user = tools.get_env("GIT_USER")
git_pass = tools.get_env("GIT_PASS")
git = tools.Git(username=git_user, password=git_pass)
git.clone("https://scm/my_compiler_src/%s" % self.settings.get_safe("compiler.version"), "master")
In my CI job for this package, I want to build packages for different versions. I am doing this by deriving different lockfiles from a base:
// create base lockfile
conan lock create ../conanfile.py --user=user --channel=testing --lockfile-out=base.lock --build --base
conan export .. my_compiler_installer/1.0.0@user/testing --lockfile=base.lock --lockfile-out=base.lock
// derive lockfile for 6.2r1 and create package
conan lock create --reference=my_compiler_installer/1.0.0@user/testing --lockfile=base.lock --lockfile-out=6_2r1.lock -s compiler.version=6.2r1 --build=missing
conan install ${package_ref} --build=${package_ref} --lockfile=6_2r1.lock --lockfile-out=6_2r1.lock --build=missing
// derive lockfile for 6.2r2p2 and create package
conan lock create --reference=my_compiler_installer/1.0.0@user/testing --lockfile=base.lock --lockfile-out=6_2r2p2.lock -s compiler.version=6.2r2p2 --build=missing
conan install my_compiler_installer/1.0.0@user/testing --build=my_compiler_installer/1.0.0@user/testing --lockfile=6_2r2p2.lock --lockfile-out=6_2r2p2.lock --build=missing
When building the second package, the sources of the first configuration are not updated. It seems the Configuring sources in ... step is skipped and the sources from the first build are copied and reused.
Hi @GordonJess
This doesn't look a lockfiles problem, but a model problem: you are doing different builds based on a different compiler versions, right? The source() method is common for all different builds of the same recipe version. It cannot be parameterized based on settings (and this will raise errors in Conan 2.0 or enabling CONAN_V2_BEHAVIOR (experimental)). If you have different code for different settings, you need to fetch it in the build() method. Please read the note in https://docs.conan.io/en/latest/reference/conanfile/methods.html#source
Ah! Thanks a lot! I didn't notice that note. I'll give it a try!
It works fine. Thanks a lot, I'll close this now!