Merge pull request #455 from Morganamilo/fixyogurt

Don't show provider menu for targets during -Y
This commit is contained in:
Anna 2018-06-02 19:15:25 +01:00 committed by GitHub
commit 68ca822fc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -377,6 +377,12 @@ func (dp *depPool) findSatisfierAur(dep string) *rpc.Pkg {
// This is mostly used to promote packages from the cache
// to the Install list
// Provide a pacman style provider menu if theres more than one candidate
// This acts slightly differenly from Pacman, It will give
// a menu even if a package with a matching name exists. I believe this
// method is better because most of the time you are choosing between
// foo and foo-git.
// Using Pacman's ways trying to install foo would never give you
// a menu.
// TODO: maybe intermix repo providers in the menu
func (dp *depPool) findSatisfierAurCache(dep string) *rpc.Pkg {
depName, _, _ := splitDep(dep)
@ -387,33 +393,20 @@ func (dp *depPool) findSatisfierAurCache(dep string) *rpc.Pkg {
if pkg, ok := dp.AurCache[dep]; ok && pkgSatisfies(pkg.Name, pkg.Version, dep) {
return pkg
}
}
//this version prioratizes name over provides
//if theres a direct match for a package return
//that instead of using the menu
//
//providers := make(rpcPkgs, 0)
//for _, pkg := range dp.AurCache {
// if pkgSatisfies(pkg.Name, pkg.Version, dep) {
// return pkg
// }
//}
//for _, pkg := range dp.AurCache {
// for _, provide := range pkg.Provides {
// if provideSatisfies(provide, dep) {
// providers = append(providers, pkg)
// }
// }
//}
// This version acts slightly differenly from Pacman, It will give
// a menu even if a package with a matching name exists. I believe this
// method is better because most of the time you are choosing between
// foo and foo-git.
// Using Pacman's ways trying to install foo would never give you
// a menu.
if cmdArgs.op == "Y" || cmdArgs.op == "yay" {
for _, pkg := range dp.AurCache {
if pkgSatisfies(pkg.Name, pkg.Version, dep) {
for _, target := range dp.Targets {
if target.Name == pkg.Name {
return pkg
}
}
}
}
}
for _, pkg := range dp.AurCache {
if seen.get(pkg.Name) {