|
@@ -5,7 +5,6 @@ import (
|
|
|
"sort"
|
|
|
|
|
|
"github.com/Jguer/aur"
|
|
|
- "github.com/Jguer/aur/metadata"
|
|
|
"github.com/Jguer/go-alpm/v2"
|
|
|
mapset "github.com/deckarep/golang-set/v2"
|
|
|
"github.com/leonelquinteros/gotext"
|
|
@@ -14,7 +13,6 @@ import (
|
|
|
"github.com/Jguer/yay/v11/pkg/dep"
|
|
|
"github.com/Jguer/yay/v11/pkg/intrange"
|
|
|
"github.com/Jguer/yay/v11/pkg/multierror"
|
|
|
- "github.com/Jguer/yay/v11/pkg/query"
|
|
|
"github.com/Jguer/yay/v11/pkg/settings"
|
|
|
"github.com/Jguer/yay/v11/pkg/text"
|
|
|
"github.com/Jguer/yay/v11/pkg/topo"
|
|
@@ -23,8 +21,7 @@ import (
|
|
|
|
|
|
type UpgradeService struct {
|
|
|
grapher *dep.Grapher
|
|
|
- aurCache settings.AURCache
|
|
|
- aurClient aur.ClientInterface
|
|
|
+ aurCache aur.QueryClient
|
|
|
dbExecutor db.Executor
|
|
|
vcsStore vcs.Store
|
|
|
runtime *settings.Runtime
|
|
@@ -33,15 +30,13 @@ type UpgradeService struct {
|
|
|
noConfirm bool
|
|
|
}
|
|
|
|
|
|
-func NewUpgradeService(grapher *dep.Grapher, aurCache settings.AURCache,
|
|
|
- aurClient aur.ClientInterface, dbExecutor db.Executor,
|
|
|
- vcsStore vcs.Store, runtime *settings.Runtime, cfg *settings.Configuration,
|
|
|
- noConfirm bool, logger *text.Logger,
|
|
|
+func NewUpgradeService(grapher *dep.Grapher, aurCache aur.QueryClient,
|
|
|
+ dbExecutor db.Executor, vcsStore vcs.Store, runtime *settings.Runtime,
|
|
|
+ cfg *settings.Configuration, noConfirm bool, logger *text.Logger,
|
|
|
) *UpgradeService {
|
|
|
return &UpgradeService{
|
|
|
grapher: grapher,
|
|
|
aurCache: aurCache,
|
|
|
- aurClient: aurClient,
|
|
|
dbExecutor: dbExecutor,
|
|
|
vcsStore: vcsStore,
|
|
|
runtime: runtime,
|
|
@@ -53,7 +48,7 @@ func NewUpgradeService(grapher *dep.Grapher, aurCache settings.AURCache,
|
|
|
|
|
|
// upGraph adds packages to upgrade to the graph.
|
|
|
func (u *UpgradeService) upGraph(ctx context.Context, graph *topo.Graph[string, *dep.InstallInfo],
|
|
|
- warnings *query.AURWarnings, enableDowngrade bool,
|
|
|
+ enableDowngrade bool,
|
|
|
filter Filter,
|
|
|
) (err error) {
|
|
|
var (
|
|
@@ -69,12 +64,7 @@ func (u *UpgradeService) upGraph(ctx context.Context, graph *topo.Graph[string,
|
|
|
if u.runtime.Mode.AtLeastAUR() {
|
|
|
u.log.OperationInfoln(gotext.Get("Searching AUR for updates..."))
|
|
|
|
|
|
- var _aurdata []aur.Pkg
|
|
|
- if u.aurCache != nil {
|
|
|
- _aurdata, err = u.aurCache.Get(ctx, &metadata.AURQuery{Needles: remoteNames, By: aur.Name})
|
|
|
- } else {
|
|
|
- _aurdata, err = query.AURInfo(ctx, u.aurClient, remoteNames, warnings, u.cfg.RequestSplitN)
|
|
|
- }
|
|
|
+ _aurdata, err := u.aurCache.Get(ctx, &aur.Query{Needles: remoteNames, By: aur.Name})
|
|
|
|
|
|
errs.Add(err)
|
|
|
|
|
@@ -235,16 +225,12 @@ func (u *UpgradeService) GraphUpgrades(ctx context.Context,
|
|
|
graph = topo.New[string, *dep.InstallInfo]()
|
|
|
}
|
|
|
|
|
|
- warnings := query.NewWarnings()
|
|
|
-
|
|
|
- err := u.upGraph(ctx, graph, warnings, enableDowngrade,
|
|
|
+ err := u.upGraph(ctx, graph, enableDowngrade,
|
|
|
func(*Upgrade) bool { return true })
|
|
|
if err != nil {
|
|
|
return graph, err
|
|
|
}
|
|
|
|
|
|
- warnings.Print()
|
|
|
-
|
|
|
if graph.Len() == 0 {
|
|
|
return graph, nil
|
|
|
}
|