From 84f9cbc9cfa23e8efd75f986d51caa8d418df0ca Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Fri, 6 Mar 2026 03:19:49 +0000 Subject: [PATCH] fix(ports,detect): remove duplicate funcs and fix windows build ports/capabilities_openbsd.go duplicated autoremove, clean, fileList, and owner already defined in ports_openbsd.go, breaking OpenBSD builds. detect/detect_other.go build tag didn't exclude windows, conflicting with detect_windows.go declarations. --- detect/detect_other.go | 2 +- ports/capabilities_openbsd.go | 34 ---------------------------------- 2 files changed, 1 insertion(+), 35 deletions(-) diff --git a/detect/detect_other.go b/detect/detect_other.go index 0ad262c..cdccbbf 100644 --- a/detect/detect_other.go +++ b/detect/detect_other.go @@ -1,4 +1,4 @@ -//go:build !linux && !freebsd && !openbsd && !darwin +//go:build !linux && !freebsd && !openbsd && !darwin && !windows package detect diff --git a/ports/capabilities_openbsd.go b/ports/capabilities_openbsd.go index adef83d..bb3b63f 100644 --- a/ports/capabilities_openbsd.go +++ b/ports/capabilities_openbsd.go @@ -78,40 +78,6 @@ func versionCmp(_ context.Context, ver1, ver2 string) (int, error) { } } -func autoremove(ctx context.Context, opts ...snack.Option) error { - o := snack.ApplyOptions(opts...) - _, err := runCmd(ctx, "pkg_delete", []string{"-a"}, o) - return err -} - -func clean(_ context.Context) error { - // OpenBSD does not maintain a package cache like FreeBSD/apt. - // Downloaded packages are removed after installation by default. - return nil -} - -func fileList(ctx context.Context, pkg string) ([]string, error) { - out, err := runCmd(ctx, "pkg_info", []string{"-L", pkg}, snack.Options{}) - if err != nil { - if strings.Contains(err.Error(), "exit status 1") { - return nil, fmt.Errorf("ports fileList %s: %w", pkg, snack.ErrNotInstalled) - } - return nil, fmt.Errorf("ports fileList: %w", err) - } - return parseFileListOutput(out), nil -} - -func owner(ctx context.Context, path string) (string, error) { - out, err := runCmd(ctx, "pkg_info", []string{"-E", path}, snack.Options{}) - if err != nil { - if strings.Contains(err.Error(), "exit status 1") { - return "", fmt.Errorf("ports owner %s: %w", path, snack.ErrNotFound) - } - return "", fmt.Errorf("ports owner: %w", err) - } - return parseOwnerOutput(out), nil -} - func upgradePackages(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) (snack.InstallResult, error) { o := snack.ApplyOptions(opts...) var toUpgrade []snack.Target