Calculate makeDeps properly

MakeOnly would be set to true when moving from normal deps to make deps
But would incorrectly stay set to true when moving to the deps of the
following packages.

depOrder.Aur now only holds one package from each base like
depCatagories does.
This commit is contained in:
morganamilo 2018-05-08 19:42:19 +01:00
parent c019a2cc02
commit 671f836ec5
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
3 changed files with 26 additions and 17 deletions

1
dep.go
View file

@ -126,4 +126,3 @@ func getBases(pkgs map[string]*rpc.Pkg) map[string][]*rpc.Pkg {
return bases
}

View file

@ -78,7 +78,7 @@ func getDepOrder(dp *depPool) *depOrder {
}
}
do.getBases()
//do.getBases()
return do
}
@ -87,22 +87,25 @@ func (do *depOrder) orderPkgAur(pkg *rpc.Pkg, dp *depPool, runtime bool) {
if runtime {
do.Runtime.set(pkg.Name)
}
if _, ok := do.Bases[pkg.PackageBase]; !ok {
do.Aur = append(do.Aur, pkg)
do.Bases[pkg.PackageBase] = make([]*rpc.Pkg, 0)
}
do.Bases[pkg.PackageBase] = append(do.Bases[pkg.PackageBase], pkg)
delete(dp.Aur, pkg.Name)
for _, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
for i, deps := range [3][]string{pkg.Depends, pkg.MakeDepends, pkg.CheckDepends} {
for _, dep := range deps {
aurPkg := dp.findSatisfierAur(dep)
if aurPkg != nil {
do.orderPkgAur(aurPkg, dp, runtime)
do.orderPkgAur(aurPkg, dp, runtime && i == 0)
}
repoPkg := dp.findSatisfierRepo(dep)
if repoPkg != nil {
do.orderPkgRepo(repoPkg, dp, runtime)
do.orderPkgRepo(repoPkg, dp, runtime && i == 0)
}
runtime = false
}
}
}
@ -135,19 +138,30 @@ func (do *depOrder) getBases() {
}
func (do *depOrder) HasMake() bool {
return len(do.Runtime) != len(do.Aur)+len(do.Repo)
lenAur := 0
for _, base := range do.Bases {
lenAur += len(base)
}
return len(do.Runtime) != lenAur+len(do.Repo)
}
func (do *depOrder) getMake() []string {
makeOnly := make([]string, 0, len(do.Aur)+len(do.Repo)-len(do.Runtime))
for _, pkg := range do.Aur {
for _, base := range do.Bases {
for _, pkg := range base {
if !do.Runtime.get(pkg.Name) {
makeOnly = append(makeOnly, pkg.Name)
}
}
}
for _, pkg := range do.Repo {
if !do.Runtime.get(pkg.Name()) {
makeOnly = append(makeOnly, pkg.Name())
}
}
return makeOnly
}

View file

@ -249,11 +249,7 @@ func install(parser *arguments) error {
return err
}
if do.HasMake() {
if !removeMake {
return nil
}
if removeMake {
removeArguments := makeArguments()
removeArguments.addArg("R", "u")