diff --git a/pkg/dep/base.go b/pkg/dep/base.go index 7dfd9d29..950e89e3 100644 --- a/pkg/dep/base.go +++ b/pkg/dep/base.go @@ -1,6 +1,6 @@ package dep -import rpc "github.com/mikkeloscar/aur" +import rpc "github.com/Jguer/yay/v10/pkg/query" // Base is an AUR base package type Base []*rpc.Pkg diff --git a/pkg/dep/dep.go b/pkg/dep/dep.go index e87180fd..fe737e15 100644 --- a/pkg/dep/dep.go +++ b/pkg/dep/dep.go @@ -4,9 +4,9 @@ import ( "strings" alpm "github.com/Jguer/go-alpm/v2" - rpc "github.com/mikkeloscar/aur" "github.com/Jguer/yay/v10/pkg/db" + rpc "github.com/Jguer/yay/v10/pkg/query" "github.com/Jguer/yay/v10/pkg/text" ) diff --git a/pkg/dep/depOrder.go b/pkg/dep/depOrder.go index 514b153f..f83d8429 100644 --- a/pkg/dep/depOrder.go +++ b/pkg/dep/depOrder.go @@ -3,10 +3,9 @@ package dep import ( "fmt" - rpc "github.com/mikkeloscar/aur" - alpm "github.com/Jguer/go-alpm/v2" + rpc "github.com/Jguer/yay/v10/pkg/query" "github.com/Jguer/yay/v10/pkg/stringset" "github.com/Jguer/yay/v10/pkg/text" ) diff --git a/pkg/dep/depPool.go b/pkg/dep/depPool.go index 68da2fd7..a8ecd230 100644 --- a/pkg/dep/depPool.go +++ b/pkg/dep/depPool.go @@ -10,7 +10,6 @@ import ( "sync" "github.com/leonelquinteros/gotext" - rpc "github.com/mikkeloscar/aur" alpm "github.com/Jguer/go-alpm/v2" @@ -56,8 +55,8 @@ type Pool struct { Targets []Target Explicit stringset.StringSet Repo map[string]alpm.IPackage - Aur map[string]*rpc.Pkg - AurCache map[string]*rpc.Pkg + Aur map[string]*query.Pkg + AurCache map[string]*query.Pkg Groups []string AlpmExecutor db.Executor Warnings *query.AURWarnings @@ -68,8 +67,8 @@ func makePool(dbExecutor db.Executor) *Pool { make([]Target, 0), make(stringset.StringSet), make(map[string]alpm.IPackage), - make(map[string]*rpc.Pkg), - make(map[string]*rpc.Pkg), + make(map[string]*query.Pkg), + make(map[string]*query.Pkg), make([]string, 0), dbExecutor, nil, @@ -175,7 +174,7 @@ func (dp *Pool) findProvides(pkgs stringset.StringSet) error { doSearch := func(pkg string) { defer wg.Done() var err error - var results []rpc.Pkg + var results []query.Pkg // Hack for a bigger search result, if the user wants // java-envronment we can search for just java instead and get @@ -184,7 +183,7 @@ func (dp *Pool) findProvides(pkgs stringset.StringSet) error { words := strings.Split(pkg, "-") for i := range words { - results, err = rpc.Search(strings.Join(words[:i+1], "-")) + results, err = query.Search(strings.Join(words[:i+1], "-")) if err == nil { break } @@ -362,7 +361,7 @@ func GetPool(pkgs []string, return dp, err } -func (dp *Pool) findSatisfierAur(dep string) *rpc.Pkg { +func (dp *Pool) findSatisfierAur(dep string) *query.Pkg { for _, pkg := range dp.Aur { if satisfiesAur(dep, pkg) { return pkg @@ -382,7 +381,7 @@ func (dp *Pool) findSatisfierAur(dep string) *rpc.Pkg { // Using Pacman's ways trying to install foo would never give you // a menu. // TODO: maybe intermix repo providers in the menu -func (dp *Pool) findSatisfierAurCache(dep string, ignoreProviders, noConfirm, provides bool) *rpc.Pkg { +func (dp *Pool) findSatisfierAurCache(dep string, ignoreProviders, noConfirm, provides bool) *query.Pkg { depName, _, _ := splitDep(dep) seen := make(stringset.StringSet) providerSlice := makeProviders(depName) @@ -477,7 +476,7 @@ func (dp *Pool) hasPackage(name string) bool { return false } -func providerMenu(dep string, providers providers, noConfirm bool) *rpc.Pkg { +func providerMenu(dep string, providers providers, noConfirm bool) *query.Pkg { size := providers.Len() str := text.Bold(gotext.Get("There are %d providers available for %s:\n", size, dep)) diff --git a/pkg/query/aur_info.go b/pkg/query/aur_info.go index ce729696..828180fe 100644 --- a/pkg/query/aur_info.go +++ b/pkg/query/aur_info.go @@ -11,13 +11,20 @@ import ( "github.com/Jguer/yay/v10/pkg/text" ) +type Pkg = rpc.Pkg + +// Search is a reexport of rpc.Search +func Search(query string) ([]Pkg, error) { + return rpc.Search(query) +} + // Queries the aur for information about specified packages. // All packages should be queried in a single rpc request except when the number // of packages exceeds the number set in config.RequestSplitN. // If the number does exceed config.RequestSplitN multiple rpc requests will be // performed concurrently. -func AURInfo(names []string, warnings *AURWarnings, splitN int) ([]*rpc.Pkg, error) { - info := make([]*rpc.Pkg, 0, len(names)) +func AURInfo(names []string, warnings *AURWarnings, splitN int) ([]*Pkg, error) { + info := make([]*Pkg, 0, len(names)) seen := make(map[string]int) var mux sync.Mutex var wg sync.WaitGroup @@ -73,7 +80,7 @@ func AURInfo(names []string, warnings *AURWarnings, splitN int) ([]*rpc.Pkg, err return info, nil } -func AURInfoPrint(names []string, splitN int) ([]*rpc.Pkg, error) { +func AURInfoPrint(names []string, splitN int) ([]*Pkg, error) { text.OperationInfoln(gotext.Get("Querying AUR...")) warnings := &AURWarnings{}