tools: extend vpm to support specifying git version tags when installing modules#19835
tools: extend vpm to support specifying git version tags when installing modules#19835spytheman merged 3 commits intovlang:masterfrom
Conversation
fc08098 to
571638d
Compare
| assert res.output.contains('Installing module `markdown`') | ||
| assert res.output.contains('Installing module `pcre`') | ||
| assert res.output.contains('Installing module `vtray`') |
| return mod.name, mod.version | ||
| } | ||
|
|
||
| fn test_install_from_vpm_with_git_version_tag() { |
There was a problem hiding this comment.
I couldn't find a vlang repo that is tagged and could be used.
So for identifiers of vlang repos it would be required that one gets a tag release.
Repos where it might fit:
- sdl , since it was mentioned installing a specific version will be useful.
- vab, is the only one that is available via vpm.vlang.io that has a tag available. But the tag is very old, e.g. the repo didn't have a v.mod file back then.
- vsl, has tagged releases on the repository but it's url on vpm.vlang.io is set to a fork.
v install vsldoes not install the same repository asv install https://github.com/vlang/vsl. The fork doesn't have tags.
There was a problem hiding this comment.
sdl , since it was mentioned installing a specific version will be useful
In SDL, we are using branches, not tags, because we are still patching things from time to time (when making things work with latest V, or to support/wrap APIs that were missed), and branches can be updated, and then git pull will get the new changes, unlike tags, that can not be updated easily, once published.
There was a problem hiding this comment.
@larpon, @ttytm, I've added a new tag https://github.com/vlang/vab/tree/0.4.0 .
There was a problem hiding this comment.
There is now a v.mod file in https://github.com/vlang/libsodium/ too, as well as
a tag there also https://github.com/vlang/libsodium/tree/0.2.1.
There was a problem hiding this comment.
sdl , since it was mentioned installing a specific version will be useful
In SDL, we are using branches, not tags, because we are still patching things from time to time (when making things work with latest V, or to support/wrap APIs that were missed), and branches can be updated, and then
git pullwill get the new changes, unlike tags, that can not be updated easily, once published.
Thanks @spytheman. I see. Installing a branch works as well. Gonna, add this to the tests cases then too.
v install sdl@2.0.9So sdl version installs are covered @larpon.
I work something out to compare differences, so that a branch installation can be updated without needing to confirm or add a force flag. And eventually add installations of commit SHAs.

The change updates and extends VPM to install module versions based on git tags.
E.g. when installing modules
And when specifying dependencies in a v.mod file
Module { // ... dependencies: ['publisher.module@v0.6.0', 'https://github.com/publisher/repository@v1.0.0'] }Will also create the base for some great followup features.
🤖 Generated by Copilot at fc08098
This pull request enhances the
vpmtool with new features and tests for installing modules from various sources. It adds a newis_forceoption, a newis_externalfield, and a newInstallResultenum to improve the logic and user interface of thev installcommand. It also adds output assertions and version tag support to the existing and new test functions independency_test.v,install_test.v, andinstall_version_test.v.🤖 Generated by Copilot at fc08098
is_externalto theModulestruct and use it to simplify the logic of installing modules from external URLs or VPM identifiers (link, link, link, link, link)InstallResultand use it to handle different outcomes of installing a module, such asinstalled,failed, orskipped(link, link, link)confirm_installto theModulestruct and a new functionat_versionto prompt the user to confirm the installation of a module if it is already installed with a different version (link)is_forceto theSettingsstruct and use it to allow the user to overwrite the existing installation of a module without confirmation (link, link)has_vmodfunction to take aninstall_pathparameter and skip fetching the remote repository if the module is already installed and has av.modfile (link, link)vpm_install_from_vcsfunction to check the VCS executable once and print the modules array for debugging (link)installmethod of theModulestruct to print more verbose messages and handle specifying the version tag (link)v installcommand in thetest_install_from_git_urlfunction to reflect the changes in theinstallmethod of theModulestruct (link)v installcommand in various test functions (link, link, link, link, link)install_version_test.vwith two new test functions to test the functionality of installing modules with specific version tags from VPM identifiers or external URLs (link)