feat(aur): rewrite with go-git, RPC batch queries, functional options

- Replace shell git clone with go-git for cloning/pulling PKGBUILDs
- Add rpcInfoMulti for batch AUR queries (single HTTP request)
- Add functional options: WithBuildDir, WithMakepkgFlags
- Implement proper remove/purge via pacman -R/-Rns
- Fix temp directory leak: buildPackage returns cleanup path
- Remove NameNormalizer (AUR names are plain identifiers)
- Update README capability matrix
- Remove duplicate platform stubs (flatpak, ports)
This commit is contained in:
2026-03-10 17:41:03 +00:00
parent 1a51a40e4e
commit 84e4f8e2ff
12 changed files with 569 additions and 558 deletions

View File

@@ -198,49 +198,6 @@ func removeRepo(ctx context.Context, id string) error {
return err
}
func latestVersion(ctx context.Context, pkg string) (string, error) {
out, err := run(ctx, []string{"remote-info", "flathub", pkg})
if err != nil {
if strings.Contains(err.Error(), "exit status 1") {
return "", fmt.Errorf("flatpak latestVersion %s: %w", pkg, snack.ErrNotFound)
}
return "", fmt.Errorf("flatpak latestVersion: %w", err)
}
p := parseInfo(out)
if p == nil || p.Version == "" {
return "", fmt.Errorf("flatpak latestVersion %s: %w", pkg, snack.ErrNotFound)
}
return p.Version, nil
}
func listUpgrades(ctx context.Context) ([]snack.Package, error) {
out, err := run(ctx, []string{"remote-ls", "--updates", "--columns=name,application,version,origin"})
if err != nil {
if strings.Contains(err.Error(), "No updates") {
return nil, nil
}
return nil, fmt.Errorf("flatpak listUpgrades: %w", err)
}
return parseList(out), nil
}
func upgradeAvailable(ctx context.Context, pkg string) (bool, error) {
upgrades, err := listUpgrades(ctx)
if err != nil {
return false, err
}
for _, u := range upgrades {
if u.Name == pkg || u.Description == pkg {
return true, nil
}
}
return false, nil
}
func versionCmp(_ context.Context, ver1, ver2 string) (int, error) {
return semverCmp(ver1, ver2), nil
}
func upgradePackages(ctx context.Context, pkgs []snack.Target, opts ...snack.Option) (snack.InstallResult, error) {
o := snack.ApplyOptions(opts...)
var toUpgrade []snack.Target