Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions install/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand All @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions install/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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 {
Expand Down
Loading