Fix DNF isHeld to reuse listHeld instead of passing pkg to versionlock list

Co-authored-by: taigrr <8261498+taigrr@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-28 06:55:21 +00:00
parent 135e7c70f4
commit 6032f55925

View File

@@ -114,18 +114,11 @@ func listHeld(ctx context.Context, v5 bool) ([]snack.Package, error) {
}
func isHeld(ctx context.Context, pkg string, v5 bool) (bool, error) {
out, err := run(ctx, []string{"versionlock", "list", pkg}, snack.Options{})
held, err := listHeld(ctx, v5)
if err != nil {
// versionlock list exits non-zero when no match is found on some versions
return false, nil
return false, err
}
var pkgs []snack.Package
if v5 {
pkgs = parseVersionLockDNF5(out)
} else {
pkgs = parseVersionLock(out)
}
for _, p := range pkgs {
for _, p := range held {
if p.Name == pkg {
return true, nil
}