Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] npm-like version managment #99

Open
ReimuNotMoe opened this issue Mar 15, 2020 · 6 comments
Open

[Feature Request] npm-like version managment #99

ReimuNotMoe opened this issue Mar 15, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@ReimuNotMoe
Copy link

Hello, firstly thanks for the awesome package manager you made. I had a great time using this in some of my projects.

But I think a more advanced versioning feature like npm is essential for a package manager.

I think having this would be a great improvement for CPM. Would you like to have a look into it?

Thanks a lot in advance!

@TheLartians
Copy link
Member

TheLartians commented Mar 15, 2020

Hey thanks for your feedback! I agree that more advanced version management like npm would be awesome! However, being not having a package database means there is no way for CPM to be aware of package versions outside of the ones defined in the current project. This would however be required to provide more advanced versioning features like minimum required version.
Perhaps in a future version we could be able to parse an external package database, but for now I'm afraid this is out of the scope of this project.

@luketrevorrow
Copy link

How about if you took the MacOS brew utility as an example, and keep the package information in a github repo. That way you maintain links to the git repos used by CPM. I also think that CPM as a package manager is pretty cool, and set-up a link for it from the cppreference open source libraries page: https://en.cppreference.com/w/cpp/links/libs

@TheLartians
Copy link
Member

How about if you took the MacOS brew utility as an example, and keep the package information in a github repo.

Yeah, I was also thinking about something like this, though a git repo as a database has many issues itself, as it eventually becomes very inefficient. Another issue is there are many edge cases we have to think about. For example, how to handle mixing external and registered dependencies, how to deal with dependencies that define different databases etc. Also, implementing that kind of logic in CMake will be a pain.

For me the current implementation covers all my use cases so I probably won't be looking into this for a while. You're very welcome to make suggestions or contributions toward this though! 😉

I also think that CPM as a package manager is pretty cool, and set-up a link for it from the cppreference open source libraries page: https://en.cppreference.com/w/cpp/links/libs

That's really cool! Thanks for featuring CPM over there! :)

@ScottBailey
Copy link
Contributor

Is this a suggestion for a stand alone package manager? Like vcpkg? I don't think that's what CPM is or necessarily should be.

If not, what would the syntax look like for fmt as opposed to the existing shorthand?

CPMAddPackage("gh:fmtlib/fmt#7.1.3")

@TheLartians
Copy link
Member

So the way I understand the request would be for CPM to scrape all could scrape the source repository for all available versions and then decide on the highest one compatible with all version ranges specified in the project. The your example, this would allow users to specify something like CPMAddPackage("gh:fmtlib/fmt@^7.1.0") and CPM could automatically resolve it to 7.1.3.

Implementing this would be quite the undertaking though as without a central database of projects, finding an optimal configuration is non-trivial. Also we would need to implement version lock files first for reproducibility and safety from supply-chain-attacks.

@ScottBailey
Copy link
Contributor

Hmm, I think there are ways to query GitHub for available releases using GitHub's CLI tool (gh). I don't really have time to look into that right now, but maybe I'll add some design ideas here if/when I do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants