diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-12-07 14:29:35 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-12-07 14:29:35 +0300 |
| commit | 778a979e2e774e1b2e91227fa2db2e56d41927c1 (patch) | |
| tree | ae1560e203477a90edc089c1832e37af83f43540 /src/pkgtoolkit/build.rs | |
| parent | e7c49d685efe768c0c1d9c66da7b93b6e118b305 (diff) | |
Fixed logical issues
Diffstat (limited to 'src/pkgtoolkit/build.rs')
| -rw-r--r-- | src/pkgtoolkit/build.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/pkgtoolkit/build.rs b/src/pkgtoolkit/build.rs index a323521..6264b58 100644 --- a/src/pkgtoolkit/build.rs +++ b/src/pkgtoolkit/build.rs @@ -26,7 +26,6 @@ impl BuildOperations for Package { let config = Config::parse().map_err(|e| std::io::Error::other(e.to_string()))?; let build_dir = Path::new(&config.paths.cache_dir).join(format!("{}-{}", self.name, self.version)); - // Check if build directory exists if !build_dir.exists() { return Err(std::io::Error::other(format!( "Build directory not found: {}", @@ -34,7 +33,6 @@ impl BuildOperations for Package { ))); } - // Prepare environment variables let mut cmd_envs: Vec<(String, String)> = Vec::new(); if let Some(ref env_vars) = build_meta.env { for env_line in env_vars.lines() { @@ -44,12 +42,10 @@ impl BuildOperations for Package { } } - // Handle custom build script if provided if let Some(ref script) = build_meta.script { log::info!("Executing custom build script: {}", script); Self::validate_custom_script(script)?; - let mut cmd = if script.starts_with("./") || script.contains('/') { - // Assume it's a file path + let mut cmd = if script.starts_with("./") || script.starts_with('/') { let script_path = build_dir.join(script); if !script_path.exists() { return Err(std::io::Error::other(format!( @@ -62,7 +58,6 @@ impl BuildOperations for Package { inner_cmd.arg(script_path.to_str().unwrap()); inner_cmd } else { - // Inline script let mut inner_cmd = Command::new("/bin/sh"); inner_cmd.arg("-c"); inner_cmd.arg(script); @@ -121,7 +116,7 @@ impl BuildOperations for Package { } } BuildSystems::CMake => { - // Check for CMakeLists.txt + let cmake_file = build_dir.join("CMakeLists.txt"); if !cmake_file.exists() { return Err(std::io::Error::other(format!( @@ -153,7 +148,6 @@ impl BuildOperations for Package { ))); } - // Now build let mut build_cmd = Command::new("make"); build_cmd.current_dir(&build_dir_build); build_cmd.arg("-j").arg(num_cpus::get().to_string()); // Parallel build @@ -174,7 +168,6 @@ impl BuildOperations for Package { } } BuildSystems::Meson => { - // Check for meson.build let meson_file = build_dir.join("meson.build"); if !meson_file.exists() { return Err(std::io::Error::other(format!( |
