feat: update depot version to 0.35.0 and enhance configure argument handling
This commit is contained in:
Generated
+1
-1
@@ -451,7 +451,7 @@ checksum = "807800ff3288b621186fe0a8f3392c4652068257302709c24efd918c3dffcdc2"
|
||||
|
||||
[[package]]
|
||||
name = "depot"
|
||||
version = "0.34.1"
|
||||
version = "0.35.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"ar",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "depot"
|
||||
version = "0.34.1"
|
||||
version = "0.35.0"
|
||||
edition = "2024"
|
||||
|
||||
[lints.rust]
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
project(
|
||||
'depot',
|
||||
version: '0.34.1',
|
||||
version: '0.35.0',
|
||||
meson_version: '>=0.60.0',
|
||||
default_options: ['buildtype=release'],
|
||||
)
|
||||
|
||||
+32
-13
@@ -132,10 +132,10 @@ pub fn build(
|
||||
|
||||
for arg in &flags.configure {
|
||||
let expanded = expand_configure_arg(spec, arg, &env_vars);
|
||||
add_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &expanded);
|
||||
configure_cmd.arg(expanded);
|
||||
}
|
||||
for arg in crate::builder::static_build_args_for(crate::package::BuildType::Autotools)? {
|
||||
add_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &arg);
|
||||
add_auto_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &arg);
|
||||
}
|
||||
|
||||
let status = crate::interrupts::command_status(&mut configure_cmd)
|
||||
@@ -442,10 +442,10 @@ pub(crate) fn ensure_host_build(
|
||||
}
|
||||
for arg in &flags.configure {
|
||||
let expanded = expand_configure_arg(&host_spec, arg, &env_vars);
|
||||
add_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &expanded);
|
||||
configure_cmd.arg(expanded);
|
||||
}
|
||||
for arg in crate::builder::static_build_args_for(crate::package::BuildType::Autotools)? {
|
||||
add_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &arg);
|
||||
add_auto_configure_arg_if_supported(&mut configure_cmd, help_text.as_deref(), &arg);
|
||||
}
|
||||
|
||||
let status = crate::interrupts::command_status(&mut configure_cmd)
|
||||
@@ -579,9 +579,15 @@ fn configure_help_supports_option(help_text: &str, option: &str) -> bool {
|
||||
}
|
||||
|
||||
fn configure_help_mentions_option(help_text: &str, option: &str) -> bool {
|
||||
let with_eq = format!("{}=", option);
|
||||
let with_space = format!("{} ", option);
|
||||
help_text.contains(&with_eq) || help_text.contains(&with_space) || help_text.contains(option)
|
||||
help_text.match_indices(option).any(|(idx, _)| {
|
||||
let before = help_text[..idx].chars().next_back();
|
||||
let after = help_text[idx + option.len()..].chars().next();
|
||||
is_configure_option_boundary(before) && is_configure_option_boundary(after)
|
||||
})
|
||||
}
|
||||
|
||||
fn is_configure_option_boundary(ch: Option<char>) -> bool {
|
||||
ch.is_none_or(|ch| !ch.is_ascii_alphanumeric() && ch != '_' && ch != '-')
|
||||
}
|
||||
|
||||
fn configure_help_option_aliases(option: &str) -> Vec<String> {
|
||||
@@ -629,7 +635,11 @@ fn configure_long_option(arg: &str) -> Option<&str> {
|
||||
Some(&trimmed[..end])
|
||||
}
|
||||
|
||||
fn add_configure_arg_if_supported(configure_cmd: &mut Command, help_text: Option<&str>, arg: &str) {
|
||||
fn add_auto_configure_arg_if_supported(
|
||||
configure_cmd: &mut Command,
|
||||
help_text: Option<&str>,
|
||||
arg: &str,
|
||||
) {
|
||||
if let Some(help_text) = help_text
|
||||
&& let Some(option) = configure_long_option(arg)
|
||||
&& !configure_help_supports_option(help_text, option)
|
||||
@@ -1094,6 +1104,15 @@ mod tests {
|
||||
assert!(configure_help_supports_option(help, "--without-zlib"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_configure_help_supports_option_requires_exact_match() {
|
||||
let help = "\
|
||||
--host-cc=HOSTCC use host C compiler
|
||||
--build-suffix=SUFFIX library name suffix []";
|
||||
assert!(!configure_help_supports_option(help, "--host"));
|
||||
assert!(!configure_help_supports_option(help, "--build"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_looks_like_configure_help_text_accepts_bootstrap_style_output() {
|
||||
let help = "\
|
||||
@@ -1205,9 +1224,9 @@ Options:
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add_configure_arg_if_supported_skips_unsupported_long_option() {
|
||||
fn test_add_auto_configure_arg_if_supported_skips_unsupported_long_option() {
|
||||
let mut cmd = Command::new("configure");
|
||||
add_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "--disable-nls");
|
||||
add_auto_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "--disable-nls");
|
||||
|
||||
let args: Vec<String> = cmd
|
||||
.get_args()
|
||||
@@ -1217,10 +1236,10 @@ Options:
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_add_configure_arg_if_supported_keeps_supported_alias_and_non_option_args() {
|
||||
fn test_add_auto_configure_arg_if_supported_keeps_supported_alias_and_non_option_args() {
|
||||
let mut cmd = Command::new("configure");
|
||||
add_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "--disable-static");
|
||||
add_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "srcdir");
|
||||
add_auto_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "--disable-static");
|
||||
add_auto_configure_arg_if_supported(&mut cmd, Some("--enable-static"), "srcdir");
|
||||
|
||||
let args: Vec<String> = cmd
|
||||
.get_args()
|
||||
|
||||
+65
-14
@@ -1414,6 +1414,21 @@ fn print_plan_summary(plan: &planner::ExecutionPlan) {
|
||||
}
|
||||
}
|
||||
|
||||
fn actionable_plan_packages(plan: &planner::ExecutionPlan) -> Vec<String> {
|
||||
plan.actionable_steps()
|
||||
.map(|step| step.package.clone())
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn warn_source_build_installs(count: usize) {
|
||||
if count > 0 {
|
||||
ui::warn(format!(
|
||||
"{} package(s) will be built from source before installation.",
|
||||
count
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
struct InstallPlanExecutionOptions<'a> {
|
||||
no_flags: bool,
|
||||
@@ -1524,16 +1539,8 @@ fn execute_install_plan_with_child_commands(
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if summary.source_build_installs > 0 {
|
||||
ui::warn(format!(
|
||||
"{} package(s) will be built from source before installation.",
|
||||
summary.source_build_installs
|
||||
));
|
||||
}
|
||||
let planned_packages: Vec<String> = actionable_steps
|
||||
.iter()
|
||||
.map(|step| step.package.clone())
|
||||
.collect();
|
||||
warn_source_build_installs(summary.source_build_installs);
|
||||
let planned_packages = actionable_plan_packages(plan);
|
||||
if options.confirm_installation
|
||||
&& !ui::prompt_package_action("installation", &planned_packages, true)?
|
||||
{
|
||||
@@ -2169,7 +2176,27 @@ fn run_direct_install_request(
|
||||
"Missing dependencies: {}",
|
||||
missing_required.join(", ")
|
||||
));
|
||||
if ui::prompt_package_action("dependency installation", &missing_required, true)? {
|
||||
let local_sibling_root = spec_path.parent().and_then(|path| path.parent());
|
||||
let dep_plan = planner::build_dependency_install_plan(
|
||||
config,
|
||||
options.rootfs,
|
||||
&missing_required,
|
||||
planner::PlannerOptions {
|
||||
assume_yes: ui::assume_yes_enabled(),
|
||||
prefer_binary: config.repo_settings.prefer_binary,
|
||||
local_sibling_root: local_sibling_root.map(Path::to_path_buf),
|
||||
include_test_deps: options.install_test_deps,
|
||||
lib32_only_requested_specs: false,
|
||||
},
|
||||
)?;
|
||||
let dep_plan_packages = actionable_plan_packages(&dep_plan);
|
||||
warn_source_build_installs(dep_plan.summary().source_build_installs);
|
||||
let dep_prompt_packages = if dep_plan_packages.is_empty() {
|
||||
missing_required.clone()
|
||||
} else {
|
||||
dep_plan_packages
|
||||
};
|
||||
if ui::prompt_package_action("dependency installation", &dep_prompt_packages, true)? {
|
||||
// Build package index for fast lookups
|
||||
let pkg_index =
|
||||
index::PackageIndex::build_with_repo_dir(Some(config.repo_clone_dir.clone()));
|
||||
@@ -2203,7 +2230,7 @@ fn run_direct_install_request(
|
||||
options.rootfs,
|
||||
ChildInstallCommandOptions {
|
||||
no_deps: options.no_deps,
|
||||
assume_yes: false,
|
||||
assume_yes: true,
|
||||
no_flags: options.no_flags,
|
||||
cross_prefix: options.cross_prefix,
|
||||
clean: options.clean,
|
||||
@@ -2252,7 +2279,31 @@ fn run_direct_install_request(
|
||||
"Missing test dependencies: {}",
|
||||
missing_test.join(", ")
|
||||
));
|
||||
if ui::prompt_package_action("dependency installation", &missing_test, true)? {
|
||||
let local_sibling_root = spec_path.parent().and_then(|path| path.parent());
|
||||
let dep_plan = planner::build_dependency_install_plan(
|
||||
config,
|
||||
options.rootfs,
|
||||
&missing_test,
|
||||
planner::PlannerOptions {
|
||||
assume_yes: ui::assume_yes_enabled(),
|
||||
prefer_binary: config.repo_settings.prefer_binary,
|
||||
local_sibling_root: local_sibling_root.map(Path::to_path_buf),
|
||||
include_test_deps: options.install_test_deps,
|
||||
lib32_only_requested_specs: false,
|
||||
},
|
||||
)?;
|
||||
let dep_plan_packages = actionable_plan_packages(&dep_plan);
|
||||
warn_source_build_installs(dep_plan.summary().source_build_installs);
|
||||
let dep_prompt_packages = if dep_plan_packages.is_empty() {
|
||||
missing_test.clone()
|
||||
} else {
|
||||
dep_plan_packages
|
||||
};
|
||||
if ui::prompt_package_action(
|
||||
"dependency installation",
|
||||
&dep_prompt_packages,
|
||||
true,
|
||||
)? {
|
||||
ui::info(format!(
|
||||
"Installing test dependencies: {}",
|
||||
install_request_display(&dep_spec_paths)
|
||||
@@ -2265,7 +2316,7 @@ fn run_direct_install_request(
|
||||
options.rootfs,
|
||||
ChildInstallCommandOptions {
|
||||
no_deps: options.no_deps,
|
||||
assume_yes: false,
|
||||
assume_yes: true,
|
||||
no_flags: options.no_flags,
|
||||
cross_prefix: options.cross_prefix,
|
||||
clean: options.clean,
|
||||
|
||||
Reference in New Issue
Block a user