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