mirror of
https://github.com/Jguer/yay
synced 2024-08-31 13:49:28 +00:00
fix(dbExecutor): move dbExecutor to runtime config
This commit is contained in:
parent
ad9bc9ef8f
commit
8165174462
|
@ -150,7 +150,7 @@ func install(cmdArgs *settings.Arguments, alpmHandle *alpm.Handle, ignoreProvide
|
|||
targets := stringset.FromSlice(cmdArgs.Targets)
|
||||
|
||||
dp, err := dep.GetPool(requestTargets,
|
||||
warnings, alpmHandle, config.Runtime.Mode,
|
||||
warnings, config.Runtime.DBExecutor, config.Runtime.Mode,
|
||||
ignoreProviders, config.NoConfirm, config.Provides, config.ReBuild, config.RequestSplitN)
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
3
main.go
3
main.go
|
@ -10,6 +10,7 @@ import (
|
|||
pacmanconf "github.com/Morganamilo/go-pacmanconf"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
|
||||
"github.com/Jguer/yay/v10/pkg/db"
|
||||
"github.com/Jguer/yay/v10/pkg/settings"
|
||||
"github.com/Jguer/yay/v10/pkg/text"
|
||||
)
|
||||
|
@ -193,6 +194,8 @@ func main() {
|
|||
exitOnError(initVCS(runtime.VCSPath))
|
||||
config.Runtime.AlpmHandle, config.Runtime.PacmanConf, err = initAlpm(cmdArgs, config.PacmanConf)
|
||||
exitOnError(err)
|
||||
config.Runtime.DBExecutor, err = db.NewExecutor(config.Runtime.AlpmHandle)
|
||||
exitOnError(err)
|
||||
exitOnError(handleCmd(cmdArgs, config.Runtime.AlpmHandle))
|
||||
os.Exit(cleanup(config.Runtime.AlpmHandle))
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"strings"
|
||||
"sync"
|
||||
|
||||
alpm "github.com/Jguer/go-alpm"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
rpc "github.com/mikkeloscar/aur"
|
||||
|
||||
|
@ -62,8 +61,7 @@ type Pool struct {
|
|||
Warnings *query.AURWarnings
|
||||
}
|
||||
|
||||
func makePool(alpmHandle *alpm.Handle) *Pool {
|
||||
ae, _ := db.NewExecutor(alpmHandle)
|
||||
func makePool(dbExecutor *db.AlpmExecutor) *Pool {
|
||||
dp := &Pool{
|
||||
make([]Target, 0),
|
||||
make(stringset.StringSet),
|
||||
|
@ -71,7 +69,7 @@ func makePool(alpmHandle *alpm.Handle) *Pool {
|
|||
make(map[string]*rpc.Pkg),
|
||||
make(map[string]*rpc.Pkg),
|
||||
make([]string, 0),
|
||||
ae,
|
||||
dbExecutor,
|
||||
nil,
|
||||
}
|
||||
|
||||
|
@ -349,11 +347,11 @@ func (dp *Pool) ResolveRepoDependency(pkg db.RepoPackage) {
|
|||
|
||||
func GetPool(pkgs []string,
|
||||
warnings *query.AURWarnings,
|
||||
alpmHandle *alpm.Handle,
|
||||
dbExecutor *db.AlpmExecutor,
|
||||
mode settings.TargetMode,
|
||||
ignoreProviders, noConfirm, provides bool,
|
||||
rebuild string, splitN int) (*Pool, error) {
|
||||
dp := makePool(alpmHandle)
|
||||
dp := makePool(dbExecutor)
|
||||
|
||||
dp.Warnings = warnings
|
||||
err := dp.ResolveTargets(pkgs, mode, ignoreProviders, noConfirm, provides, rebuild, splitN)
|
||||
|
|
|
@ -8,6 +8,8 @@ import (
|
|||
"github.com/Morganamilo/go-pacmanconf"
|
||||
"github.com/leonelquinteros/gotext"
|
||||
"github.com/pkg/errors"
|
||||
|
||||
"github.com/Jguer/yay/v10/pkg/db"
|
||||
)
|
||||
|
||||
type TargetMode int
|
||||
|
@ -34,6 +36,7 @@ type Runtime struct {
|
|||
VCSPath string
|
||||
PacmanConf *pacmanconf.Config
|
||||
AlpmHandle *alpm.Handle
|
||||
DBExecutor *db.AlpmExecutor
|
||||
}
|
||||
|
||||
func MakeRuntime() (*Runtime, error) {
|
||||
|
|
Loading…
Reference in a new issue