diff --git a/install.go b/install.go index 76ceb92d..584b09f5 100644 --- a/install.go +++ b/install.go @@ -634,14 +634,12 @@ func buildInstallPkgbuilds( satisfied := true all: for _, pkg := range base { - for _, deps := range dep.ComputeCombinedDepList(pkg, noDeps, noCheck) { - for _, dep := range deps { - if !dp.AlpmExecutor.LocalSatisfierExists(dep) { - satisfied = false - text.Warnln(gotext.Get("%s not satisfied, flushing install queue", dep)) + for _, dep := range dep.ComputeCombinedDepList(pkg, noDeps, noCheck) { + if !dp.AlpmExecutor.LocalSatisfierExists(dep) { + satisfied = false + text.Warnln(gotext.Get("%s not satisfied, flushing install queue", dep)) - break all - } + break all } } } diff --git a/pkg/dep/depCheck.go b/pkg/dep/depCheck.go index 02aab7a8..16ea0a73 100644 --- a/pkg/dep/depCheck.go +++ b/pkg/dep/depCheck.go @@ -230,15 +230,13 @@ func (dp *Pool) _checkMissing(dep string, stack []string, missing *missing, noDe missing.Good.Set(dep) combinedDepList := ComputeCombinedDepList(aurPkg, noDeps, noCheckDeps) - for _, deps := range combinedDepList { - for _, aurDep := range deps { - if dp.AlpmExecutor.LocalSatisfierExists(aurDep) { - missing.Good.Set(aurDep) - continue - } - - dp._checkMissing(aurDep, append(stack, aurPkg.Name), missing, noDeps, noCheckDeps) + for _, aurDep := range combinedDepList { + if dp.AlpmExecutor.LocalSatisfierExists(aurDep) { + missing.Good.Set(aurDep) + continue } + + dp._checkMissing(aurDep, append(stack, aurPkg.Name), missing, noDeps, noCheckDeps) } return diff --git a/pkg/dep/depOrder.go b/pkg/dep/depOrder.go index 6550b040..69233407 100644 --- a/pkg/dep/depOrder.go +++ b/pkg/dep/depOrder.go @@ -48,15 +48,13 @@ func (do *Order) orderPkgAur(pkg *aur.Pkg, dp *Pool, runtime, noDeps, noCheckDep delete(dp.Aur, pkg.Name) - for i, deps := range ComputeCombinedDepList(pkg, noDeps, noCheckDeps) { - for _, dep := range deps { - if aurPkg := dp.findSatisfierAur(dep); aurPkg != nil { - do.orderPkgAur(aurPkg, dp, runtime && i == 0, noDeps, noCheckDeps) - } + for i, dep := range ComputeCombinedDepList(pkg, noDeps, noCheckDeps) { + if aurPkg := dp.findSatisfierAur(dep); aurPkg != nil { + do.orderPkgAur(aurPkg, dp, runtime && i == 0, noDeps, noCheckDeps) + } - if repoPkg := dp.findSatisfierRepo(dep); repoPkg != nil { - do.orderPkgRepo(repoPkg, dp, runtime && i == 0) - } + if repoPkg := dp.findSatisfierRepo(dep); repoPkg != nil { + do.orderPkgRepo(repoPkg, dp, runtime && i == 0) } } diff --git a/pkg/dep/depPool.go b/pkg/dep/depPool.go index 2848c6c3..845d4a97 100644 --- a/pkg/dep/depPool.go +++ b/pkg/dep/depPool.go @@ -61,10 +61,10 @@ type Pool struct { Groups []string AlpmExecutor db.Executor Warnings *query.AURWarnings - aurClient *aur.Client + aurClient aur.ClientInterface } -func newPool(dbExecutor db.Executor, aurClient *aur.Client) *Pool { +func newPool(dbExecutor db.Executor, aurClient aur.ClientInterface) *Pool { dp := &Pool{ Targets: []Target{}, Explicit: map[string]struct{}{}, @@ -275,17 +275,17 @@ func (dp *Pool) cacheAURPackages(ctx context.Context, _pkgs stringset.StringSet, // Compute dependency lists used in Package dep searching and ordering. // Order sensitive TOFIX. -func ComputeCombinedDepList(pkg *aur.Pkg, noDeps, noCheckDeps bool) [][]string { - combinedDepList := make([][]string, 0, 3) +func ComputeCombinedDepList(pkg *aur.Pkg, noDeps, noCheckDeps bool) []string { + combinedDepList := make([]string, 0, len(pkg.Depends)+len(pkg.MakeDepends)+len(pkg.CheckDepends)) if !noDeps { - combinedDepList = append(combinedDepList, pkg.Depends) + combinedDepList = append(combinedDepList, pkg.Depends...) } - combinedDepList = append(combinedDepList, pkg.MakeDepends) + combinedDepList = append(combinedDepList, pkg.MakeDepends...) if !noCheckDeps { - combinedDepList = append(combinedDepList, pkg.CheckDepends) + combinedDepList = append(combinedDepList, pkg.CheckDepends...) } return combinedDepList @@ -326,10 +326,8 @@ func (dp *Pool) resolveAURPackages(ctx context.Context, dp.Aur[pkg.Name] = pkg combinedDepList := ComputeCombinedDepList(pkg, noDeps, noCheckDeps) - for _, deps := range combinedDepList { - for _, dep := range deps { - newPackages.Set(dep) - } + for _, dep := range combinedDepList { + newPackages.Set(dep) } } @@ -391,7 +389,7 @@ func (dp *Pool) ResolveRepoDependency(pkg db.IPackage, noDeps bool) { func GetPool(ctx context.Context, pkgs []string, warnings *query.AURWarnings, dbExecutor db.Executor, - aurClient *aur.Client, + aurClient aur.ClientInterface, mode parser.TargetMode, ignoreProviders, noConfirm, provides bool, rebuild string, splitN int, noDeps bool, noCheckDeps bool, assumeInstalled []string, diff --git a/pkg/query/aur_info.go b/pkg/query/aur_info.go index d9b83ca1..4b81fa7d 100644 --- a/pkg/query/aur_info.go +++ b/pkg/query/aur_info.go @@ -19,7 +19,7 @@ type Pkg = aur.Pkg // of packages exceeds the number set in config.RequestSplitN. // If the number does exceed config.RequestSplitN multiple aur requests will be // performed concurrently. -func AURInfo(ctx context.Context, aurClient *aur.Client, names []string, warnings *AURWarnings, splitN int) ([]*Pkg, error) { +func AURInfo(ctx context.Context, aurClient aur.ClientInterface, names []string, warnings *AURWarnings, splitN int) ([]*Pkg, error) { info := make([]*Pkg, 0, len(names)) seen := make(map[string]int) @@ -84,7 +84,7 @@ func AURInfo(ctx context.Context, aurClient *aur.Client, names []string, warning return info, nil } -func AURInfoPrint(ctx context.Context, aurClient *aur.Client, names []string, splitN int) ([]*Pkg, error) { +func AURInfoPrint(ctx context.Context, aurClient aur.ClientInterface, names []string, splitN int) ([]*Pkg, error) { text.OperationInfoln(gotext.Get("Querying AUR...")) warnings := &AURWarnings{} diff --git a/pkg/query/mixed_sources.go b/pkg/query/mixed_sources.go index 3e5c21ff..decf8586 100644 --- a/pkg/query/mixed_sources.go +++ b/pkg/query/mixed_sources.go @@ -25,7 +25,7 @@ const sourceAUR = "aur" type Builder interface { Len() int - Execute(ctx context.Context, dbExecutor db.Executor, aurClient *aur.Client, pkgS []string) + Execute(ctx context.Context, dbExecutor db.Executor, aurClient aur.ClientInterface, pkgS []string) Results(w io.Writer, dbExecutor db.Executor, verboseSearch SearchVerbosity) error GetTargets(include, exclude intrange.IntRanges, otherExclude stringset.StringSet) ([]string, error) } @@ -122,7 +122,7 @@ func (a *abstractResults) Less(i, j int) bool { return simA > simB } -func (s *MixedSourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, aurClient *aur.Client, pkgS []string) { +func (s *MixedSourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, aurClient aur.ClientInterface, pkgS []string) { var aurErr error pkgS = RemoveInvalidTargets(pkgS, s.targetMode) diff --git a/pkg/query/source.go b/pkg/query/source.go index 3b1a200c..1dcaeca2 100644 --- a/pkg/query/source.go +++ b/pkg/query/source.go @@ -54,7 +54,7 @@ func NewSourceQueryBuilder( } } -func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, aurClient *aur.Client, pkgS []string) { +func (s *SourceQueryBuilder) Execute(ctx context.Context, dbExecutor db.Executor, aurClient aur.ClientInterface, pkgS []string) { var aurErr error pkgS = RemoveInvalidTargets(pkgS, s.targetMode) @@ -176,7 +176,7 @@ func filterAURResults(pkgS []string, results []aur.Pkg) []aur.Pkg { } // queryAUR searches AUR and narrows based on subarguments. -func queryAUR(ctx context.Context, aurClient *aur.Client, pkgS []string, searchBy string) ([]aur.Pkg, error) { +func queryAUR(ctx context.Context, aurClient aur.ClientInterface, pkgS []string, searchBy string) ([]aur.Pkg, error) { var ( err error by = getSearchBy(searchBy) diff --git a/query.go b/query.go index 04d9e0b9..eca59a9f 100644 --- a/query.go +++ b/query.go @@ -19,7 +19,7 @@ import ( ) // SyncSearch presents a query to the local repos and to the AUR. -func syncSearch(ctx context.Context, pkgS []string, aurClient *aur.Client, +func syncSearch(ctx context.Context, pkgS []string, aurClient aur.ClientInterface, dbExecutor db.Executor, queryBuilder query.Builder, verbose bool, ) error { queryBuilder.Execute(ctx, dbExecutor, aurClient, pkgS) diff --git a/vote.go b/vote.go index 0ba92860..b0b231b8 100644 --- a/vote.go +++ b/vote.go @@ -22,7 +22,7 @@ func (e *ErrAURVote) Error() string { } func handlePackageVote(ctx context.Context, - targets []string, aurClient *aur.Client, + targets []string, aurClient aur.ClientInterface, voteClient *vote.Client, splitN int, upvote bool, ) error { infos, err := query.AURInfoPrint(ctx, aurClient, targets, splitN)