feat: update package versions and enhance lib32 output handling
This commit is contained in:
+30
-12
@@ -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<Option<(package::PackageSpec, PathBuf)>> {
|
||||
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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String>,
|
||||
/// 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(),
|
||||
|
||||
+22
-1
@@ -622,7 +622,8 @@ fn source_deps_for_install(
|
||||
lib32_only: bool,
|
||||
) -> Vec<String> {
|
||||
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![
|
||||
|
||||
Reference in New Issue
Block a user