feat(apt,dpkg): implement capability interfaces

apt: VersionQuerier, Holder, Cleaner, FileOwner, RepoManager, KeyManager, NameNormalizer
dpkg: FileOwner, NameNormalizer

All new interfaces follow the existing pattern of exported methods on
struct delegating to unexported platform-specific functions. Mutating
operations use Lock/Unlock; read-only operations do not.

Platform stubs in _other.go files return ErrUnsupportedPlatform.
Compile-time interface checks added for all implemented interfaces.
This commit is contained in:
2026-02-25 20:47:44 +00:00
parent 5fd29c22fc
commit e5c749558f
8 changed files with 728 additions and 0 deletions

21
dpkg/normalize.go Normal file
View File

@@ -0,0 +1,21 @@
package dpkg
import "strings"
func normalizeName(name string) string {
n, _ := parseArch(name)
return n
}
func parseArch(name string) (string, string) {
if idx := strings.LastIndex(name, ":"); idx >= 0 {
pkg := name[:idx]
arch := name[idx+1:]
switch arch {
case "amd64", "i386", "arm64", "armhf", "armel", "mips", "mipsel",
"mips64el", "ppc64el", "s390x", "all", "any":
return pkg, arch
}
}
return name, ""
}