Simplify pkg5_import.rs by removing redundant directory creation logic; delegate to Transaction.commit() for handling.

This commit is contained in:
Till Wegmueller 2025-07-27 12:19:38 +02:00
parent ea5eddbc6a
commit d00de23d52
No known key found for this signature in database
2 changed files with 24 additions and 0 deletions

View file

@ -482,6 +482,12 @@ impl Transaction {
let pkg_manifest_path = publisher_dir.join(format!("{}.manifest", package_name));
debug!("Manifest path: {}", pkg_manifest_path.display());
// Create parent directories if they don't exist
if let Some(parent) = pkg_manifest_path.parent() {
debug!("Creating parent directories: {}", parent.display());
fs::create_dir_all(parent)?;
}
// Copy to pkg directory
debug!("Copying manifest from {} to {}", manifest_path.display(), pkg_manifest_path.display());
fs::copy(&manifest_path, &pkg_manifest_path)?;

18
run_local_import_test.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -ex
export RUST_LOG=debug
PKG6REPO_PATH="sample_data/pkg6-repo"
PKG5REPO_PATH="sample_data/sample-repo.p5p"
PKG6REPO_BIN="./target/debug/pkg6repo"
if [ -d "$PKG6REPO_PATH" ]; then
rm -rf $PKG6REPO_PATH
fi
cargo build
$PKG6REPO_BIN create $PKG6REPO_PATH
$PKG6REPO_BIN add-publisher -s $PKG6REPO_PATH openindiana.org
$PKG6REPO_BIN import-pkg5 -s $PKG5REPO_PATH -d $PKG6REPO_PATH