diff --git a/install/install.go b/install/install.go index eab1bf2..598abba 100644 --- a/install/install.go +++ b/install/install.go @@ -162,8 +162,8 @@ func installDeps(ctx context.Context, ps *goolib.PkgSpec, cache string, rm clien func FromRepo(ctx context.Context, pi goolib.PackageInfo, repo, cache string, rm client.RepoMap, archs []string, dbOnly bool, downloader *client.Downloader, db *googetdb.GooDB) error { logger.Infof("Starting install of %s.%s.%s", pi.Name, pi.Arch, pi.Ver) fmt.Printf("Installing %s.%s.%s and dependencies...\n", pi.Name, pi.Arch, pi.Ver) - var rs goolib.RepoSpec - var err error + // When a specific version is requested, look for an exact match in the repository. + // Virtual package resolution is not currently supported for specific versions. // If no version is specified, resolve the latest version handling both // direct matches and providers. if pi.Ver == "" { @@ -176,13 +176,9 @@ func FromRepo(ctx context.Context, pi goolib.PackageInfo, repo, cache string, rm pi.Name = spec.Name pi.Arch = spec.Arch pi.Ver = spec.Version - rs, err = client.FindRepoSpec(goolib.PackageInfo{Name: spec.Name, Arch: spec.Arch, Ver: spec.Version}, rm[repo]) - } else { - // When a specific version is requested, look for an exact match in the repository. - // Virtual package resolution is not currently supported for specific versions. - rs, err = client.FindRepoSpec(pi, rm[repo]) } + rs, err := client.FindRepoSpec(pi, rm[repo]) if err != nil { return err } diff --git a/install/install_test.go b/install/install_test.go index 3561ef2..b9d6f67 100644 --- a/install/install_test.go +++ b/install/install_test.go @@ -437,7 +437,7 @@ func TestFromRepo_SatisfiedByProvider(t *testing.T) { // We pass empty repo map and downloader because we expect it NOT to try downloading deps // since they are satisfied. - err = installDeps(nil, ps, "", nil, nil, false, nil, db) + err = installDeps(t.Context(), ps, "", nil, nil, false, nil, db) if err != nil { t.Errorf("installDeps failed: %v", err) } @@ -479,7 +479,7 @@ func TestFromRepo_SatisfiedByUninstalledProvider(t *testing.T) { // Verify that dependency resolution succeeds (finding provider_pkg); the download // is expected to fail due to an invalid repository URL. downloader, _ := client.NewDownloader("") - err = installDeps(nil, ps, "", rm, []string{"noarch"}, false, downloader, db) + err = installDeps(t.Context(), ps, "", rm, []string{"noarch"}, false, downloader, db) // We expect an error because download will fail (invalid URL/Source). if err == nil {