Simplify Depot staging and preserve filesystem topology

Remove the old LBI bootstrap/system-state path and make Depot stage and
install packages against standard FHS paths instead of rewriting payloads into
the custom /system layout. This drops the bootstrap command surface,
system-state storage, /system path normalization, and bootstrap chroot helper
while moving rootfs state defaults back under /var and aliases under /usr/bin.

Preserve hardlink topology throughout the package lifecycle. Add shared fs_copy
helpers for symlink/hardlink-aware tree copies, use them for source preparation,
binary packages, Rust installs, and lib32 staging, and keep hardlinks intact
during stripping, atomic installation, and package archive creation.

Replace the external fakeroot wrapper with an internal user-namespace based
install command wrapper. Install phases now run as UID/GID 0 inside a private
namespace while mapping ownership back to the invoking user on the host.

Split the package spec parser into loading, model, config, and tests modules
without changing the public PackageSpec surface. Keep strict unknown-key
handling, manual source validation, config/appends support, lib32 overrides,
and generated output helpers in the new layout.

Tighten build and dependency behavior:
- emit explicit shared-library selectors when static builds are disabled
- apply configure_arch entries for the effective target/lib32 architecture
- add CMake sysroot defaults for non-live DEPOT_ROOTFS builds
- resolve Rust source_subdir before build hooks and binary installation
- satisfy dependencies and local sibling plans through package real_name aliases
- accept bare git:// source URLs as HEAD checkouts

Update tests around FHS path expectations, namespace fakeroot installs,
hardlink-preserving copies/archives/installs/stripping, real_name dependency
resolution, configure_arch expansion, CMake sysroot defaults, Rust source
subdirs, and git:// URL parsing.

Bump suppaftp to 8.0.4 and lzma-rust2 to 0.16.4.

Bump Depot to 0.50.0
This commit is contained in:
2026-06-09 06:14:15 -05:00
parent 5c33a36100
commit 9a544c60b0
38 changed files with 6561 additions and 13656 deletions
+29 -47
View File
@@ -66,13 +66,13 @@ pub fn build(
}
if !state.is_done(BuildStep::PostInstallDone) {
// Run install commands with fakeroot
// Run install commands with internal fakeroot
crate::log_info!(
"Running makefile install commands{}...",
if crate::fakeroot::is_root() {
""
} else {
" (with fakeroot)"
" (with internal fakeroot)"
}
);
@@ -99,7 +99,7 @@ pub fn build(
let cmd_str = spec.expand_vars(cmd_str);
crate::log_info!(" Executing: {}", cmd_str);
// We need to run each command under fakeroot
// We need to run each command under internal fakeroot
let mut cmd = crate::fakeroot::wrap_install_command("sh", &install_destdir);
cmd.arg("-c").arg(&cmd_str);
cmd.current_dir(src_dir);
@@ -136,21 +136,10 @@ pub fn build(
mod tests {
use super::*;
use crate::package::{Build, BuildFlags, BuildType, Dependencies, PackageInfo};
use crate::test_support::TestEnv;
use std::fs;
use std::os::unix::fs::MetadataExt;
use tempfile::tempdir;
#[cfg(unix)]
fn write_executable(path: &std::path::Path, contents: &str) -> Result<()> {
use std::os::unix::fs::PermissionsExt;
fs::write(path, contents)?;
let mut perms = fs::metadata(path)?.permissions();
perms.set_mode(0o755);
fs::set_permissions(path, perms)?;
Ok(())
}
fn mk_spec(name: &str, version: &str) -> PackageSpec {
PackageSpec {
package: PackageInfo {
@@ -189,24 +178,8 @@ mod tests {
fn test_makefile_build_runs_commands() -> Result<()> {
let tmp_src = tempdir()?;
let tmp_dest = tempdir()?;
let tmp_tools = tempdir()?;
let src_path = tmp_src.path();
let dest_path = tmp_dest.path();
let tools_path = tmp_tools.path();
write_executable(
&tools_path.join("fakeroot"),
r#"#!/bin/sh
if [ "$1" = "--" ]; then
shift
fi
exec "$@"
"#,
)?;
let mut env = TestEnv::new();
let old_path = std::env::var("PATH").unwrap_or_default();
env.set_var("PATH", format!("{}:{}", tools_path.display(), old_path));
let mut spec = mk_spec("test-make", "1.0");
spec.build.flags.makefile_commands = vec![
@@ -241,28 +214,37 @@ exec "$@"
Ok(())
}
#[test]
fn test_makefile_install_preserves_staged_hardlinks() -> Result<()> {
let tmp_src = tempdir()?;
let tmp_dest = tempdir()?;
let src_path = tmp_src.path();
let dest_path = tmp_dest.path();
let mut spec = mk_spec("uutils-like", "1.0");
spec.build.flags.makefile_install_commands = vec![
"mkdir -p \"$DESTDIR/usr/bin\"".into(),
"printf 'multicall' > \"$DESTDIR/usr/bin/uutils\"".into(),
"ln \"$DESTDIR/usr/bin/uutils\" \"$DESTDIR/usr/bin/ls\"".into(),
];
build(&spec, src_path, dest_path, None, true, None)?;
let uutils = dest_path.join("usr/bin/uutils").metadata()?;
let ls = dest_path.join("usr/bin/ls").metadata()?;
assert_eq!(uutils.ino(), ls.ino());
assert_eq!(uutils.nlink(), 2);
assert_eq!(ls.nlink(), 2);
Ok(())
}
#[test]
fn test_makefile_lib32_install_relocates_usr_lib_without_copying_other_paths() -> Result<()> {
let tmp_src = tempdir()?;
let tmp_dest = tempdir()?;
let tmp_tools = tempdir()?;
let src_path = tmp_src.path();
let dest_path = tmp_dest.path();
let tools_path = tmp_tools.path();
write_executable(
&tools_path.join("fakeroot"),
r#"#!/bin/sh
if [ "$1" = "--" ]; then
shift
fi
exec "$@"
"#,
)?;
let mut env = TestEnv::new();
let old_path = std::env::var("PATH").unwrap_or_default();
env.set_var("PATH", format!("{}:{}", tools_path.display(), old_path));
let mut spec = mk_spec("lib32-test-make", "1.0");
spec.build.flags.lib32_variant = true;