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())?;