mirror of
https://github.com/Jguer/yay
synced 2024-10-31 13:42:27 +00:00
Split Targets to Targets and Explicit
Targets are used for tracking wether a package should be marked as explicitly installed or as a dependency. This is not ideal because you can have a target such as java-environment that resolves to a different package. Therefore Targets are now used only for the initial dependency resolving and checking for missing dependencies. The Explicit set is now used to mark what packages are explicit, seperate from the targets.
This commit is contained in:
parent
6df8c58e00
commit
33d056e9ac
2 changed files with 11 additions and 5 deletions
12
depPool.go
12
depPool.go
|
@ -44,6 +44,7 @@ func (t target) String() string {
|
||||||
|
|
||||||
type depPool struct {
|
type depPool struct {
|
||||||
Targets []target
|
Targets []target
|
||||||
|
Explicit stringSet
|
||||||
Repo map[string]*alpm.Package
|
Repo map[string]*alpm.Package
|
||||||
Aur map[string]*rpc.Pkg
|
Aur map[string]*rpc.Pkg
|
||||||
AurCache map[string]*rpc.Pkg
|
AurCache map[string]*rpc.Pkg
|
||||||
|
@ -65,6 +66,7 @@ func makeDepPool() (*depPool, error) {
|
||||||
|
|
||||||
dp := &depPool{
|
dp := &depPool{
|
||||||
make([]target, 0),
|
make([]target, 0),
|
||||||
|
make(stringSet),
|
||||||
make(map[string]*alpm.Package),
|
make(map[string]*alpm.Package),
|
||||||
make(map[string]*rpc.Pkg),
|
make(map[string]*rpc.Pkg),
|
||||||
make(map[string]*rpc.Pkg),
|
make(map[string]*rpc.Pkg),
|
||||||
|
@ -124,6 +126,7 @@ func (dp *depPool) ResolveTargets(pkgs []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
dp.Explicit.set(foundPkg.Name())
|
||||||
dp.ResolveRepoDependency(foundPkg)
|
dp.ResolveRepoDependency(foundPkg)
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
@ -149,7 +152,7 @@ func (dp *depPool) ResolveTargets(pkgs []string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(aurTargets) > 0 {
|
if len(aurTargets) > 0 {
|
||||||
err = dp.resolveAURPackages(aurTargets)
|
err = dp.resolveAURPackages(aurTargets, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return err
|
||||||
|
@ -255,7 +258,7 @@ func (dp *depPool) cacheAURPackages(_pkgs stringSet) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dp *depPool) resolveAURPackages(pkgs stringSet) error {
|
func (dp *depPool) resolveAURPackages(pkgs stringSet, explicit bool) error {
|
||||||
newPackages := make(stringSet)
|
newPackages := make(stringSet)
|
||||||
newAURPackages := make(stringSet)
|
newAURPackages := make(stringSet)
|
||||||
|
|
||||||
|
@ -279,6 +282,9 @@ func (dp *depPool) resolveAURPackages(pkgs stringSet) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if explicit {
|
||||||
|
dp.Explicit.set(pkg.Name)
|
||||||
|
}
|
||||||
dp.Aur[pkg.Name] = pkg
|
dp.Aur[pkg.Name] = pkg
|
||||||
|
|
||||||
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
|
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
|
||||||
|
@ -312,7 +318,7 @@ func (dp *depPool) resolveAURPackages(pkgs stringSet) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dp.resolveAURPackages(newAURPackages)
|
err = dp.resolveAURPackages(newAURPackages, false)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ func install(parser *arguments) error {
|
||||||
depArguments.addArg("D", "asdeps")
|
depArguments.addArg("D", "asdeps")
|
||||||
|
|
||||||
for _, pkg := range do.Repo {
|
for _, pkg := range do.Repo {
|
||||||
if !parser.targets.get(pkg.Name()) && !localNamesCache.get(pkg.Name()) && !remoteNamesCache.get(pkg.Name()) {
|
if !dp.Explicit.get(pkg.Name()) && !localNamesCache.get(pkg.Name()) && !remoteNamesCache.get(pkg.Name()) {
|
||||||
depArguments.addTarget(pkg.Name())
|
depArguments.addTarget(pkg.Name())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ func install(parser *arguments) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = buildInstallPkgBuilds(do.Aur, srcinfosStale, parser.targets, parser, do.Bases, incompatible)
|
err = buildInstallPkgBuilds(do.Aur, srcinfosStale, dp.Explicit, parser, do.Bases, incompatible)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue