build: record the actual build environment in .buildinfo

The binary build exported DEB_BUILD_OPTIONS='parallel=<context nproc>
nocheck' (or the -j override) but the generated .buildinfo recomputed
the environment from host state: host core count, no nocheck, and
vendor profiles that ignored DEB_BUILD_PROFILES (a cross build recorded
no 'cross' profile). generate_binary_metadata now records the exact env
map that was exported to the build steps, and the recorded profiles
come from the exported DEB_BUILD_PROFILES when set.

Also unifies vendor parsing on one helper (the context-side copy lacked
the Origin: fallback of the source-build path).
This commit is contained in:
2026-09-16 04:22:43 +02:00
parent 50ae12cafe
commit 3a454b0811
4 changed files with 98 additions and 54 deletions
+4 -3
View File
@@ -1439,7 +1439,7 @@ Provides: virtual-thing (= 2.0), plain-virtual
let vendor = env::current_vendor();
let profiles = env::resolve_build_profiles(&[], &vendor);
let parallel = env::num_parallel();
let build_env_vars: Vec<(String, String)> = [
let build_env_vars: BTreeMap<String, String> = [
("LANG".to_string(), "C".to_string()),
(
"DEB_BUILD_OPTIONS".to_string(),
@@ -1467,8 +1467,9 @@ Provides: virtual-thing (= 2.0), plain-virtual
let opts = crate::build::binary::BinaryMetadataOptions {
profiles,
vendor,
parallel,
source_date_epoch: entry.timestamp,
// The metadata records exactly the environment exported to the
// build steps above.
exported_env: build_env_vars,
build_arch: native_arch.clone(),
host_arch: native_arch,
};