Fix depends sometimes being ordered incorrectly

This commit is contained in:
morganamilo 2018-09-04 17:43:32 +01:00
parent e945f1200a
commit 00b880baf9
No known key found for this signature in database
GPG key ID: 6FE9E7996B0B082E
2 changed files with 12 additions and 11 deletions

View file

@ -193,7 +193,6 @@ func (config *Configuration) defaultSettings() {
config.CombinedUpgrade = false config.CombinedUpgrade = false
} }
func (config *Configuration) expandEnv() { func (config *Configuration) expandEnv() {
config.AURURL = os.ExpandEnv(config.AURURL) config.AURURL = os.ExpandEnv(config.AURURL)
config.BuildDir = os.ExpandEnv(config.BuildDir) config.BuildDir = os.ExpandEnv(config.BuildDir)

View file

@ -35,18 +35,17 @@ func makeDepOrder() *depOrder {
func getDepOrder(dp *depPool) *depOrder { func getDepOrder(dp *depPool) *depOrder {
do := makeDepOrder() do := makeDepOrder()
basesMap := make(map[string]Base)
for _, target := range dp.Targets { for _, target := range dp.Targets {
dep := target.DepString() dep := target.DepString()
aurPkg := dp.Aur[dep] aurPkg := dp.Aur[dep]
if aurPkg != nil && pkgSatisfies(aurPkg.Name, aurPkg.Version, dep) { if aurPkg != nil && pkgSatisfies(aurPkg.Name, aurPkg.Version, dep) {
do.orderPkgAur(aurPkg, dp, basesMap, true) do.orderPkgAur(aurPkg, dp, true)
} }
aurPkg = dp.findSatisfierAur(dep) aurPkg = dp.findSatisfierAur(dep)
if aurPkg != nil { if aurPkg != nil {
do.orderPkgAur(aurPkg, dp, basesMap, true) do.orderPkgAur(aurPkg, dp, true)
} }
repoPkg := dp.findSatisfierRepo(dep) repoPkg := dp.findSatisfierRepo(dep)
@ -55,14 +54,10 @@ func getDepOrder(dp *depPool) *depOrder {
} }
} }
for _, base := range basesMap {
do.Aur = append(do.Aur, base)
}
return do return do
} }
func (do *depOrder) orderPkgAur(pkg *rpc.Pkg, dp *depPool, basesMap map[string]Base, runtime bool) { func (do *depOrder) orderPkgAur(pkg *rpc.Pkg, dp *depPool, runtime bool) {
if runtime { if runtime {
do.Runtime.set(pkg.Name) do.Runtime.set(pkg.Name)
} }
@ -72,7 +67,7 @@ func (do *depOrder) orderPkgAur(pkg *rpc.Pkg, dp *depPool, basesMap map[string]B
for _, dep := range deps { for _, dep := range deps {
aurPkg := dp.findSatisfierAur(dep) aurPkg := dp.findSatisfierAur(dep)
if aurPkg != nil { if aurPkg != nil {
do.orderPkgAur(aurPkg, dp, basesMap, runtime && i == 0) do.orderPkgAur(aurPkg, dp, runtime && i == 0)
} }
repoPkg := dp.findSatisfierRepo(dep) repoPkg := dp.findSatisfierRepo(dep)
@ -82,7 +77,14 @@ func (do *depOrder) orderPkgAur(pkg *rpc.Pkg, dp *depPool, basesMap map[string]B
} }
} }
basesMap[pkg.PackageBase] = append(basesMap[pkg.PackageBase], pkg) for i, base := range do.Aur {
if base.Pkgbase() == pkg.PackageBase {
do.Aur[i] = append(base, pkg)
return
}
}
do.Aur = append(do.Aur, Base{pkg})
} }
func (do *depOrder) orderPkgRepo(pkg *alpm.Package, dp *depPool, runtime bool) { func (do *depOrder) orderPkgRepo(pkg *alpm.Package, dp *depPool, runtime bool) {