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

Allow negative requirements in apko config #1192

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
14 changes: 14 additions & 0 deletions pkg/apk/apk/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,17 @@ func (p *PkgResolver) GetPackagesWithDependencies(ctx context.Context, packages
return nil, nil, fmt.Errorf("constraining initial packages: %w", err)
}

// Drop any conflicts.
constraints = slices.DeleteFunc(constraints, func(s string) bool {
// TODO: This is a little strange, we should revisit why we do this.
if strings.HasPrefix(s, "!") {
conflicts = append(conflicts, s)
return true
}

return false
})

for len(constraints) != 0 {
next, err := p.nextPackage(constraints, dq)
if err != nil {
Expand All @@ -518,6 +529,9 @@ func (p *PkgResolver) GetPackagesWithDependencies(ctx context.Context, packages

// now get the dependencies for each package
for _, pkgName := range packages {
if strings.HasPrefix(pkgName, "!") {
continue
}
pkg, deps, confs, err := p.GetPackageWithDependencies(pkgName, dependenciesMap, dq)
if err != nil {
return toInstall, nil, &ConstraintError{pkgName, err}
Expand Down
Loading