diff --git a/.github/workflows/deploy-worker.yml b/.github/workflows/deploy-worker.yml index 9e44644..f6f2fd3 100644 --- a/.github/workflows/deploy-worker.yml +++ b/.github/workflows/deploy-worker.yml @@ -7,6 +7,7 @@ on: paths: - "infra/cloudflare/**" - "install.sh" + - "repositories.json" workflow_dispatch: jobs: diff --git a/crates/pkg-core/src/repository/config.rs b/crates/pkg-core/src/repository/config.rs index 63fcc90..8cd74b7 100644 --- a/crates/pkg-core/src/repository/config.rs +++ b/crates/pkg-core/src/repository/config.rs @@ -3,132 +3,7 @@ use serde::{Deserialize, Serialize}; use std::fs; use std::path::PathBuf; -pub const FALLBACK_REGISTRY_JSON: &str = r#"{ - "schema_version": "1.0", - "updated_at": "2026-09-18T22:00:00Z", - "repositories": [ - { - "id": "arch-core", - "name": "Arch Linux Core", - "distro": "arch", - "format": "alpm", - "url": "https://geo.mirror.pkgbuild.com", - "distribution": "core", - "components": [], - "priority": 100, - "description": "Core packages for Arch Linux", - "default_for": ["arch"] - }, - { - "id": "arch-extra", - "name": "Arch Linux Extra", - "distro": "arch", - "format": "alpm", - "url": "https://geo.mirror.pkgbuild.com", - "distribution": "extra", - "components": [], - "priority": 90, - "description": "Extra packages for Arch Linux", - "default_for": ["arch"] - }, - { - "id": "arch-multilib", - "name": "Arch Linux Multilib", - "distro": "arch", - "format": "alpm", - "url": "https://geo.mirror.pkgbuild.com", - "distribution": "multilib", - "components": [], - "priority": 80, - "description": "32-bit applications and libraries on 64-bit Arch Linux", - "default_for": [] - }, - { - "id": "ubuntu-noble", - "name": "Ubuntu 24.04 LTS (Noble Numbat)", - "distro": "ubuntu", - "format": "deb", - "url": "http://archive.ubuntu.com/ubuntu", - "distribution": "noble", - "components": ["main", "universe", "restricted", "multiverse"], - "priority": 100, - "description": "Ubuntu 24.04 LTS official repository", - "default_for": ["ubuntu:24.04", "ubuntu:noble"] - }, - { - "id": "ubuntu-resolute", - "name": "Ubuntu 26.04 LTS (Resolute Raccoon)", - "distro": "ubuntu", - "format": "deb", - "url": "http://archive.ubuntu.com/ubuntu", - "distribution": "resolute", - "components": ["main", "universe", "restricted", "multiverse"], - "priority": 90, - "description": "Ubuntu 26.04 LTS official repository", - "default_for": ["ubuntu:26.04", "ubuntu:resolute"] - }, - { - "id": "ubuntu-jammy", - "name": "Ubuntu 22.04 LTS (Jammy Jellyfish)", - "distro": "ubuntu", - "format": "deb", - "url": "http://archive.ubuntu.com/ubuntu", - "distribution": "jammy", - "components": ["main", "universe", "restricted", "multiverse"], - "priority": 80, - "description": "Ubuntu 22.04 LTS official repository", - "default_for": ["ubuntu:22.04", "ubuntu:jammy"] - }, - { - "id": "debian-bookworm", - "name": "Debian 12 (Bookworm)", - "distro": "debian", - "format": "deb", - "url": "http://deb.debian.org/debian", - "distribution": "bookworm", - "components": ["main", "contrib", "non-free"], - "priority": 100, - "description": "Debian 12 official repository", - "default_for": ["debian:12", "debian:bookworm"] - }, - { - "id": "debian-trixie", - "name": "Debian 13 (Trixie)", - "distro": "debian", - "format": "deb", - "url": "http://deb.debian.org/debian", - "distribution": "trixie", - "components": ["main", "contrib", "non-free"], - "priority": 90, - "description": "Debian 13 official repository", - "default_for": ["debian:13", "debian:trixie"] - }, - { - "id": "fedora-41", - "name": "Fedora 41", - "distro": "fedora", - "format": "rpm", - "url": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/41/Everything/x86_64/os", - "distribution": "41", - "components": [], - "priority": 100, - "description": "Fedora 41 official repository", - "default_for": ["fedora:41"] - }, - { - "id": "fedora-42", - "name": "Fedora 42 (Rawhide)", - "distro": "fedora", - "format": "rpm", - "url": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/42/Everything/x86_64/os", - "distribution": "42", - "components": [], - "priority": 90, - "description": "Fedora 42 official repository", - "default_for": ["fedora:42", "fedora:rawhide"] - } - ] -}"#; +pub const FALLBACK_REGISTRY_JSON: &str = include_str!("../../../../repositories.json"); #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] pub struct CuratedRepository { @@ -264,6 +139,24 @@ impl CuratedRegistry { .collect(); } + if distro.contains("almalinux") { + return self + .repositories + .iter() + .filter(|r| r.id == "almalinux-9-baseos" || r.id == "almalinux-9-appstream") + .cloned() + .collect(); + } + + if distro.contains("rocky") { + return self + .repositories + .iter() + .filter(|r| r.id == "rocky-9-baseos" || r.id == "rocky-9-appstream") + .cloned() + .collect(); + } + if distro.contains("fedora") || distro.contains("rhel") || distro.contains("centos") { return self .repositories @@ -273,6 +166,24 @@ impl CuratedRegistry { .collect(); } + if distro.contains("opensuse") || distro.contains("suse") { + return self + .repositories + .iter() + .filter(|r| r.id == "opensuse-tumbleweed") + .cloned() + .collect(); + } + + if distro.contains("alpine") { + return self + .repositories + .iter() + .filter(|r| r.id == "alpine-v3.20") + .cloned() + .collect(); + } + // 3. Ultimate fallback: Arch Linux core + extra self.repositories .iter() @@ -455,6 +366,35 @@ mod tests { assert_eq!(ids, vec!["fedora-41"]); } + #[test] + fn test_distro_matching_expanded() { + let registry = CuratedRegistry::fallback(); + + // openSUSE + let suse = registry.default_for_distro("opensuse", None, None); + assert_eq!(suse[0].id, "opensuse-tumbleweed"); + + // Alpine + let alpine = registry.default_for_distro("alpine", None, Some("3.20")); + assert_eq!(alpine[0].id, "alpine-v3.20"); + + // AlmaLinux + let alma = registry.default_for_distro("almalinux", None, Some("9")); + let alma_ids: Vec<&str> = alma.iter().map(|r| r.id.as_str()).collect(); + assert_eq!( + alma_ids, + vec!["almalinux-9-baseos", "almalinux-9-appstream"] + ); + + // Debian Sid + let deb_sid = registry.default_for_distro("debian", Some("sid"), None); + assert_eq!(deb_sid[0].id, "debian-sid"); + + // Ubuntu Focal + let focal = registry.default_for_distro("ubuntu", Some("focal"), Some("20.04")); + assert_eq!(focal[0].id, "ubuntu-focal"); + } + #[test] fn test_default_config_to_toml() { let registry = CuratedRegistry::fallback(); diff --git a/infra/cloudflare/src/index.js b/infra/cloudflare/src/index.js index 27b6837..851eb55 100644 --- a/infra/cloudflare/src/index.js +++ b/infra/cloudflare/src/index.js @@ -32,7 +32,7 @@ export default { // 3. Official Repositories Catalog: /repositories, /repositories.json if (pathname === "/repositories" || pathname === "/repositories.json") { - return handleRepositories(); + return handleRepositories(repo, branch); } // 4. Releases: latest.txt @@ -366,10 +366,35 @@ function handleLandingPage(repo) { } /** - * Serves curated repository catalog in JSON format + * Serves curated repository catalog in JSON format with CDN caching and live GitHub sync */ -function handleRepositories() { - const data = { +async function handleRepositories(repo, branch) { + const upstreamUrl = `https://raw.githubusercontent.com/${repo}/${branch}/repositories.json`; + + try { + const upstreamRes = await fetch(upstreamUrl, { + cf: { + cacheEverything: true, + cacheTtl: 300 // 5 minutes cache on edge + } + }); + + if (upstreamRes.ok) { + const text = await upstreamRes.text(); + return new Response(text, { + status: 200, + headers: { + "Content-Type": "application/json; charset=utf-8", + "Cache-Control": "public, max-age=300, s-maxage=300", + "Access-Control-Allow-Origin": "*" + } + }); + } + } catch (_err) { + // Fall back to static embedded catalog below + } + + const fallbackData = { schema_version: "1.0", updated_at: "2026-09-18T22:00:00Z", repositories: [ @@ -445,6 +470,18 @@ function handleRepositories() { description: "Ubuntu 22.04 LTS official repository", default_for: ["ubuntu:22.04", "ubuntu:jammy"] }, + { + id: "ubuntu-focal", + name: "Ubuntu 20.04 LTS (Focal Fossa)", + distro: "ubuntu", + format: "deb", + url: "http://archive.ubuntu.com/ubuntu", + distribution: "focal", + components: ["main", "universe", "restricted", "multiverse"], + priority: 70, + description: "Ubuntu 20.04 LTS official repository", + default_for: ["ubuntu:20.04", "ubuntu:focal"] + }, { id: "debian-bookworm", name: "Debian 12 (Bookworm)", @@ -452,7 +489,7 @@ function handleRepositories() { format: "deb", url: "http://deb.debian.org/debian", distribution: "bookworm", - components: ["main", "contrib", "non-free"], + components: ["main", "contrib", "non-free", "non-free-firmware"], priority: 100, description: "Debian 12 official repository", default_for: ["debian:12", "debian:bookworm"] @@ -464,11 +501,35 @@ function handleRepositories() { format: "deb", url: "http://deb.debian.org/debian", distribution: "trixie", - components: ["main", "contrib", "non-free"], + components: ["main", "contrib", "non-free", "non-free-firmware"], priority: 90, description: "Debian 13 official repository", default_for: ["debian:13", "debian:trixie"] }, + { + id: "debian-sid", + name: "Debian Unstable (Sid)", + distro: "debian", + format: "deb", + url: "http://deb.debian.org/debian", + distribution: "sid", + components: ["main", "contrib", "non-free", "non-free-firmware"], + priority: 85, + description: "Debian Unstable (Sid) rolling repository", + default_for: ["debian:sid", "debian:unstable"] + }, + { + id: "debian-bullseye", + name: "Debian 11 (Bullseye)", + distro: "debian", + format: "deb", + url: "http://deb.debian.org/debian", + distribution: "bullseye", + components: ["main", "contrib", "non-free"], + priority: 70, + description: "Debian 11 official repository", + default_for: ["debian:11", "debian:bullseye"] + }, { id: "fedora-41", name: "Fedora 41", @@ -492,14 +553,122 @@ function handleRepositories() { priority: 90, description: "Fedora 42 official repository", default_for: ["fedora:42", "fedora:rawhide"] + }, + { + id: "fedora-40", + name: "Fedora 40", + distro: "fedora", + format: "rpm", + url: "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/40/Everything/x86_64/os", + distribution: "40", + components: [], + priority: 80, + description: "Fedora 40 official repository", + default_for: ["fedora:40"] + }, + { + id: "opensuse-tumbleweed", + name: "openSUSE Tumbleweed OSS", + distro: "opensuse", + format: "rpm", + url: "https://download.opensuse.org/tumbleweed/repo/oss", + distribution: "tumbleweed", + components: [], + priority: 100, + description: "openSUSE Tumbleweed rolling release official repository", + default_for: ["opensuse:tumbleweed", "opensuse-tumbleweed"] + }, + { + id: "opensuse-leap-15-6", + name: "openSUSE Leap 15.6 OSS", + distro: "opensuse", + format: "rpm", + url: "https://download.opensuse.org/distribution/leap/15.6/repo/oss", + distribution: "15.6", + components: [], + priority: 90, + description: "openSUSE Leap 15.6 official repository", + default_for: ["opensuse:15.6", "opensuse-leap:15.6", "opensuse-leap"] + }, + { + id: "alpine-v3.20", + name: "Alpine Linux v3.20", + distro: "alpine", + format: "apk", + url: "https://dl-cdn.alpinelinux.org/alpine/v3.20", + distribution: "v3.20", + components: ["main", "community"], + priority: 100, + description: "Alpine Linux v3.20 official repository", + default_for: ["alpine:3.20", "alpine:v3.20", "alpine"] + }, + { + id: "alpine-edge", + name: "Alpine Linux Edge", + distro: "alpine", + format: "apk", + url: "https://dl-cdn.alpinelinux.org/alpine/edge", + distribution: "edge", + components: ["main", "community", "testing"], + priority: 90, + description: "Alpine Linux Edge rolling repository", + default_for: ["alpine:edge"] + }, + { + id: "almalinux-9-baseos", + name: "AlmaLinux 9 BaseOS", + distro: "almalinux", + format: "rpm", + url: "https://repo.almalinux.org/almalinux/9/BaseOS/x86_64/os", + distribution: "9", + components: [], + priority: 100, + description: "AlmaLinux 9 BaseOS official repository", + default_for: ["almalinux:9", "almalinux"] + }, + { + id: "almalinux-9-appstream", + name: "AlmaLinux 9 AppStream", + distro: "almalinux", + format: "rpm", + url: "https://repo.almalinux.org/almalinux/9/AppStream/x86_64/os", + distribution: "9", + components: [], + priority: 90, + description: "AlmaLinux 9 AppStream official repository", + default_for: ["almalinux:9", "almalinux"] + }, + { + id: "rocky-9-baseos", + name: "Rocky Linux 9 BaseOS", + distro: "rocky", + format: "rpm", + url: "https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os", + distribution: "9", + components: [], + priority: 100, + description: "Rocky Linux 9 BaseOS official repository", + default_for: ["rocky:9", "rocky"] + }, + { + id: "rocky-9-appstream", + name: "Rocky Linux 9 AppStream", + distro: "rocky", + format: "rpm", + url: "https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os", + distribution: "9", + components: [], + priority: 90, + description: "Rocky Linux 9 AppStream official repository", + default_for: ["rocky:9", "rocky"] } ] }; - return new Response(JSON.stringify(data, null, 2), { + return new Response(JSON.stringify(fallbackData, null, 2), { headers: { "Content-Type": "application/json; charset=utf-8", - "Cache-Control": "public, max-age=3600", + "Cache-Control": "public, max-age=300", "Access-Control-Allow-Origin": "*" } }); diff --git a/repositories.json b/repositories.json new file mode 100644 index 0000000..ba99393 --- /dev/null +++ b/repositories.json @@ -0,0 +1,376 @@ +{ + "schema_version": "1.0", + "updated_at": "2026-09-18T22:00:00Z", + "repositories": [ + { + "id": "arch-core", + "name": "Arch Linux Core", + "distro": "arch", + "format": "alpm", + "url": "https://geo.mirror.pkgbuild.com", + "distribution": "core", + "components": [], + "priority": 100, + "description": "Core packages for Arch Linux", + "default_for": [ + "arch" + ] + }, + { + "id": "arch-extra", + "name": "Arch Linux Extra", + "distro": "arch", + "format": "alpm", + "url": "https://geo.mirror.pkgbuild.com", + "distribution": "extra", + "components": [], + "priority": 90, + "description": "Extra packages for Arch Linux", + "default_for": [ + "arch" + ] + }, + { + "id": "arch-multilib", + "name": "Arch Linux Multilib", + "distro": "arch", + "format": "alpm", + "url": "https://geo.mirror.pkgbuild.com", + "distribution": "multilib", + "components": [], + "priority": 80, + "description": "32-bit applications and libraries on 64-bit Arch Linux", + "default_for": [] + }, + { + "id": "ubuntu-noble", + "name": "Ubuntu 24.04 LTS (Noble Numbat)", + "distro": "ubuntu", + "format": "deb", + "url": "http://archive.ubuntu.com/ubuntu", + "distribution": "noble", + "components": [ + "main", + "universe", + "restricted", + "multiverse" + ], + "priority": 100, + "description": "Ubuntu 24.04 LTS official repository", + "default_for": [ + "ubuntu:24.04", + "ubuntu:noble" + ] + }, + { + "id": "ubuntu-resolute", + "name": "Ubuntu 26.04 LTS (Resolute Raccoon)", + "distro": "ubuntu", + "format": "deb", + "url": "http://archive.ubuntu.com/ubuntu", + "distribution": "resolute", + "components": [ + "main", + "universe", + "restricted", + "multiverse" + ], + "priority": 90, + "description": "Ubuntu 26.04 LTS official repository", + "default_for": [ + "ubuntu:26.04", + "ubuntu:resolute" + ] + }, + { + "id": "ubuntu-jammy", + "name": "Ubuntu 22.04 LTS (Jammy Jellyfish)", + "distro": "ubuntu", + "format": "deb", + "url": "http://archive.ubuntu.com/ubuntu", + "distribution": "jammy", + "components": [ + "main", + "universe", + "restricted", + "multiverse" + ], + "priority": 80, + "description": "Ubuntu 22.04 LTS official repository", + "default_for": [ + "ubuntu:22.04", + "ubuntu:jammy" + ] + }, + { + "id": "ubuntu-focal", + "name": "Ubuntu 20.04 LTS (Focal Fossa)", + "distro": "ubuntu", + "format": "deb", + "url": "http://archive.ubuntu.com/ubuntu", + "distribution": "focal", + "components": [ + "main", + "universe", + "restricted", + "multiverse" + ], + "priority": 70, + "description": "Ubuntu 20.04 LTS official repository", + "default_for": [ + "ubuntu:20.04", + "ubuntu:focal" + ] + }, + { + "id": "debian-bookworm", + "name": "Debian 12 (Bookworm)", + "distro": "debian", + "format": "deb", + "url": "http://deb.debian.org/debian", + "distribution": "bookworm", + "components": [ + "main", + "contrib", + "non-free", + "non-free-firmware" + ], + "priority": 100, + "description": "Debian 12 official repository", + "default_for": [ + "debian:12", + "debian:bookworm" + ] + }, + { + "id": "debian-trixie", + "name": "Debian 13 (Trixie)", + "distro": "debian", + "format": "deb", + "url": "http://deb.debian.org/debian", + "distribution": "trixie", + "components": [ + "main", + "contrib", + "non-free", + "non-free-firmware" + ], + "priority": 90, + "description": "Debian 13 official repository", + "default_for": [ + "debian:13", + "debian:trixie" + ] + }, + { + "id": "debian-sid", + "name": "Debian Unstable (Sid)", + "distro": "debian", + "format": "deb", + "url": "http://deb.debian.org/debian", + "distribution": "sid", + "components": [ + "main", + "contrib", + "non-free", + "non-free-firmware" + ], + "priority": 85, + "description": "Debian Unstable (Sid) rolling repository", + "default_for": [ + "debian:sid", + "debian:unstable" + ] + }, + { + "id": "debian-bullseye", + "name": "Debian 11 (Bullseye)", + "distro": "debian", + "format": "deb", + "url": "http://deb.debian.org/debian", + "distribution": "bullseye", + "components": [ + "main", + "contrib", + "non-free" + ], + "priority": 70, + "description": "Debian 11 official repository", + "default_for": [ + "debian:11", + "debian:bullseye" + ] + }, + { + "id": "fedora-41", + "name": "Fedora 41", + "distro": "fedora", + "format": "rpm", + "url": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/41/Everything/x86_64/os", + "distribution": "41", + "components": [], + "priority": 100, + "description": "Fedora 41 official repository", + "default_for": [ + "fedora:41" + ] + }, + { + "id": "fedora-42", + "name": "Fedora 42 (Rawhide)", + "distro": "fedora", + "format": "rpm", + "url": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/42/Everything/x86_64/os", + "distribution": "42", + "components": [], + "priority": 90, + "description": "Fedora 42 official repository", + "default_for": [ + "fedora:42", + "fedora:rawhide" + ] + }, + { + "id": "fedora-40", + "name": "Fedora 40", + "distro": "fedora", + "format": "rpm", + "url": "https://archives.fedoraproject.org/pub/archive/fedora/linux/releases/40/Everything/x86_64/os", + "distribution": "40", + "components": [], + "priority": 80, + "description": "Fedora 40 official repository", + "default_for": [ + "fedora:40" + ] + }, + { + "id": "opensuse-tumbleweed", + "name": "openSUSE Tumbleweed OSS", + "distro": "opensuse", + "format": "rpm", + "url": "https://download.opensuse.org/tumbleweed/repo/oss", + "distribution": "tumbleweed", + "components": [], + "priority": 100, + "description": "openSUSE Tumbleweed rolling release official repository", + "default_for": [ + "opensuse:tumbleweed", + "opensuse-tumbleweed" + ] + }, + { + "id": "opensuse-leap-15-6", + "name": "openSUSE Leap 15.6 OSS", + "distro": "opensuse", + "format": "rpm", + "url": "https://download.opensuse.org/distribution/leap/15.6/repo/oss", + "distribution": "15.6", + "components": [], + "priority": 90, + "description": "openSUSE Leap 15.6 official repository", + "default_for": [ + "opensuse:15.6", + "opensuse-leap:15.6", + "opensuse-leap" + ] + }, + { + "id": "alpine-v3.20", + "name": "Alpine Linux v3.20", + "distro": "alpine", + "format": "apk", + "url": "https://dl-cdn.alpinelinux.org/alpine/v3.20", + "distribution": "v3.20", + "components": [ + "main", + "community" + ], + "priority": 100, + "description": "Alpine Linux v3.20 official repository", + "default_for": [ + "alpine:3.20", + "alpine:v3.20", + "alpine" + ] + }, + { + "id": "alpine-edge", + "name": "Alpine Linux Edge", + "distro": "alpine", + "format": "apk", + "url": "https://dl-cdn.alpinelinux.org/alpine/edge", + "distribution": "edge", + "components": [ + "main", + "community", + "testing" + ], + "priority": 90, + "description": "Alpine Linux Edge rolling repository", + "default_for": [ + "alpine:edge" + ] + }, + { + "id": "almalinux-9-baseos", + "name": "AlmaLinux 9 BaseOS", + "distro": "almalinux", + "format": "rpm", + "url": "https://repo.almalinux.org/almalinux/9/BaseOS/x86_64/os", + "distribution": "9", + "components": [], + "priority": 100, + "description": "AlmaLinux 9 BaseOS official repository", + "default_for": [ + "almalinux:9", + "almalinux" + ] + }, + { + "id": "almalinux-9-appstream", + "name": "AlmaLinux 9 AppStream", + "distro": "almalinux", + "format": "rpm", + "url": "https://repo.almalinux.org/almalinux/9/AppStream/x86_64/os", + "distribution": "9", + "components": [], + "priority": 90, + "description": "AlmaLinux 9 AppStream official repository", + "default_for": [ + "almalinux:9", + "almalinux" + ] + }, + { + "id": "rocky-9-baseos", + "name": "Rocky Linux 9 BaseOS", + "distro": "rocky", + "format": "rpm", + "url": "https://dl.rockylinux.org/pub/rocky/9/BaseOS/x86_64/os", + "distribution": "9", + "components": [], + "priority": 100, + "description": "Rocky Linux 9 BaseOS official repository", + "default_for": [ + "rocky:9", + "rocky" + ] + }, + { + "id": "rocky-9-appstream", + "name": "Rocky Linux 9 AppStream", + "distro": "rocky", + "format": "rpm", + "url": "https://dl.rockylinux.org/pub/rocky/9/AppStream/x86_64/os", + "distribution": "9", + "components": [], + "priority": 90, + "description": "Rocky Linux 9 AppStream official repository", + "default_for": [ + "rocky:9", + "rocky" + ] + } + ] +} diff --git a/tests/test_curated_registry.rs b/tests/test_curated_registry.rs index 3a4e93c..d084442 100644 --- a/tests/test_curated_registry.rs +++ b/tests/test_curated_registry.rs @@ -99,10 +99,22 @@ fn test_curated_registry_fallback_structure() { "ubuntu-noble", "ubuntu-resolute", "ubuntu-jammy", + "ubuntu-focal", "debian-bookworm", "debian-trixie", + "debian-sid", + "debian-bullseye", "fedora-41", "fedora-42", + "fedora-40", + "opensuse-tumbleweed", + "opensuse-leap-15-6", + "alpine-v3.20", + "alpine-edge", + "almalinux-9-baseos", + "almalinux-9-appstream", + "rocky-9-baseos", + "rocky-9-appstream", ]; for id in &expected_ids { @@ -147,6 +159,24 @@ fn test_curated_registry_distro_detection_heuristics() { let fed_ids: Vec<&str> = fedora_repos.iter().map(|r| r.id.as_str()).collect(); assert_eq!(fed_ids, vec!["fedora-41"]); + // openSUSE Tumbleweed + let suse_repos = registry.default_for_distro("opensuse-tumbleweed", None, None); + let suse_ids: Vec<&str> = suse_repos.iter().map(|r| r.id.as_str()).collect(); + assert_eq!(suse_ids, vec!["opensuse-tumbleweed"]); + + // Alpine v3.20 + let alpine_repos = registry.default_for_distro("alpine", None, Some("3.20")); + let alp_ids: Vec<&str> = alpine_repos.iter().map(|r| r.id.as_str()).collect(); + assert_eq!(alp_ids, vec!["alpine-v3.20"]); + + // AlmaLinux 9 + let alma_repos = registry.default_for_distro("almalinux", None, Some("9")); + let alma_ids: Vec<&str> = alma_repos.iter().map(|r| r.id.as_str()).collect(); + assert_eq!( + alma_ids, + vec!["almalinux-9-baseos", "almalinux-9-appstream"] + ); + // Unknown distro fallback let unknown_repos = registry.default_for_distro("unknown_distro", None, None); let unk_ids: Vec<&str> = unknown_repos.iter().map(|r| r.id.as_str()).collect();