upd and patches

This commit is contained in:
2026-07-22 04:29:56 +03:00
parent 2be695fa6a
commit c6dcbc1ca5
90 changed files with 1688 additions and 91 deletions

View File

@ -15,7 +15,6 @@ fn hardcopy(
) -> io::Result<()> {
let metadata = fs::symlink_metadata(source)?;
if metadata.file_type().is_file() {
match fs::hard_link(source, destination) {
Ok(_) => {}
@ -39,7 +38,7 @@ fn hardcopy(
let conflict_list = find_files_with_location(&destination);
let count = conflict_list.len();
if count == 1 {
if count <= 1 {
fs::remove_file(destination)?;
fs::hard_link(source, destination)?
} else if count >= 1 {
@ -75,7 +74,17 @@ fn hardcopy(
})?
} else if metadata.file_type().is_symlink() {
let symlink_value = fs::read_link(source)?;
if destination.exists() { fs::remove_file(destination)? }
if let Ok(dest_meta) = fs::symlink_metadata(destination) {
if dest_meta.is_symlink() {
if let Ok(dest_target) = fs::read_link(destination) {
if dest_target == symlink_value {
return Ok(());
}
}
}
fs::remove_file(destination).ok();
}
unix::fs::symlink(symlink_value, destination)?
}

View File

@ -8,8 +8,11 @@ use super::*;
pub fn get_install_env(repo: &String, pkgname: &String, pkg_md_path: &Path, stage: &str) -> HashMap<String, String> {
let mut full_env = HashMap::new();
let pkgpath = crate::commands::get_aeropkg_base().join(repo).join(pkgname);
full_env.insert("repo".to_string(), repo.clone());
full_env.insert("pkgname".to_string(), pkgname.clone());
full_env.insert("pkgpath".to_string(), pkgpath.to_string_lossy().into_owned());
if let Some(global_env) = get_global_env_string().ok() { full_env.extend(global_env) }
if let Some(pkg_env) = get_pkg_env(pkg_md_path).ok() { full_env.extend(pkg_env) }
if let Some(repo_env) = get_repo_env(repo).ok() { full_env.extend(repo_env) }
@ -21,8 +24,11 @@ pub fn get_install_env(repo: &String, pkgname: &String, pkg_md_path: &Path, stag
pub fn get_custom_env(repo: &String, pkgname: &String, pkg_md_path: &Path) -> HashMap<String, String> {
let mut full_env = HashMap::new();
let pkgpath = crate::commands::get_aeropkg_base().join(repo).join(pkgname);
full_env.insert("repo".to_string(), repo.clone());
full_env.insert("pkgname".to_string(), pkgname.clone());
full_env.insert("pkgpath".to_string(), pkgpath.to_string_lossy().into_owned());
if let Some(global_env) = get_global_env_string().ok() { full_env.extend(global_env) }
if let Some(pkg_env) = get_pkg_env(pkg_md_path).ok() { full_env.extend(pkg_env) }
if let Some(repo_env) = get_repo_env(repo).ok() { full_env.extend(repo_env) }
@ -34,6 +40,7 @@ pub fn get_global_env() -> HashMap<String, String> {
let mut full_env = HashMap::new();
full_env.insert("aeropkg_home".to_string(), crate::commands::get_aeropkg_home().to_string_lossy().into_owned().clone());
full_env.insert("aeropkg_base".to_string(), crate::commands::get_aeropkg_base().to_string_lossy().into_owned().clone());
full_env.insert("pkgbase".to_string(), crate::commands::get_aeropkg_base().to_string_lossy().into_owned().clone());
full_env.insert("aeropkg_etc".to_string(), crate::commands::get_aeropkg_etc().to_string_lossy().into_owned().clone());
full_env.insert("aeropkg_var".to_string(), crate::commands::get_aeropkg_var().to_string_lossy().into_owned().clone());
if let Some(global_env) = get_global_env_string().ok() { full_env.extend(global_env) }