feat: update depot version to 0.26.0 and modify lib32 hook script handling
This commit is contained in:
Generated
+1
-1
@@ -418,7 +418,7 @@ checksum = "807800ff3288b621186fe0a8f3392c4652068257302709c24efd918c3dffcdc2"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "depot"
|
name = "depot"
|
||||||
version = "0.25.1"
|
version = "0.26.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anyhow",
|
"anyhow",
|
||||||
"ar",
|
"ar",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "depot"
|
name = "depot"
|
||||||
version = "0.25.1"
|
version = "0.26.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[lints.rust]
|
[lints.rust]
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
project(
|
project(
|
||||||
'depot',
|
'depot',
|
||||||
version: '0.25.1',
|
version: '0.26.0',
|
||||||
meson_version: '>=0.60.0',
|
meson_version: '>=0.60.0',
|
||||||
default_options: ['buildtype=release'],
|
default_options: ['buildtype=release'],
|
||||||
)
|
)
|
||||||
|
|||||||
+27
-19
@@ -692,11 +692,7 @@ fn resolve_hook_script(script_dir: &Path, hook: Hook, pkg_name: &str) -> Result<
|
|||||||
|
|
||||||
if is_lib32_package(pkg_name) {
|
if is_lib32_package(pkg_name) {
|
||||||
let label = format!("{} (lib32)", hook.canonical_name());
|
let label = format!("{} (lib32)", hook.canonical_name());
|
||||||
if let Some(path) =
|
return resolve_hook_from_candidates(script_dir, &label, hook.lib32_candidate_names());
|
||||||
resolve_hook_from_candidates(script_dir, &label, hook.lib32_candidate_names())?
|
|
||||||
{
|
|
||||||
return Ok(Some(path));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_hook_from_candidates(script_dir, hook.canonical_name(), hook.candidate_names())
|
resolve_hook_from_candidates(script_dir, hook.canonical_name(), hook.candidate_names())
|
||||||
@@ -808,19 +804,11 @@ fn collect_legacy_root_hooks(spec_dir: &Path, pkg_name: &str) -> Result<Vec<(Hoo
|
|||||||
for hook in ALL_HOOKS {
|
for hook in ALL_HOOKS {
|
||||||
let matched_path = if is_lib32_package(pkg_name) {
|
let matched_path = if is_lib32_package(pkg_name) {
|
||||||
let lib32_label = format!("{} (lib32)", hook.canonical_name());
|
let lib32_label = format!("{} (lib32)", hook.canonical_name());
|
||||||
if let Some(path) = collect_legacy_root_hook_candidates(
|
collect_legacy_root_hook_candidates(
|
||||||
spec_dir,
|
spec_dir,
|
||||||
&lib32_label,
|
&lib32_label,
|
||||||
hook.legacy_root_lib32_candidate_names(),
|
hook.legacy_root_lib32_candidate_names(),
|
||||||
)? {
|
)?
|
||||||
Some(path)
|
|
||||||
} else {
|
|
||||||
collect_legacy_root_hook_candidates(
|
|
||||||
spec_dir,
|
|
||||||
hook.canonical_name(),
|
|
||||||
hook.legacy_root_candidate_names(),
|
|
||||||
)?
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
collect_legacy_root_hook_candidates(
|
collect_legacy_root_hook_candidates(
|
||||||
spec_dir,
|
spec_dir,
|
||||||
@@ -1350,20 +1338,40 @@ mod tests {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn stage_scripts_from_spec_dir_lib32_falls_back_to_generic_legacy_root_hook() {
|
fn stage_scripts_from_spec_dir_lib32_ignores_generic_legacy_root_hook() {
|
||||||
let tmp = tempfile::tempdir().unwrap();
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
let spec_dir = tmp.path().join("spec");
|
let spec_dir = tmp.path().join("spec");
|
||||||
let destdir = tmp.path().join("dest");
|
let destdir = tmp.path().join("dest");
|
||||||
std::fs::create_dir_all(&spec_dir).unwrap();
|
std::fs::create_dir_all(&spec_dir).unwrap();
|
||||||
std::fs::create_dir_all(&destdir).unwrap();
|
std::fs::create_dir_all(&destdir).unwrap();
|
||||||
|
|
||||||
// No lib32-prefixed hook; the generic one should be staged for lib32 packages.
|
// No lib32-prefixed hook; native-only scripts must NOT be staged for lib32 packages.
|
||||||
std::fs::write(spec_dir.join("postinstall.sh"), "echo fallback").unwrap();
|
std::fs::write(spec_dir.join("postinstall.sh"), "echo fallback").unwrap();
|
||||||
|
|
||||||
let mut spec = mk_spec(&spec_dir);
|
let mut spec = mk_spec(&spec_dir);
|
||||||
spec.package.name = "lib32-foo".into();
|
spec.package.name = "lib32-foo".into();
|
||||||
let staged = stage_scripts_from_spec_dir(&spec, &destdir).unwrap();
|
let staged = stage_scripts_from_spec_dir(&spec, &destdir).unwrap();
|
||||||
assert!(staged);
|
assert!(!staged);
|
||||||
assert!(destdir.join("scripts/post_install").exists());
|
assert!(!destdir.join("scripts/post_install").exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn run_hook_if_present_lib32_ignores_generic_script() {
|
||||||
|
let tmp = tempfile::tempdir().unwrap();
|
||||||
|
let scripts = tmp.path().join("scripts");
|
||||||
|
let rootfs = tmp.path().join("root");
|
||||||
|
std::fs::create_dir_all(&scripts).unwrap();
|
||||||
|
std::fs::create_dir_all(&rootfs).unwrap();
|
||||||
|
|
||||||
|
// Only a generic script exists; lib32 package must NOT execute it.
|
||||||
|
std::fs::write(
|
||||||
|
scripts.join("post_install"),
|
||||||
|
"echo generic > \"$DEPOT_ROOTFS/hook.out\"\n",
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let ran = run_hook_if_present(&scripts, Hook::PostInstall, &rootfs, "lib32-foo").unwrap();
|
||||||
|
assert!(!ran);
|
||||||
|
assert!(!rootfs.join("hook.out").exists());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user