Przeglądaj źródła

use aur package metadata client

jguer 2 lat temu
rodzic
commit
2358a7f66e

+ 3 - 5
go.mod

@@ -1,7 +1,7 @@
 module github.com/Jguer/yay/v11
 
 require (
-	github.com/Jguer/aur v1.1.0
+	github.com/Jguer/aur v1.1.1
 	github.com/Jguer/go-alpm/v2 v2.1.2
 	github.com/Jguer/votar v1.0.0
 	github.com/Morganamilo/go-pacmanconf v0.0.0-20210502114700-cff030e927a5
@@ -26,11 +26,9 @@ require (
 
 require (
 	github.com/deckarep/golang-set/v2 v2.1.0
-	github.com/itchyny/gojq v0.12.9
+	github.com/itchyny/gojq v0.12.9 // indirect
 	github.com/itchyny/timefmt-go v0.1.4 // indirect
-	github.com/ohler55/ojg v1.14.5
+	github.com/ohler55/ojg v1.14.5 // indirect
 )
 
-require github.com/stretchr/objx v0.5.0 // indirect
-
 go 1.19

+ 2 - 5
go.sum

@@ -1,7 +1,7 @@
-github.com/Jguer/aur v1.0.1 h1:+GDOq0RuVn7CXpXzd8W85/+hPNDYonRZ3ONPm87e1jo=
-github.com/Jguer/aur v1.0.1/go.mod h1:1/SQjhWahmk2xKcmAm6XO1zGqK8HgYw3xlJM6a7845E=
 github.com/Jguer/aur v1.1.0 h1:dXWozXMnNH0JciixDjvAZ32luVnxGdSnrSoJfd8YeYw=
 github.com/Jguer/aur v1.1.0/go.mod h1:JRMEdcTsAqsytKUNEEczeXjz+k0r7xigUZ3zx45Y6BY=
+github.com/Jguer/aur v1.1.1 h1:EP/yHE9opw6odpTe4ZQll/rHjal/XiTt1PuZ7Fkm/ks=
+github.com/Jguer/aur v1.1.1/go.mod h1:JRMEdcTsAqsytKUNEEczeXjz+k0r7xigUZ3zx45Y6BY=
 github.com/Jguer/go-alpm/v2 v2.1.2 h1:CGTIxzuEpT9Q3a7IBrx0E6acoYoaHX2Z93UOApPDhgU=
 github.com/Jguer/go-alpm/v2 v2.1.2/go.mod h1:uLQcTMNM904dRiGU+/JDtDdd7Nd8mVbEVaHjhmziT7w=
 github.com/Jguer/votar v1.0.0 h1:drPYpV5Py5BeAQS8xezmT6uCEfLzotNjLf5yfmlHKTg=
@@ -38,7 +38,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
 github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
-github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
 github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
 github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
 github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
@@ -46,7 +45,6 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
 github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
-github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
 github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
 github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
 github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
@@ -72,6 +70,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
 gopkg.in/h2non/gock.v1 v1.1.2 h1:jBbHXgGBK/AoPVfJh5x4r/WxIrElvbLel8TCZkkZJoY=
 gopkg.in/h2non/gock.v1 v1.1.2/go.mod h1:n7UGz/ckNChHiK05rDoiC4MYSunEC/lyaUm2WWaDva0=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
-gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
 gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

+ 4 - 3
pkg/cmd/graph/main.go

@@ -3,17 +3,16 @@ package main
 import (
 	"context"
 	"fmt"
-	"net/http"
 	"os"
 	"path/filepath"
 
 	"github.com/Jguer/yay/v11/pkg/db/ialpm"
 	"github.com/Jguer/yay/v11/pkg/dep"
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	"github.com/Jguer/yay/v11/pkg/settings"
 	"github.com/Jguer/yay/v11/pkg/settings/parser"
 	"github.com/Jguer/yay/v11/pkg/text"
 
+	"github.com/Jguer/aur/metadata"
 	"github.com/leonelquinteros/gotext"
 	"github.com/pkg/errors"
 )
@@ -39,7 +38,9 @@ func handleCmd() error {
 		return err
 	}
 
-	aurCache, err := metadata.NewAURCache(http.DefaultClient, filepath.Join(config.BuildDir, "aur.json"))
+	aurCache, err := metadata.New(
+		metadata.WithCacheFilePath(
+			filepath.Join(config.BuildDir, "aur.json")))
 	if err != nil {
 		return errors.Wrap(err, gotext.Get("failed to retrieve aur Cache"))
 	}

+ 3 - 3
pkg/dep/depGraph.go

@@ -8,12 +8,12 @@ import (
 	"strconv"
 
 	"github.com/Jguer/yay/v11/pkg/db"
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	aur "github.com/Jguer/yay/v11/pkg/query"
 	"github.com/Jguer/yay/v11/pkg/text"
 	"github.com/Jguer/yay/v11/pkg/topo"
 
 	aurc "github.com/Jguer/aur"
+	"github.com/Jguer/aur/metadata"
 	gosrc "github.com/Morganamilo/go-srcinfo"
 	"github.com/leonelquinteros/gotext"
 )
@@ -90,7 +90,7 @@ var colorMap = map[Reason]string{
 
 type Grapher struct {
 	dbExecutor db.Executor
-	aurCache   *metadata.AURCacheClient
+	aurCache   *metadata.Client
 	fullGraph  bool // If true, the graph will include all dependencies including already installed ones or repo
 	noConfirm  bool
 	w          io.Writer // output writer
@@ -98,7 +98,7 @@ type Grapher struct {
 	providerCache map[string]*aur.Pkg
 }
 
-func NewGrapher(dbExecutor db.Executor, aurCache *metadata.AURCacheClient,
+func NewGrapher(dbExecutor db.Executor, aurCache *metadata.Client,
 	fullGraph, noConfirm bool, output io.Writer,
 ) *Grapher {
 	return &Grapher{

+ 0 - 205
pkg/metadata/metadata_aur.go

@@ -1,205 +0,0 @@
-package metadata
-
-import (
-	"context"
-	"fmt"
-	"os"
-	"time"
-
-	"github.com/Jguer/aur"
-	"github.com/itchyny/gojq"
-	"github.com/ohler55/ojg/oj"
-)
-
-const (
-	cacheValidity = 1 * time.Hour
-)
-
-type AURCacheClient struct {
-	httpClient    HTTPRequestDoer
-	cachePath     string
-	DebugLoggerFn func(a ...interface{})
-
-	unmarshalledCache []interface{}
-}
-
-type AURQuery struct {
-	Needles  []string
-	By       aur.By
-	Contains bool // if true, search for packages containing the needle, not exact matches
-}
-
-// ClientOption allows setting custom parameters during construction.
-type ClientOption func(*AURCacheClient) error
-
-func NewAURCache(httpClient HTTPRequestDoer, cachePath string, opts ...ClientOption) (*AURCacheClient, error) {
-	return &AURCacheClient{
-		httpClient: httpClient,
-		cachePath:  cachePath,
-	}, nil
-}
-
-// needsUpdate checks if cachepath is older than 24 hours.
-func (a *AURCacheClient) needsUpdate() (bool, error) {
-	// check if cache is older than 24 hours
-	info, err := os.Stat(a.cachePath)
-	if err != nil {
-		if os.IsNotExist(err) {
-			return true, nil
-		}
-
-		return false, fmt.Errorf("unable to read cache: %w", err)
-	}
-
-	return info.ModTime().Before(time.Now().Add(-cacheValidity)), nil
-}
-
-// Get returns a list of packages that provide the given search term.
-func (a *AURCacheClient) Get(ctx context.Context, query *AURQuery) ([]*aur.Pkg, error) {
-	found := make([]*aur.Pkg, 0, len(query.Needles))
-	if len(query.Needles) == 0 {
-		return found, nil
-	}
-
-	iterFound, errNeedle := a.gojqGetBatch(ctx, query)
-	if errNeedle != nil {
-		return nil, errNeedle
-	}
-
-	found = append(found, iterFound...)
-
-	return found, nil
-}
-
-func (a *AURCacheClient) cache(ctx context.Context) ([]interface{}, error) {
-	if a.unmarshalledCache != nil {
-		return a.unmarshalledCache, nil
-	}
-
-	update, err := a.needsUpdate()
-	if err != nil {
-		return nil, err
-	}
-
-	if update {
-		if a.DebugLoggerFn != nil {
-			a.DebugLoggerFn("AUR Cache is out of date, updating")
-		}
-		cache, makeErr := MakeCache(ctx, a.httpClient, a.cachePath)
-		if makeErr != nil {
-			return nil, makeErr
-		}
-
-		inputStruct, unmarshallErr := oj.Parse(cache)
-		if unmarshallErr != nil {
-			return nil, fmt.Errorf("aur metadata unable to parse cache: %w", unmarshallErr)
-		}
-
-		a.unmarshalledCache = inputStruct.([]interface{})
-	} else {
-		aurCache, err := ReadCache(a.cachePath)
-		if err != nil {
-			return nil, err
-		}
-
-		inputStruct, err := oj.Parse(aurCache)
-		if err != nil {
-			return nil, fmt.Errorf("aur metadata unable to parse cache: %w", err)
-		}
-
-		a.unmarshalledCache = inputStruct.([]interface{})
-	}
-
-	return a.unmarshalledCache, nil
-}
-
-func (a *AURCacheClient) gojqGetBatch(ctx context.Context, query *AURQuery) ([]*aur.Pkg, error) {
-	pattern := ".[] | select("
-
-	for i, searchTerm := range query.Needles {
-		if i != 0 {
-			pattern += ","
-		}
-
-		bys := toSearchBy(query.By)
-		for j, by := range bys {
-			if query.Contains {
-				pattern += fmt.Sprintf("(.%s // empty | test(%q))", by, searchTerm)
-			} else {
-				pattern += fmt.Sprintf("(.%s == %q)", by, searchTerm)
-			}
-
-			if j != len(bys)-1 {
-				pattern += ","
-			}
-		}
-	}
-
-	pattern += ")"
-
-	if a.DebugLoggerFn != nil {
-		a.DebugLoggerFn("AUR metadata query", pattern)
-	}
-
-	parsed, err := gojq.Parse(pattern)
-	if err != nil {
-		return nil, fmt.Errorf("unable to parse query: %w", err)
-	}
-
-	unmarshalledCache, errCache := a.cache(ctx)
-	if errCache != nil {
-		return nil, errCache
-	}
-
-	final := make([]*aur.Pkg, 0, len(query.Needles))
-	iter := parsed.RunWithContext(ctx, unmarshalledCache) // or query.RunWithContext
-
-	for pkgMap, ok := iter.Next(); ok; pkgMap, ok = iter.Next() {
-		if err, ok := pkgMap.(error); ok {
-			return nil, err
-		}
-
-		pkg := new(aur.Pkg)
-
-		bValue, err := gojq.Marshal(pkgMap)
-		if err != nil {
-			return nil, fmt.Errorf("unable to marshal aur package: %w", err)
-		}
-
-		errU := oj.Unmarshal(bValue, pkg)
-		if errU != nil {
-			return nil, fmt.Errorf("unable to unmarshal aur package: %w", errU)
-		}
-
-		final = append(final, pkg)
-	}
-
-	if a.DebugLoggerFn != nil {
-		a.DebugLoggerFn("AUR metadata query found", len(final))
-	}
-
-	return final, nil
-}
-
-func toSearchBy(by aur.By) []string {
-	switch by {
-	case aur.Name:
-		return []string{"Name"}
-	case aur.NameDesc:
-		return []string{"Name", "Description"}
-	case aur.Maintainer:
-		return []string{"Maintainer"}
-	case aur.Depends:
-		return []string{"Depends[]?"}
-	case aur.MakeDepends:
-		return []string{"MakeDepends[]?"}
-	case aur.OptDepends:
-		return []string{"OptDepends[]?"}
-	case aur.CheckDepends:
-		return []string{"CheckDepends[]?"}
-	case aur.None:
-		return []string{"Name", "Provides[]?"}
-	default:
-		panic("invalid By")
-	}
-}

+ 0 - 79
pkg/metadata/metadata_downloader.go

@@ -1,79 +0,0 @@
-package metadata
-
-import (
-	"context"
-	"fmt"
-	"io"
-	"net/http"
-	"os"
-)
-
-type HTTPRequestDoer interface {
-	Do(req *http.Request) (*http.Response, error)
-}
-
-func ReadCache(cachePath string) ([]byte, error) {
-	fp, err := os.Open(cachePath)
-	if err != nil {
-		if os.IsNotExist(err) {
-			return nil, nil
-		}
-
-		return nil, err
-	}
-
-	defer fp.Close()
-
-	s, err := io.ReadAll(fp)
-	if err != nil {
-		return nil, err
-	}
-
-	return s, nil
-}
-
-// Download the metadata for aur packages.
-// create cache file
-// write to cache file.
-func MakeCache(ctx context.Context, httpClient HTTPRequestDoer, cachePath string) ([]byte, error) {
-	body, err := downloadAURMetadata(ctx, httpClient)
-	if err != nil {
-		return nil, err
-	}
-	defer body.Close()
-
-	s, err := io.ReadAll(body)
-	if err != nil {
-		return nil, err
-	}
-
-	f, err := os.Create(cachePath)
-	if err != nil {
-		return nil, err
-	}
-	defer f.Close()
-
-	if _, err = f.Write(s); err != nil {
-		return nil, err
-	}
-
-	return s, err
-}
-
-func downloadAURMetadata(ctx context.Context, httpClient HTTPRequestDoer) (io.ReadCloser, error) {
-	req, err := http.NewRequestWithContext(ctx, "GET", "https://aur.archlinux.org/packages-meta-ext-v1.json.gz", http.NoBody)
-	if err != nil {
-		return nil, fmt.Errorf("failed to create request: %w", err)
-	}
-
-	resp, err := httpClient.Do(req)
-	if err != nil {
-		return nil, err
-	}
-
-	if resp.StatusCode != http.StatusOK {
-		return nil, fmt.Errorf("failed to download metadata: %s", resp.Status)
-	}
-
-	return resp.Body, nil
-}

+ 5 - 4
pkg/query/source.go

@@ -12,10 +12,11 @@ import (
 
 	"github.com/Jguer/yay/v11/pkg/db"
 	"github.com/Jguer/yay/v11/pkg/intrange"
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	"github.com/Jguer/yay/v11/pkg/settings/parser"
 	"github.com/Jguer/yay/v11/pkg/stringset"
 	"github.com/Jguer/yay/v11/pkg/text"
+
+	"github.com/Jguer/aur/metadata"
 )
 
 type SearchVerbosity int
@@ -39,12 +40,12 @@ type SourceQueryBuilder struct {
 	singleLineResults bool
 
 	aurClient aur.ClientInterface
-	aurCache  *metadata.AURCacheClient
+	aurCache  *metadata.Client
 }
 
 func NewSourceQueryBuilder(
 	aurClient aur.ClientInterface,
-	aurCache *metadata.AURCacheClient,
+	aurCache *metadata.Client,
 	sortBy string,
 	targetMode parser.TargetMode,
 	searchBy string,
@@ -192,7 +193,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.ClientInterface, aurMetadata *metadata.AURCacheClient,
+	aurClient aur.ClientInterface, aurMetadata *metadata.Client,
 	pkgS []string, searchBy string, newEngine bool,
 ) ([]aur.Pkg, error) {
 	var (

+ 21 - 16
pkg/settings/config.go

@@ -11,17 +11,16 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/leonelquinteros/gotext"
-	"github.com/pkg/errors"
-
-	"github.com/Jguer/aur"
-	"github.com/Jguer/votar/pkg/vote"
-
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	"github.com/Jguer/yay/v11/pkg/settings/exe"
 	"github.com/Jguer/yay/v11/pkg/settings/parser"
 	"github.com/Jguer/yay/v11/pkg/text"
 	"github.com/Jguer/yay/v11/pkg/vcs"
+
+	"github.com/Jguer/aur"
+	"github.com/Jguer/aur/metadata"
+	"github.com/Jguer/votar/pkg/vote"
+	"github.com/leonelquinteros/gotext"
+	"github.com/pkg/errors"
 )
 
 // HideMenus indicates if pacman's provider menus must be hidden.
@@ -291,20 +290,26 @@ func NewConfig(version string) (*Configuration, error) {
 
 	var errAURCache error
 
-	newConfig.Runtime.AURCache, errAURCache = metadata.NewAURCache(newConfig.Runtime.HTTPClient, filepath.Join(newConfig.BuildDir, "aur.json"))
+	userAgentFn := func(ctx context.Context, req *http.Request) error {
+		req.Header.Set("User-Agent", userAgent)
+		return nil
+	}
+
+	newConfig.Runtime.AURCache, errAURCache = metadata.New(
+		metadata.WithHTTPClient(newConfig.Runtime.HTTPClient),
+		metadata.WithCacheFilePath(filepath.Join(newConfig.BuildDir, "aur.json")),
+		metadata.WithRequestEditorFn(userAgentFn),
+		metadata.WithBaseURL(newConfig.AURURL),
+		metadata.WithDebugLogger(text.Debugln),
+	)
 	if errAURCache != nil {
 		return nil, errors.Wrap(errAURCache, gotext.Get("failed to retrieve aur Cache"))
 	}
 
-	newConfig.Runtime.AURCache.DebugLoggerFn = text.Debugln
-
 	var errAUR error
-	newConfig.Runtime.AURClient, errAUR = aur.NewClient(aur.WithHTTPClient(newConfig.Runtime.HTTPClient),
-		aur.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error {
-			req.Header.Set("User-Agent", userAgent)
-
-			return nil
-		}))
+	newConfig.Runtime.AURClient, errAUR = aur.NewClient(
+		aur.WithHTTPClient(newConfig.Runtime.HTTPClient),
+		aur.WithRequestEditorFn(userAgentFn))
 
 	if errAUR != nil {
 		return nil, errAUR

+ 6 - 7
pkg/settings/runtime.go

@@ -3,17 +3,16 @@ package settings
 import (
 	"net/http"
 
-	"github.com/Morganamilo/go-pacmanconf"
-
-	"github.com/Jguer/aur"
-	"github.com/Jguer/votar/pkg/vote"
-
 	"github.com/Jguer/yay/v11/pkg/db"
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	"github.com/Jguer/yay/v11/pkg/query"
 	"github.com/Jguer/yay/v11/pkg/settings/exe"
 	"github.com/Jguer/yay/v11/pkg/settings/parser"
 	"github.com/Jguer/yay/v11/pkg/vcs"
+
+	"github.com/Jguer/aur"
+	"github.com/Jguer/aur/metadata"
+	"github.com/Jguer/votar/pkg/vote"
+	"github.com/Morganamilo/go-pacmanconf"
 )
 
 type Runtime struct {
@@ -29,6 +28,6 @@ type Runtime struct {
 	HTTPClient     *http.Client
 	AURClient      *aur.Client
 	VoteClient     *vote.Client
-	AURCache       *metadata.AURCacheClient
+	AURCache       *metadata.Client
 	DBExecutor     db.Executor
 }

+ 7 - 7
upgrade.go

@@ -7,14 +7,9 @@ import (
 	"strings"
 	"sync"
 
-	aur "github.com/Jguer/aur"
-	alpm "github.com/Jguer/go-alpm/v2"
-	"github.com/leonelquinteros/gotext"
-
 	"github.com/Jguer/yay/v11/pkg/db"
 	"github.com/Jguer/yay/v11/pkg/dep"
 	"github.com/Jguer/yay/v11/pkg/intrange"
-	"github.com/Jguer/yay/v11/pkg/metadata"
 	"github.com/Jguer/yay/v11/pkg/multierror"
 	"github.com/Jguer/yay/v11/pkg/query"
 	"github.com/Jguer/yay/v11/pkg/settings"
@@ -22,6 +17,11 @@ import (
 	"github.com/Jguer/yay/v11/pkg/text"
 	"github.com/Jguer/yay/v11/pkg/topo"
 	"github.com/Jguer/yay/v11/pkg/upgrade"
+
+	aur "github.com/Jguer/aur"
+	"github.com/Jguer/aur/metadata"
+	alpm "github.com/Jguer/go-alpm/v2"
+	"github.com/leonelquinteros/gotext"
 )
 
 func filterUpdateList(list []db.Upgrade, filter upgrade.Filter) []db.Upgrade {
@@ -37,7 +37,7 @@ func filterUpdateList(list []db.Upgrade, filter upgrade.Filter) []db.Upgrade {
 }
 
 // upList returns lists of packages to upgrade from each source.
-func upList(ctx context.Context, aurCache *metadata.AURCacheClient,
+func upList(ctx context.Context, aurCache *metadata.Client,
 	warnings *query.AURWarnings, dbExecutor db.Executor, enableDowngrade bool,
 	filter upgrade.Filter,
 ) (aurUp, repoUp upgrade.UpSlice, err error) {
@@ -261,7 +261,7 @@ func sysupgradeTargets(ctx context.Context, dbExecutor db.Executor,
 
 // Targets for sys upgrade.
 func sysupgradeTargetsV2(ctx context.Context,
-	aurCache *metadata.AURCacheClient,
+	aurCache *metadata.Client,
 	dbExecutor db.Executor,
 	graph *topo.Graph[string, *dep.InstallInfo],
 	enableDowngrade bool,