From 24faad6e11196c1f90f2d48a640d81d6a9581941 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Sat, 22 Aug 2026 12:39:26 +0200 Subject: [PATCH] deb: pin proposed pocket when building against it 'proposed' pockets are marked 'NotAutomatic' in their Release file, which gives them an apt priority of 1: apt would ignore them during build-dependency resolution even when the suite is enabled. Write an apt preferences entry pinning '{series}-proposed' at priority 600 so build-dependencies are actually resolved from the requested pocket. Apt preferences are global: a single 'release' pin matches the pinned suite on every repository carrying it (archive, security and ports), for all architectures, so this also covers cross-builds pulling dependencies from 'ports.ubuntu.com'. --- src/deb/local.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/deb/local.rs b/src/deb/local.rs index de0b0af..ca610db 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -128,6 +128,13 @@ pub async fn build( modified = true; } } + + // 'proposed' pockets are marked 'NotAutomatic' in their Release file, + // giving them an apt priority of 1: without an explicit pin, apt + // would ignore them even when enabled + if pocket_name.starts_with("proposed") { + pin_pocket(&pocket_suite, &ctx)?; + } } if modified { @@ -331,6 +338,24 @@ fn apply_quilt_patches( Ok(()) } +/// Pin a 'NotAutomatic' pocket (e.g. '-proposed') so apt takes it into +/// account during dependency resolution. +/// +/// Apt preferences are global: a single 'release' pin matches the pinned +/// suite on every repository carrying it (archive, security and ports), +/// for all architectures, so this also covers cross-builds pulling +/// dependencies from 'ports.ubuntu.com'. +fn pin_pocket(pocket_suite: &str, ctx: &Arc) -> Result<(), Box> { + let pin_path = format!("/etc/apt/preferences.d/pkh-{}", pocket_suite); + let pin_content = format!( + "Package: *\nPin: release a={}\nPin-Priority: 600\n", + pocket_suite + ); + log::info!("Pinning pocket '{}' with priority 600", pocket_suite); + ctx.write_file(Path::new(&pin_path), &pin_content)?; + Ok(()) +} + fn install_injected_packages( packages: &[&str], env: &HashMap,