Open michaelplatingsarm opened 2 years ago
Hi @michaelplatingsarm
I am trying to understand this use case, but I am struggling a bit, so a couple of questions: The scm
feature with "auto", to obtain the current repo commit is completely self-defined. The current repo checkout defines the commit completely. But if you don't reference your current repo, then don't you already need the full correct "coordinates" of the different repos to checkout in order to get them? And if you already have defined them, why it would be necessary to capture? What am I missing here? I think this is the key to be able to understand this, but please let me know.
Hi @memsharded thanks for taking a look.
don't you already need the full correct "coordinates" of the different repos to checkout in order to get them
At the point the recipe is exported, the "coordinates" are the HEADs of the different repos. Later on, when we want to recreate the package we don't want HEAD, we want whatever the revisions were when the recipe was exported.
Does that make it clearer?
Ok, I think I start to understand it a bit better. Another quick question: I guess you have considered git submodules in the past, haven't you? Because this apparently seems kind of a re-implementation of git submodules. If instead of doing this you added the different Git sources as submodules of the repo containing the recipe, wouldn't this achieve the flow that you intend?
Yes I've considered it, and you're right that in principle it would solve the problem. But I've had my fingers burned in the past by Mercurial subrepos and articles like these suggest that Git submodules are no better:
The SCM feature by design can only be used with the repo containing the recipe. My team would like something similar but we use multiple repos, some quite large.
8760 advises:
Hard-coding isn't an option since our sources are updated many times each hour. I think we have to roll our own multi-scm feature, either by (a) by writing a script to generate conandata.yml with the revisions baked in; or (b) have the conanfile itself capture the revisions.
The SCM feature does is tantalizingly close to what we need - as I understand it at export time it runs
git rev-parse HEAD
and stores that in conandata.yml. I've taken a similar approach:conanfile.py
:multisource.py
:This works, but there are a couple of smells:
conan source
beforeconan create
, and sinceconan source
callsexport()
, theexport()
method itself can't assert that the sources must be present. (For my team that isn't a problem because we're in the habit of usingconan install
/source
/build
/export-pkg
anyway).conan create
andconan export
don't take a source folder argument so we have to infer the source folder from the recipe location.Any guidance for the best way forward here?