Skip to content

Add Arch Linux repository metadata support #63

Description

@andrew

Version: git-pkgs/registries current main at 418e68a.

Trying to create an Arch Linux repository client after importing all registries currently returns unknown ecosystem: alpm:

_, err := registries.New("alpm", "https://geo.mirror.pkgbuild.com/core/os/x86_64/core.db", nil)

Add an alpm registry that reads a configured pacman sync database. The URL should identify one concrete repository database, including repository and architecture, such as Arch's current core.db. There is no default ALPM repository. Register an empty default and make core.New return a clear error when the URL is missing.

A sync database is a compressed tar archive with one directory per package version and desc, depends, or files entries. Pacman's reader accepts the fields in those entries and maps NAME, VERSION, FILENAME, DESC, URL, LICENSE, ARCH, BUILDDATE, PACKAGER, SHA256SUM, and dependency groups. repo-add can generate small test databases from package fixtures.

Map package description, homepage, licenses, architecture, build date, packager, compressed and installed sizes, groups, base package, filename, and SHA-256 checksum. Resolve the package download URL from FILENAME relative to the database directory. Preserve the full version, including epoch and package release, without SemVer normalization.

FetchDependencies should parse DEPENDS requirements as runtime dependencies and OPTDEPENDS as optional dependencies, removing only the optional dependency's human-readable description. Keep make, check, conflict, replace, and provide relationships in metadata until the shared dependency type can name those roles. Parse PACKAGER values such as Name <email> into maintainer fields while retaining unstructured values.

The alpm PURL type requires a vendor namespace and supports an architecture qualifier. When called through NewFromPURL, split a full name such as arch/pacman for database lookup, retain arch as Package.Namespace, and keep architecture in version metadata. The configured database URL remains the source of repository and architecture selection because the current registry interface does not pass qualifiers to FetchPackage.

Handle the gzip-compressed tar format used by the current core.db example and the xz or zstd tar variants pacman can read, without shelling out to pacman or bsdtar. Reject unsafe archive paths and malformed required records.

Follow the new ecosystem layout, register the package from all/all.go, and add it to the root ecosystem tests.

Tests should cover compressed databases, epoch and package-release versions, any and concrete architectures, vendor namespaces, required and optional dependencies, packager parsing, SHA-256 integrity, resolved package URLs, missing optional fields, malformed archives and entries, a missing configured URL, authentication through the supplied HTTP client, and not-found packages and versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions