Skip to content

Add Arch Linux ecosystem and fix distro-namespace purl lookups#1622

Open
andrew wants to merge 1 commit into
mainfrom
arch-ecosystem
Open

Add Arch Linux ecosystem and fix distro-namespace purl lookups#1622
andrew wants to merge 1 commit into
mainfrom
arch-ecosystem

Conversation

@andrew
Copy link
Copy Markdown
Member

@andrew andrew commented May 7, 2026

Adds support for indexing Arch Linux packages from both the official repos and the AUR.

One Ecosystem::Arch class with two registries, branching on registry.metadata['kind'] (official / aur):

  • Official: paginated archlinux.org/packages/search/json/ for the full list (~16k), /feeds/packages/ RSS for recently updated, pacman -S install command
  • AUR: aur.archlinux.org/packages.gz for the full list (~111k), /rpc/v5/info for metadata, /rss/modified + /rss/ via Nokogiri for recently updated (SimpleRSS chokes on the single-quoted XML declaration), yay -S install command
  • Dependencies parsed from depends/makedepends/checkdepends/optdepends with version constraint splitting (pacman>6.1 → name pacman, requirement >6.1) and optdepend description stripping
  • Maintainers from both sources
  • purl type alpm, namespace arch, version [epoch:]pkgver-pkgrel, qualifiers arch and upstream — matches what syft emits for archlinux:base (trivy doesn't catalog ALPM packages at all)

Also fixes purl lookups for distro-namespace types. SBOM scanners emit pkg:alpm/arch/jq, pkg:apk/alpine/jq, pkg:deb/debian/curl where the namespace is the distro, not part of the package name. The lookup code was joining namespace into the name (arch/jq) and only resolving one ecosystem per purl type, so apk and deb lookups returned nothing. Changes:

  • Ecosystem::Base.name_from_purl centralises name construction (replaces three copies of the join logic)
  • purl_namespace_in_name? hook, set false on Arch, Deb, Alpine, Adelie, Postmarketos
  • purl_type_to_ecosystems (plural) so apk resolves to alpine/adelie/postmarketos and deb to deb/debian/ubuntu; all four registry-lookup callsites updated
  • self.purl_type added to alpine/adelie/postmarketos (apk) and debian/ubuntu (deb)

To enable in production:

Registry.find_or_create_by(name: 'archlinux.org', url: 'https://archlinux.org', ecosystem: 'arch', github: 'archlinux', default: true, metadata: {'kind' => 'official'}).sync_all_packages_async
Registry.find_or_create_by(name: 'aur.archlinux.org', url: 'https://aur.archlinux.org', ecosystem: 'arch', github: 'archlinux', default: false, metadata: {'kind' => 'aur'}).sync_all_packages_async

Closes #1613

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for Arch Linux packages (pacman/AUR)

1 participant