diff --git a/install/install.go b/install/install.go index eab1bf2..1bff6c9 100644 --- a/install/install.go +++ b/install/install.go @@ -163,7 +163,7 @@ func FromRepo(ctx context.Context, pi goolib.PackageInfo, repo, cache string, rm 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 + var rsErr error // If no version is specified, resolve the latest version handling both // direct matches and providers. if pi.Ver == "" { @@ -180,11 +180,11 @@ func FromRepo(ctx context.Context, pi goolib.PackageInfo, repo, cache string, rm } 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, rsErr = client.FindRepoSpec(pi, rm[repo]) } - if err != nil { - return err + if rsErr != nil { + return rsErr } if err := installDeps(ctx, rs.PackageSpec, cache, rm, archs, dbOnly, downloader, db); 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 {