all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Shannon Sterz <s.sterz@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH proxmox 1/2] apt(-api-types): add dbgsym repositories per product
Date: Thu, 12 Nov 2026 17:08:48 +0100	[thread overview]
Message-ID: <20261112160849.434633-2-s.sterz@proxmox.com> (raw)
In-Reply-To: <20261112160849.434633-1-s.sterz@proxmox.com>

so they can be conveniently added and detected through each product's
API instead of only adding them manually.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
---
 proxmox-apt-api-types/src/lib.rs              |  8 +++
 proxmox-apt/src/repositories/standard.rs      | 40 +++++++++--
 proxmox-apt/tests/repositories.rs             | 70 ++++++++++++++++++-
 .../sources.list.d.expected/dbgsym.sources    |  5 ++
 .../tests/sources.list.d/dbgsym.sources       |  5 ++
 5 files changed, 123 insertions(+), 5 deletions(-)
 create mode 100644 proxmox-apt/tests/sources.list.d.expected/dbgsym.sources
 create mode 100644 proxmox-apt/tests/sources.list.d/dbgsym.sources

diff --git a/proxmox-apt-api-types/src/lib.rs b/proxmox-apt-api-types/src/lib.rs
index 00c75828..f6627efa 100644
--- a/proxmox-apt-api-types/src/lib.rs
+++ b/proxmox-apt-api-types/src/lib.rs
@@ -328,6 +328,8 @@ pub enum APTRepoComponent {
     Main,
     /// Internal staging repository for builds undergoing initial QA.
     Staging,
+    /// Debug symbols, useful for analyzing crashes etc.
+    Dbgsym,
     /// Forward-compat fallback for unknown wire values; stored lowercased.
     #[serde(untagged)]
     Unknown(String),
@@ -345,6 +347,7 @@ impl<'de> Deserialize<'de> for APTRepoComponent {
             "test" => Self::Test,
             "main" => Self::Main,
             "staging" => Self::Staging,
+            "dbgsym" => Self::Dbgsym,
             _ if is_apt_open_enum_token(&lower) => Self::Unknown(lower),
             _ => {
                 return Err(serde::de::Error::custom(format!(
@@ -701,6 +704,7 @@ const KNOWN_COMPONENTS: &[(&str, APTRepoComponent)] = &[
     ("no-subscription", APTRepoComponent::NoSubscription),
     ("enterprise", APTRepoComponent::Enterprise),
     ("staging", APTRepoComponent::Staging),
+    ("dbgsym", APTRepoComponent::Dbgsym),
     ("test", APTRepoComponent::Test),
     ("main", APTRepoComponent::Main),
 ];
@@ -771,6 +775,7 @@ impl APTRepositoryHandle {
     pub const ENTERPRISE: Self = Self::host(APTRepoComponent::Enterprise);
     pub const NO_SUBSCRIPTION: Self = Self::host(APTRepoComponent::NoSubscription);
     pub const TEST: Self = Self::host(APTRepoComponent::Test);
+    pub const DBG_SYM: Self = Self::host(APTRepoComponent::Dbgsym);
     pub const CEPH_SQUID_ENTERPRISE: Self =
         Self::standalone(APTRepoType::CephSquid, APTRepoComponent::Enterprise);
     pub const CEPH_SQUID_NO_SUBSCRIPTION: Self =
@@ -979,6 +984,7 @@ mod tests {
             ("enterprise", APTRepositoryHandle::ENTERPRISE),
             ("no-subscription", APTRepositoryHandle::NO_SUBSCRIPTION),
             ("test", APTRepositoryHandle::TEST),
+            ("dbgsym", APTRepositoryHandle::DBG_SYM),
             (
                 "ceph-squid-enterprise",
                 APTRepositoryHandle::CEPH_SQUID_ENTERPRISE,
@@ -1324,6 +1330,7 @@ mod tests {
                 | APTRepoComponent::Test
                 | APTRepoComponent::Main
                 | APTRepoComponent::Staging
+                | APTRepoComponent::Dbgsym
                 | APTRepoComponent::Unknown(_) => {}
             }
         }
@@ -1333,6 +1340,7 @@ mod tests {
             APTRepoComponent::Test,
             APTRepoComponent::Main,
             APTRepoComponent::Staging,
+            APTRepoComponent::Dbgsym,
         ] {
             let json = serde_json::to_string(&v).unwrap();
             let back: APTRepoComponent = serde_json::from_str(&json).unwrap();
diff --git a/proxmox-apt/src/repositories/standard.rs b/proxmox-apt/src/repositories/standard.rs
index f599de00..38bd31f4 100644
--- a/proxmox-apt/src/repositories/standard.rs
+++ b/proxmox-apt/src/repositories/standard.rs
@@ -1,5 +1,6 @@
 //! Standard Proxmox APT repositories, materialized from [`HOST_PRODUCTS`] x [`CHANNELS`]
-//! and [`CEPH_RELEASES`] x [`CHANNELS`] at first use.
+//! [`CEPH_RELEASES`] x [`CHANNELS`], and one repository for debug symbols per [`HOST_PRODUCTS`] at
+//! first use.
 //!
 //! # Adding a Ceph release
 //! 1. New `APTRepoType` variant + `Deserialize` arm (in api-types).
@@ -166,21 +167,29 @@ struct StandardRepoEntry {
     suites: &'static [DebianCodename],
 }
 
-/// Materialized table: host products' channels then Ceph releases' channels; order is
-/// load-bearing for `standard_repositories()` (the web UI consumes it for dropdowns).
+/// Materialized table: host products' channels then Ceph releases' channels then debug symbol
+/// repos; order is load-bearing for `standard_repositories()` (the web UI consumes it for
+/// dropdowns).
 static STANDARD_REPOS: LazyLock<Vec<StandardRepoEntry>> = LazyLock::new(|| {
-    let total = (HOST_PRODUCTS.len() + CEPH_RELEASES.len()) * CHANNELS.len();
+    // `+ HOST_PRODUCTS.len()` for one debug symbol repo per product
+    let total = (HOST_PRODUCTS.len() + CEPH_RELEASES.len()) * CHANNELS.len() + HOST_PRODUCTS.len();
     let mut v = Vec::with_capacity(total);
     for hp in HOST_PRODUCTS {
         for c in CHANNELS {
             v.push(host_product_entry(hp, c));
         }
     }
+
     for cr in CEPH_RELEASES {
         for c in CHANNELS {
             v.push(ceph_release_entry(cr, c));
         }
     }
+
+    for hp in HOST_PRODUCTS {
+        v.push(debug_symbols_entry(hp));
+    }
+
     v
 });
 
@@ -225,6 +234,29 @@ fn host_product_entry(hp: &HostProductDef, c: &Channel) -> StandardRepoEntry {
     }
 }
 
+fn debug_symbols_entry(hp: &HostProductDef) -> StandardRepoEntry {
+    StandardRepoEntry {
+        repo_type: hp.repo_type.clone(),
+        component: APTRepoComponent::Dbgsym,
+        offered_on_host: hp.host_product.clone(),
+        name: "Debug Symbols".into(),
+        description: "This repository contains debug symbols for packages installed through \
+            other Proxmox repositories."
+            .into(),
+        package_type: APTRepositoryPackageType::Deb,
+        canonical_uri: format!("https://dbgsym.proxmox.com/debian/{}", hp.slug),
+        // debug symbols never had extra URIs
+        extra_detect_uris: Vec::new(),
+        deb_component: format!("{}-dbgsym", hp.slug),
+        // debug symbols never had extra components
+        extra_detect_components: Vec::new(),
+        signing_keys: STANDARD_KEYRINGS,
+        file_path_legacy: "/etc/apt/sources.list".to_string(),
+        file_path_deb822: format!("/etc/apt/sources.list.d/{}-dbgsym.sources", hp.slug),
+        suites: &[DebianCodename::Bookworm, DebianCodename::Trixie],
+    }
+}
+
 fn ceph_release_entry(cr: &CephRelease, c: &Channel) -> StandardRepoEntry {
     let repo_type_kebab = cr.repo_type.to_string();
     StandardRepoEntry {
diff --git a/proxmox-apt/tests/repositories.rs b/proxmox-apt/tests/repositories.rs
index 4cc45867..626e6274 100644
--- a/proxmox-apt/tests/repositories.rs
+++ b/proxmox-apt/tests/repositories.rs
@@ -632,8 +632,10 @@ fn test_pdm_pmg_host_products_offer_full_channel_set() -> Result<(), Error> {
                 APTRepositoryHandle::ENTERPRISE,
                 APTRepositoryHandle::NO_SUBSCRIPTION,
                 APTRepositoryHandle::TEST,
+                APTRepositoryHandle::DBG_SYM,
             ],
-            "{host_product:?} should offer the three host-product channels in canonical order",
+            "{host_product:?} should offer the three host-product channels in canonical order and a \
+            debug symbol repository",
         );
 
         for r in &offered {
@@ -662,3 +664,69 @@ fn test_pdm_pmg_host_products_offer_full_channel_set() -> Result<(), Error> {
     }
     Ok(())
 }
+
+/// Every host product offers a debug symbol repo on bookworm and trixie.
+#[test]
+fn test_dbgsym_repo_offered() -> Result<(), Error> {
+    use proxmox_apt::repositories::APTRepositoryHandleImpl;
+    use proxmox_apt_api_types::{APTRepositoryFileType, APTRepositoryOption};
+
+    let handle: APTRepositoryHandle = "dbgsym"
+        .parse()
+        .unwrap_or_else(|e| panic!("parsing 'dbgsym' failed: {e}"));
+
+    for host_product in [
+        HostProduct::Pve,
+        HostProduct::Pbs,
+        HostProduct::Pdm,
+        HostProduct::Pmg,
+    ] {
+        let slug = host_product.as_str();
+        for (suite, file_type, path) in [
+            (
+                DebianCodename::Bookworm,
+                APTRepositoryFileType::List,
+                "/etc/apt/sources.list".to_string(),
+            ),
+            (
+                DebianCodename::Trixie,
+                APTRepositoryFileType::Sources,
+                format!("/etc/apt/sources.list.d/{slug}-dbgsym.sources"),
+            ),
+        ] {
+            let offered = standard_repos_offered_for(&host_product, &suite);
+            let entry = offered
+                .iter()
+                .find(|r| r.handle == handle)
+                .unwrap_or_else(|| panic!("{host_product:?}/{suite} does not offer dbgsym"));
+            assert_eq!(entry.name, "Debug Symbols");
+            assert_eq!(entry.status, None);
+
+            let repo = handle
+                .to_repository(&host_product, &suite)
+                .unwrap_or_else(|| panic!("no dbgsym repository for {host_product:?}/{suite}"));
+            assert_eq!(
+                repo.uris,
+                vec![format!("https://dbgsym.proxmox.com/debian/{slug}")]
+            );
+            assert_eq!(repo.components, vec![format!("{slug}-dbgsym")]);
+            assert_eq!(repo.suites, vec![suite.to_string()]);
+            assert_eq!(repo.file_type, file_type);
+            assert_eq!(
+                repo.options,
+                vec![APTRepositoryOption {
+                    key: "Signed-By".into(),
+                    values: vec!["/usr/share/keyrings/proxmox-archive-keyring.gpg".into()],
+                }],
+            );
+            assert_eq!(handle.file_path(&host_product, &suite), Some(path));
+        }
+        assert!(
+            handle
+                .to_repository(&host_product, &DebianCodename::Bullseye)
+                .is_none(),
+            "dbgsym must not be offered on bullseye for {host_product:?}",
+        );
+    }
+    Ok(())
+}
diff --git a/proxmox-apt/tests/sources.list.d.expected/dbgsym.sources b/proxmox-apt/tests/sources.list.d.expected/dbgsym.sources
new file mode 100644
index 00000000..805dec3b
--- /dev/null
+++ b/proxmox-apt/tests/sources.list.d.expected/dbgsym.sources
@@ -0,0 +1,5 @@
+Types: deb
+URIs: https://dbgsym.proxmox.com/debian/pve
+Suites: trixie
+Components: pve-dbgsym
+Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
diff --git a/proxmox-apt/tests/sources.list.d/dbgsym.sources b/proxmox-apt/tests/sources.list.d/dbgsym.sources
new file mode 100644
index 00000000..805dec3b
--- /dev/null
+++ b/proxmox-apt/tests/sources.list.d/dbgsym.sources
@@ -0,0 +1,5 @@
+Types: deb
+URIs: https://dbgsym.proxmox.com/debian/pve
+Suites: trixie
+Components: pve-dbgsym
+Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
-- 
2.47.3





  reply	other threads:[~2026-11-12 16:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-12 16:08 [PATCH proxmox/yew-comp 0/2] Add the Debug Symbol Repos to proxmox-apt and yew-comp Shannon Sterz
2026-11-12 16:08 ` Shannon Sterz [this message]
2026-11-12 16:08 ` [PATCH yew-comp 2/2] apt: add support for debug symbols repositories Shannon Sterz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112160849.434633-2-s.sterz@proxmox.com \
    --to=s.sterz@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal