diff --git a/Cargo.lock b/Cargo.lock index baf789d..7639f48 100755 --- a/Cargo.lock +++ b/Cargo.lock @@ -418,7 +418,7 @@ checksum = "807800ff3288b621186fe0a8f3392c4652068257302709c24efd918c3dffcdc2" [[package]] name = "depot" -version = "0.22.0" +version = "0.22.1" dependencies = [ "anyhow", "ar", @@ -1235,9 +1235,9 @@ dependencies = [ [[package]] name = "libsqlite3-sys" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a" +checksum = "b1f111c8c41e7c61a49cd34e44c7619462967221a6443b0ec299e0ac30cfb9b1" dependencies = [ "pkg-config", "vcpkg", @@ -1304,9 +1304,9 @@ checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" [[package]] name = "lz4_flex" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab6473172471198271ff72e9379150e9dfd70d8e533e0752a27e515b48dd375e" +checksum = "db9a0d582c2874f68138a16ce1867e0ffde6c0bb0a0df85e1f36d04146db488a" dependencies = [ "twox-hash", ] @@ -1740,9 +1740,9 @@ dependencies = [ [[package]] name = "rusqlite" -version = "0.38.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3" +checksum = "a0d2b0146dd9661bf67bb107c0bb2a55064d556eeb3fc314151b957f313bcd4e" dependencies = [ "bitflags", "fallible-iterator", diff --git a/Cargo.toml b/Cargo.toml index 5188492..9c0cf0e 100755 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "depot" -version = "0.22.0" +version = "0.22.1" edition = "2024" [lints.rust] @@ -15,7 +15,7 @@ flate2 = "1.1.9" git2 = "0.20.4" indicatif = "0.18.4" nix = { version = "0.31.2", features = ["user"] } -rusqlite = "0.38.0" +rusqlite = "0.39.0" semver = "1.0.27" serde = { version = "1.0.228", features = ["derive"] } yaml-rust2 = "0.11.0" @@ -43,7 +43,7 @@ sys-mount = { version = "3.1.0", default-features = false } time = { version = "0.3.47", features = ["formatting", "parsing"] } b2sum-rust = "0.3.0" serde_ignored = "0.1.14" -lz4_flex = "0.12.0" +lz4_flex = "0.13.0" lzma-rust2 = "0.16.2" signal-hook = "0.4.3" diff --git a/meson.build b/meson.build index dea1412..e75dce5 100644 --- a/meson.build +++ b/meson.build @@ -1,6 +1,6 @@ project( 'depot', - version: '0.22.0', + version: '0.22.1', meson_version: '>=0.60.0', default_options: ['buildtype=release'], ) diff --git a/src/commands.rs b/src/commands.rs index 99cc287..52b81b1 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -903,15 +903,19 @@ fn maybe_prompt_to_skip_tests_for_missing_requested_deps( } fn requested_outputs(pkg_spec: &package::PackageSpec, lib32_only: bool) -> deps::RequestedOutputs { - if lib32_only { + if effective_lib32_only(pkg_spec, lib32_only) { deps::RequestedOutputs::Lib32Only - } else if pkg_spec.build.flags.build_32 { + } else if pkg_spec.builds_lib32_output() { deps::RequestedOutputs::PrimaryAndLib32 } else { deps::RequestedOutputs::PrimaryOnly } } +fn effective_lib32_only(pkg_spec: &package::PackageSpec, cli_lib32_only: bool) -> bool { + cli_lib32_only || pkg_spec.builds_only_lib32_output() +} + fn should_install_test_deps( pkg_spec: &package::PackageSpec, install_test_deps: bool, @@ -1080,7 +1084,7 @@ fn build_lib32_companion_package( export_compiler_flags: bool, force: bool, ) -> Result> { - if !pkg_spec.build.flags.build_32 && !force { + if !pkg_spec.builds_lib32_output() && !force { return Ok(None); } if pkg_spec.is_metapackage() { @@ -3217,11 +3221,12 @@ fn execute_install_plan_with_child_commands( let mut spec = package::PackageSpec::from_file(path) .with_context(|| format!("Failed to parse spec {}", path.display()))?; spec.apply_config(config); - let lib32_only = step_requests_only_lib32(step, &options); + let lib32_only = + effective_lib32_only(&spec, step_requests_only_lib32(step, &options)); conflict_subjects.extend(install_conflict_subjects_for_spec( &spec, !lib32_only, - spec.build.flags.build_32 || lib32_only, + spec.builds_lib32_output() || lib32_only, )); } planner::PlanOrigin::Binary { record, .. } => { @@ -3750,6 +3755,7 @@ fn run_direct_install_request( if options.lib32_only && staging_dir.is_some() { anyhow::bail!("--lib32-only is only supported when installing from a package spec"); } + let lib32_only = effective_lib32_only(&pkg_spec, options.lib32_only); if staging_dir.is_none() && !suppress_output { ui::info(format!( @@ -3758,12 +3764,12 @@ fn run_direct_install_request( )); } - let requested_outputs = requested_outputs(&pkg_spec, options.lib32_only); + let requested_outputs = requested_outputs(&pkg_spec, lib32_only); let mut conflict_subjects = install_conflict_subjects_for_spec( &pkg_spec, - !options.lib32_only, - staging_dir.is_none() && (options.lib32_only || pkg_spec.build.flags.build_32), + !lib32_only, + staging_dir.is_none() && (lib32_only || pkg_spec.builds_lib32_output()), ); if staging_dir.is_some() { conflict_subjects = install_conflict_subjects_for_spec(&pkg_spec, true, false); @@ -3997,7 +4003,7 @@ fn run_direct_install_request( .join("destdir") .join(&pkg_spec.package.name); - if !options.lib32_only { + if !lib32_only { builder::build( &pkg_spec, &src_dir, @@ -4016,7 +4022,7 @@ fn run_direct_install_request( let mut transaction_plans = Vec::new(); - if !options.lib32_only { + if !lib32_only { if staging_dir.is_none() { // Source-build path: apply staging transforms (strip/compress/static cleanup). staging::process(&destdir, &pkg_spec)?; @@ -4042,7 +4048,7 @@ fn run_direct_install_request( config, cross_config.as_ref(), !options.no_flags, - options.lib32_only, + lib32_only, )? { let staged = plan_staged_install(&lib32_spec, &lib32_destdir, options.rootfs, config)?; @@ -4258,7 +4264,7 @@ pub fn run(cli: Cli) -> Result<()> { let cross_prefix = build_exec_args.cross_prefix; let clean = build_exec_args.clean; let dry_run = build_exec_args.dry_run; - let lib32_only = lib32_args.lib32_only; + let cli_lib32_only = lib32_args.lib32_only; warn_if_running_as_root_for_build("build", &rootfs); let spec_path = spec.or(spec_pos).context("No spec file provided")?; ui::info(format!("Building package from: {}", spec_path.display())); @@ -4275,6 +4281,7 @@ pub fn run(cli: Cli) -> Result<()> { let build_result: Result<()> = (|| { // Apply system overrides pkg_spec.apply_config(&config); + let lib32_only = effective_lib32_only(&pkg_spec, cli_lib32_only); let requested_outputs = requested_outputs(&pkg_spec, lib32_only); let build_targets = vec![format!( @@ -6954,4 +6961,15 @@ optional = [] assert_eq!(lib32.dependencies.runtime, vec!["lib32-zlib", "pkg"]); assert_eq!(lib32.dependencies.optional, vec!["lib32-gtk-doc"]); } + + #[test] + fn requested_outputs_prefers_lib32_only_spec_flag() { + let mut spec = test_package_spec(package::BuildType::Custom, None, &[]); + spec.build.flags.lib32_only = true; + + assert_eq!( + requested_outputs(&spec, false), + deps::RequestedOutputs::Lib32Only + ); + } } diff --git a/src/package/spec.rs b/src/package/spec.rs index 2156654..41ee568 100755 --- a/src/package/spec.rs +++ b/src/package/spec.rs @@ -256,6 +256,16 @@ impl PackageSpec { format!("lib32-{}", self.package.name) } + /// Return true when this spec should emit the generated `lib32-*` package. + pub fn builds_lib32_output(&self) -> bool { + self.build.flags.build_32 || self.build.flags.lib32_only + } + + /// Return true when only the generated `lib32-*` package should be emitted. + pub fn builds_only_lib32_output(&self) -> bool { + self.build.flags.lib32_only + } + /// Return the effective dependency set used by the generated lib32 companion package. pub fn lib32_dependencies(&self) -> Dependencies { let mut deps = self @@ -819,6 +829,11 @@ impl PackageSpec { self.build.flags.build_32 = b; } } + "lib32_only" | "lib32-only" => { + if let Some(b) = toml_value_as_boolish(v) { + self.build.flags.lib32_only = b; + } + } "configure_lib32" | "configure-lib32" => { if let Some(arr) = v.as_array() { self.build.flags.configure_lib32 = arr @@ -1562,6 +1577,11 @@ impl PackageSpec { self.build.flags.build_32 = b; } } + "lib32_only" | "lib32-only" => { + if let Some(b) = values.last().and_then(toml_value_as_boolish) { + self.build.flags.lib32_only = b; + } + } "split_docs" | "split-docs" => { if let Some(b) = values.last().and_then(toml_value_as_boolish) { self.build.flags.split_docs = b; @@ -3006,6 +3026,7 @@ type = "autotools" [build.flags] "build-32" = "true" +"lib32-only" = "yes" "CFLAGS-lib32" = ["-mstackrealign"] "CXXFLAGS-lib32" = ["-fno-rtti"] "configure-lib32" = ["--disable-static"] @@ -3018,6 +3039,9 @@ type = "autotools" let spec = PackageSpec::from_file(&path).unwrap(); assert!(spec.build.flags.build_32); + assert!(spec.build.flags.lib32_only); + assert!(spec.builds_lib32_output()); + assert!(spec.builds_only_lib32_output()); assert_eq!(spec.build.flags.cflags_lib32, vec!["-mstackrealign"]); assert_eq!(spec.build.flags.cxxflags_lib32, vec!["-fno-rtti"]); assert_eq!(spec.build.flags.configure_lib32, vec!["--disable-static"]); @@ -3911,6 +3935,14 @@ pub struct BuildFlags { deserialize_with = "deserialize_boolish" )] pub build_32: bool, + /// Build/install only the generated `lib32-*` companion package output. + #[serde( + default, + alias = "lib32-only", + alias = "lib32_only", + deserialize_with = "deserialize_boolish" + )] + pub lib32_only: bool, #[serde(default)] pub configure: Vec, /// PEP 517 config settings for Python builds (each entry is `KEY=VALUE` or `KEY`). @@ -4215,6 +4247,7 @@ impl Default for BuildFlags { no_compress_man: false, skip_tests: false, build_32: false, + lib32_only: false, configure: Vec::new(), config_settings: Vec::new(), configure_lib32: Vec::new(), diff --git a/src/planner.rs b/src/planner.rs index 8f85ae6..41381ff 100644 --- a/src/planner.rs +++ b/src/planner.rs @@ -622,7 +622,8 @@ fn source_deps_for_install( lib32_only: bool, ) -> Vec { let mut deps_all = Vec::new(); - let include_lib32 = lib32_only || spec.build.flags.build_32; + let lib32_only = lib32_only || spec.builds_only_lib32_output(); + let include_lib32 = lib32_only || spec.builds_lib32_output(); let local_provides = spec.local_dependency_provides_for_selection(!lib32_only, include_lib32); if !lib32_only && !spec.is_metapackage() { for dep in &spec.dependencies.build { @@ -960,6 +961,26 @@ mod tests { assert!(!deps.contains(&"bats".to_string())); } + #[test] + fn source_deps_for_install_uses_lib32_only_dependencies_from_spec_flag() { + let mut spec = mk_spec(); + spec.build.flags.lib32_only = true; + spec.dependencies.lib32 = Some(crate::package::DependencyGroup { + build: vec!["gcc-multilib".into()], + runtime: vec!["lib32-zlib".into()], + test: vec!["lib32-bats".into()], + optional: Vec::new(), + }); + + let deps = source_deps_for_install(&spec, true, false); + assert!(deps.contains(&"gcc-multilib".to_string())); + assert!(deps.contains(&"lib32-zlib".to_string())); + assert!(deps.contains(&"lib32-bats".to_string())); + assert!(!deps.contains(&"make".to_string())); + assert!(!deps.contains(&"zlib".to_string())); + assert!(!deps.contains(&"bats".to_string())); + } + #[test] fn candidate_dedup_keeps_highest_priority_origin_for_same_package() { let candidates = vec![