Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disqualify conflicts with self for packages #1415

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions pkg/apk/apk/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,31 +355,37 @@ func (p *PkgResolver) conflictingVersion(constraint parsedConstraint, conflict *
}

// Disqualify anything that conflicts with the given pkg.
func (p *PkgResolver) disqualifyConflicts(pkg *RepositoryPackage, dq map[*RepositoryPackage]string) {
for _, prov := range pkg.Provides {
constraint := cachedResolvePackageNameVersionPin(prov)
providers, ok := p.nameMap[constraint.name]
if !ok {
func (p *PkgResolver) disqualifyConflict(pkg *RepositoryPackage, prov string, dq map[*RepositoryPackage]string) {
constraint := cachedResolvePackageNameVersionPin(prov)
providers, ok := p.nameMap[constraint.name]
if !ok {
return
}

for _, conflict := range providers {
if conflict.RepositoryPackage == pkg {
continue
}

for _, conflict := range providers {
if conflict.RepositoryPackage == pkg {
continue
}
if _, dqed := dq[conflict.RepositoryPackage]; dqed {
// Already disqualified, don't bother generating reason.
continue
}

if _, dqed := dq[conflict.RepositoryPackage]; dqed {
// Already disqualified, don't bother generating reason.
continue
}
if !p.conflictingVersion(constraint, conflict) {
// The conflicting package provides the given name but the version is the same, so no conflict.
continue
}

if !p.conflictingVersion(constraint, conflict) {
// The conflicting package provides the given name but the version is the same, so no conflict.
continue
}
p.disqualify(dq, conflict.RepositoryPackage, pkg.Filename()+" already provides "+constraint.name)
}
}

p.disqualify(dq, conflict.RepositoryPackage, pkg.Filename()+" already provides "+constraint.name)
}
func (p *PkgResolver) disqualifyConflicts(pkg *RepositoryPackage, dq map[*RepositoryPackage]string) {
p.disqualifyConflict(pkg, pkg.Name+"="+pkg.Version, dq)

for _, prov := range pkg.Provides {
p.disqualifyConflict(pkg, prov, dq)
}
}

Expand Down
Loading