diff --git a/cmd/tools/vpm/dependency_test.v b/cmd/tools/vpm/dependency_test.v index d3922eac865a7f..c7bbc7040123bd 100644 --- a/cmd/tools/vpm/dependency_test.v +++ b/cmd/tools/vpm/dependency_test.v @@ -49,14 +49,17 @@ fn test_install_dependencies_in_module_dir() { } assert v_mod.dependencies == ['markdown', 'pcre', 'https://github.com/spytheman/vtray'] // Run `v install` - res := os.execute_or_exit('${v} install') + mut res := os.execute_or_exit('${v} install --once') assert res.output.contains('Detected v.mod file inside the project directory. Using it...'), res.output assert res.output.contains('Installing `markdown`'), res.output assert res.output.contains('Installing `pcre`'), res.output assert res.output.contains('Installing `vtray`'), res.output + assert get_mod_name(os.join_path(test_path, 'markdown', 'v.mod')) == 'markdown' assert get_mod_name(os.join_path(test_path, 'pcre', 'v.mod')) == 'pcre' assert get_mod_name(os.join_path(test_path, 'vtray', 'v.mod')) == 'vtray' + res = os.execute_or_exit('${v} install --once') + assert res.output.contains('All modules are already installed.'), res.output } fn test_resolve_external_dependencies_during_module_install() { diff --git a/cmd/tools/vpm/install.v b/cmd/tools/vpm/install.v index cce28eeea4f8aa..2e48ed571de666 100644 --- a/cmd/tools/vpm/install.v +++ b/cmd/tools/vpm/install.v @@ -43,6 +43,7 @@ fn vpm_install(query []string) { vpm_log(@FILE_LINE, @FN, 'Installed modules: ${installed_modules}') if installed_modules.len > 0 && settings.is_once { + num_to_install := vpm_modules.len + external_modules.len mut already_installed := []string{} if external_modules.len > 0 { mut i_deleted := []int{} @@ -70,7 +71,7 @@ fn vpm_install(query []string) { } if already_installed.len > 0 { verbose_println('Already installed modules: ${already_installed}') - if already_installed.len == query.len { + if already_installed.len == num_to_install { println('All modules are already installed.') exit(0) }