From 88fcafc274a72d5148be830e66d5db1cc7878653 Mon Sep 17 00:00:00 2001 From: Valentin Haudiquet Date: Fri, 2 Oct 2026 11:54:53 +0200 Subject: [PATCH] deb: point the build HOME at a chroot-internal scratch directory The build context inherits pkh's environment, so the rules ran with HOME set to the invoking user's host path - which does not exist inside the chroot. Tools keying user config on HOME then fail mid-build: gdb's doc build dies in texi2dvi because the TeX live setup cannot use the nonexistent home. Point HOME at /tmp/pkh-home, created through the build context (all drivers: local, unshare chroot, ssh, schroot). sbuild uses a non-writable path, Launchpad's buildd user a real one; a writable scratch directory matches the latter. --- src/deb/local.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/deb/local.rs b/src/deb/local.rs index 92dd992..233c6e5 100644 --- a/src/deb/local.rs +++ b/src/deb/local.rs @@ -148,6 +148,23 @@ pub async fn build( format!("parallel={} nocheck", num_cores), ); + // The build context inherits pkh's environment: without an override, + // HOME is the invoking user's host path, which does not exist inside + // the chroot - tools keying user config on it (texi2dvi's TeX live + // setup, anything writing dotfiles) then fail mid-build. sbuild points + // HOME at a non-writable path, Launchpad's buildd user at a real one; + // a writable scratch directory matches the latter. + env.insert("HOME".to_string(), "/tmp/pkh-home".to_string()); + let status = ctx + .command("mkdir") + .arg("-p") + .arg("/tmp/pkh-home") + .status() + .map_err(|e| format!("cannot create the build HOME: {e}"))?; + if !status.success() { + return Err("cannot create the build HOME (/tmp/pkh-home)".into()); + } + if cross { log::debug!("Setting up environment for local cross build..."); cross::setup_environment(&mut env, arch, ctx.clone())?;