Repository navigation
how does CPM relate to vendor branch management? #720
|
I'm a CPM noob (but with C++ experience and more) and am wondering in which cases what approach (CPM vs vendor) is recommended. I've identified several problematic source code imports in the Stellarium project where tracking of changes to the original artefacts is difficult if not impossible. I can understand that the tools to import external artefacts might not always have been known, I wonder in what of the following cases CPM might be better than the vendoring approach: Thanks. |
Replies: 3 comments 3 replies
|
They solve different parts of the problem, so it mostly depends on where the code comes from and how much you change it. CPM fits when the upstream is a real project you can point at with a version: a git repo with tags, a specific commit, or a release archive. You pin it in Vendoring fits better when there's nothing stable to point at (FTP drops, papers, sample code from a web page), when it's data rather than code, or when the local changes are big enough that a pile of patches would be harder to maintain than a branch. CPM also isn't meant to keep a copy of the dependency inside your repository. That came up in #270, and the maintainer said committing the downloaded sources into the project is generally outside CPM's scope. Going through your list with that in mind:
One practical point for Stellarium: CPM downloads at configure time, and distro packagers usually build without network access. |
|
The existing artefacts are unlikely to be moved to vendor branching, but one can only pray and hope. Hopefully new contributions will use vendor branching if appropriate, but the concept first needs to be accepted... |
|
One key concept of vendor branching is the ease to mix vendor updates with local changes. Is CPM able to offer such facility? |
Partly. With
PATCHES, your local changes live as patch files next to theCPMAddPackagecall, and they get applied again on top of whatever version you pin. So taking a vendor update is just bumpingGIT_TAGorVERSION, and if upstream changed the same lines, the patch fails to apply and you fix it up, much like resolving a conflict. What you don't get is a real three-way merge or a history of how your changes evolved, only the current patch files.If you want the full vendor branch workflow, the usual approach is to keep a fork with a branch holding your local commits, rebase or merge it onto new upstream releases, and point CPM at that fork with
GIT_REPOSITORYandGIT_TAGset to your bran…