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

[ABI compat] Fix wolfictl bump suggestion to not include package itself #1065

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
9 changes: 5 additions & 4 deletions pkg/checks/so_name.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package checks

Check failure on line 1 in pkg/checks/so_name.go

View workflow job for this annotation

GitHub Actions / build

Please run goimports. diff --git a/pkg/checks/so_name.go b/pkg/checks/so_name.go index f79901f..f1829ed 100644 --- a/pkg/checks/so_name.go +++ b/pkg/checks/so_name.go @@ -272,4 +272,4 @@ func (o *SoNameOptions) checkSonamesMatch(existingSonameFiles, newSonameFiles [] } return errors.Join(errs...) -} \ No newline at end of file +}

import (
"debug/elf"
Expand Down Expand Up @@ -134,7 +134,7 @@
return fmt.Errorf("error when looking for soname files in existing apk: %w", err)
}

err = o.checkSonamesMatch(existingSonameFiles, newSonameFiles)

Check failure on line 137 in pkg/checks/so_name.go

View workflow job for this annotation

GitHub Actions / lint

not enough arguments in call to o.checkSonamesMatch

Check failure on line 137 in pkg/checks/so_name.go

View workflow job for this annotation

GitHub Actions / lint

not enough arguments in call to o.checkSonamesMatch

Check failure on line 137 in pkg/checks/so_name.go

View workflow job for this annotation

GitHub Actions / wolfictl text on wolfi-dev/os

not enough arguments in call to o.checkSonamesMatch
if err != nil {
return fmt.Errorf("soname files differ, this can cause an ABI break: %w", err)
}
Expand Down Expand Up @@ -191,15 +191,13 @@
return sonames
}

func (o *SoNameOptions) checkSonamesMatch(existingSonameFiles, newSonameFiles []string) error {
func (o *SoNameOptions) checkSonamesMatch(existingSonameFiles, newSonameFiles []string, currentPackage string) error {
if len(existingSonameFiles) == 0 {
o.Logger.Printf("no existing soname files, skipping")
return nil
}

// regex to match version and optional qualifier
// \d+(\.\d+)* captures version numbers that may have multiple parts separated by dots
// ([a-zA-Z0-9-_]*) captures optional alphanumeric (including hyphens and underscores) qualifiers
r := regexp.MustCompile(`(\d+(\.\d+)*)([a-zA-Z0-9-_]*)`)

// first turn the existing soname files into a map so it is easier to match with
Expand Down Expand Up @@ -255,6 +253,9 @@
if newVersionMajor > existingVersionMajor {
sonames := generateVersions(name, existingVersionStr)
for _, pkg := range o.ExistingPackages {
if pkg.Origin == currentPackage {
continue
}
for _, soname := range sonames {
if slices.Contains(pkg.Dependencies, soname) {
toBump[pkg.Origin] = struct{}{}
Expand All @@ -271,4 +272,4 @@
}

return errors.Join(errs...)
}
}
Loading