From 83d92be37aea0e80c62331036f73b691f3a167ea Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Sat, 28 Feb 2026 07:08:34 +0000 Subject: [PATCH] refactor(snack): merge GroupIsInstalled into Grouper interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GroupQuerier was an unnecessary indirection — GroupIsInstalled is a group operation and belongs on Grouper. No v1 stability guarantee, so breaking the interface is fine. --- dnf/capabilities.go | 1 - dnf/parse_test.go | 1 - pacman/capabilities.go | 1 - snack.go | 6 +----- 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/dnf/capabilities.go b/dnf/capabilities.go index 128e39c..593f709 100644 --- a/dnf/capabilities.go +++ b/dnf/capabilities.go @@ -15,7 +15,6 @@ var ( _ snack.RepoManager = (*DNF)(nil) _ snack.KeyManager = (*DNF)(nil) _ snack.Grouper = (*DNF)(nil) - _ snack.GroupQuerier = (*DNF)(nil) _ snack.NameNormalizer = (*DNF)(nil) _ snack.DryRunner = (*DNF)(nil) ) diff --git a/dnf/parse_test.go b/dnf/parse_test.go index 4cc9f76..8e9dfa6 100644 --- a/dnf/parse_test.go +++ b/dnf/parse_test.go @@ -468,6 +468,5 @@ var ( _ snack.RepoManager = (*DNF)(nil) _ snack.KeyManager = (*DNF)(nil) _ snack.Grouper = (*DNF)(nil) - _ snack.GroupQuerier = (*DNF)(nil) _ snack.NameNormalizer = (*DNF)(nil) ) diff --git a/pacman/capabilities.go b/pacman/capabilities.go index bee23f4..a75620b 100644 --- a/pacman/capabilities.go +++ b/pacman/capabilities.go @@ -12,7 +12,6 @@ var ( _ snack.Cleaner = (*Pacman)(nil) _ snack.FileOwner = (*Pacman)(nil) _ snack.Grouper = (*Pacman)(nil) - _ snack.GroupQuerier = (*Pacman)(nil) _ snack.DryRunner = (*Pacman)(nil) ) diff --git a/snack.go b/snack.go index ed76e80..3bacc1b 100644 --- a/snack.go +++ b/snack.go @@ -189,16 +189,12 @@ type Grouper interface { // GroupInstall installs all packages in a group. GroupInstall(ctx context.Context, group string, opts ...Option) error -} -// GroupQuerier provides an efficient check for whether a package group is -// fully installed. This is an optional extension of [Grouper]. -// Supported by: pacman, dnf/yum. -type GroupQuerier interface { // GroupIsInstalled reports whether all packages in the group are installed. GroupIsInstalled(ctx context.Context, group string) (bool, error) } + // NormalizeName provides package name normalization. // Supported by: apt (strips :arch suffixes), rpm. type NameNormalizer interface {