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:
morganamilo 2018-05-29 16:47:43 +01:00
parent 6df8c58e00
commit 33d056e9ac
No known key found for this signature in database
GPG Key ID: 6FE9E7996B0B082E
2 changed files with 11 additions and 5 deletions

View File

@ -44,6 +44,7 @@ func (t target) String() string {
type depPool struct {
Targets []target
Explicit stringSet
Repo map[string]*alpm.Package
Aur map[string]*rpc.Pkg
AurCache map[string]*rpc.Pkg
@ -65,6 +66,7 @@ func makeDepPool() (*depPool, error) {
dp := &depPool{
make([]target, 0),
make(stringSet),
make(map[string]*alpm.Package),
make(map[string]*rpc.Pkg),
make(map[string]*rpc.Pkg),
@ -124,6 +126,7 @@ func (dp *depPool) ResolveTargets(pkgs []string) error {
}
if err == nil {
dp.Explicit.set(foundPkg.Name())
dp.ResolveRepoDependency(foundPkg)
continue
} else {
@ -149,7 +152,7 @@ func (dp *depPool) ResolveTargets(pkgs []string) error {
}
if len(aurTargets) > 0 {
err = dp.resolveAURPackages(aurTargets)
err = dp.resolveAURPackages(aurTargets, true)
}
return err
@ -255,7 +258,7 @@ func (dp *depPool) cacheAURPackages(_pkgs stringSet) error {
return nil
}
func (dp *depPool) resolveAURPackages(pkgs stringSet) error {
func (dp *depPool) resolveAURPackages(pkgs stringSet, explicit bool) error {
newPackages := make(stringSet)
newAURPackages := make(stringSet)
@ -279,6 +282,9 @@ func (dp *depPool) resolveAURPackages(pkgs stringSet) error {
continue
}
if explicit {
dp.Explicit.set(pkg.Name)
}
dp.Aur[pkg.Name] = pkg
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
}

View File

@ -206,7 +206,7 @@ func install(parser *arguments) error {
depArguments.addArg("D", "asdeps")
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())
}
}
@ -230,7 +230,7 @@ func install(parser *arguments) error {
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 {
return err
}