update hooks functions

This commit is contained in:
2026-09-10 23:05:56 +03:00
parent 055ebb7703
commit d2c2daf352
9 changed files with 86 additions and 17 deletions

View File

@ -5,7 +5,8 @@ use std::io::{self, Write};
use std::cell::RefCell;
use super::get_aeropkg_base;
use crate::utils::parser::{self, env::get_install_env, pkginfo, repoinfo};
use crate::utils::parser::{self, env::get_install_env, repoinfo, pkginfo, env::get_custom_env};
use crate::utils::shell;
use crate::commands::link::link;
use crate::commands::run::config::config;
@ -58,11 +59,15 @@ pub fn download_packages(
) {
for pkgname in packages {
let effective_repo = match repo {
Some(r) => r.to_string(),
None => pkginfo::get_priority_repo(pkgname),
Some(r) => &r.to_string(),
None => &pkginfo::get_priority_repo(pkgname),
};
download(&effective_repo, pkgname, force, recursive);
download(effective_repo, pkgname, force, recursive);
let pkg_md_path = &crate::commands::get_aeropkg_var().join(format!("{}/{}.md", effective_repo, pkgname));
let full_env = &get_custom_env(effective_repo, pkgname, pkg_md_path);
shell::run_install_repo_hook_script(effective_repo, full_env);
shell::run_install_hook_script(full_env);
}
}

View File

@ -2,7 +2,8 @@ use std::path::Path;
use std::fs;
use std::os::unix::fs::MetadataExt;
use crate::utils::parser::{self, pkginfo};
use crate::utils::parser::{self, pkginfo, env::get_custom_env};
use crate::utils::shell;
use super::run::download::download;
use super::run::patch::patch;
use super::run::build::build;
@ -22,6 +23,9 @@ pub fn install(repo: &String, pkgname: &String) {
patch(repo, pkgname);
build(repo, pkgname);
config(repo, pkgname);
let full_env = &get_custom_env(repo, pkgname, pkg_md_path);
shell::run_install_repo_hook_script(repo, full_env);
shell::run_install_hook_script(full_env);
}
fn check_build_dependency(repo: &String, pkg_md_path: &Path) {

View File

@ -1,7 +1,7 @@
use std::fs;
use crate::commands::link::link;
use crate::utils::parser::{self, env::get_install_env};
use crate::utils::shell::{run_install_script, run_install_script_hook};
use crate::utils::shell::self;
use super::{download, patch};
pub fn build(repo: &String, pkgname: &String) {
@ -38,8 +38,9 @@ pub fn build(repo: &String, pkgname: &String) {
save_env(&applied_env, &full_env);
run_install_script(&build_script, &src_dir, &full_env);
run_install_script_hook(repo, "build", &full_env);
shell::run_install_script(&build_script, &src_dir, &full_env);
shell::run_install_repo_stage_hook_script(repo, "build", &full_env);
shell::run_install_stage_hook_script("download", &full_env);
fs::create_dir_all(&pkg_dir).ok();
fs::write(&applied_build, &build_script).unwrap();

View File

@ -1,6 +1,6 @@
use crate::commands::link::link;
use crate::utils::parser::{self, env::get_install_env};
use crate::utils::shell::{run_install_script,run_install_script_hook};
use crate::utils::shell;
pub fn config(repo: &String, pkgname: &String) {
@ -13,8 +13,10 @@ pub fn config(repo: &String, pkgname: &String) {
};
let full_env = get_install_env(repo, pkgname, pkg_md_path, "config");
run_install_script(&config_script, pkg_dir, &full_env);
run_install_script_hook(repo, "config", &full_env);
shell::run_install_script(&config_script, pkg_dir, &full_env);
shell::run_install_repo_stage_hook_script(repo, "config", &full_env);
shell::run_install_stage_hook_script("download", &full_env);
if !crate::commands::get_aeropkg_base().join(repo).join(pkgname).join("disabled").exists() {
link(repo, pkgname)

View File

@ -3,7 +3,7 @@ use std::path::Path;
use std::process::{Command, Stdio};
use crate::utils::parser::{self, env::get_install_env};
use crate::utils::shell::run_install_script_hook;
use crate::utils::shell;
pub fn download(repo: &String, pkgname: &String) {
let pkg_md_path = &crate::commands::get_aeropkg_var().join(format!("{}/{}.md", repo, pkgname));
@ -156,7 +156,8 @@ pub fn download(repo: &String, pkgname: &String) {
fs::write(src.join(".aeropkg.download-url"), &url).unwrap();
run_install_script_hook(repo, "download", &full_env)
shell::run_install_repo_stage_hook_script(repo, "download", &full_env);
shell::run_install_stage_hook_script("download", &full_env);
}
fn upload_from_repo(repo: &String, pkgname: &String, pkg_md_path: &Path) {

View File

@ -1,7 +1,7 @@
use std::fs;
use crate::utils::parser::{self, env::get_install_env};
use crate::utils::shell::{run_install_script,run_install_script_hook};
use crate::utils::shell;
use super::download::download;
pub fn patch(repo: &String, pkgname: &String) {
@ -21,7 +21,9 @@ pub fn patch(repo: &String, pkgname: &String) {
}
let full_env = get_install_env(repo, pkgname, pkg_md_path, "patch");
run_install_script(patch_script, src, &full_env);
run_install_script_hook(repo, "patch", &full_env);
shell::run_install_script(patch_script, src, &full_env);
shell::run_install_repo_stage_hook_script(repo, "patch", &full_env);
shell::run_install_stage_hook_script("download", &full_env);
fs::write(src.join(".aeropkg.applied-patch"), &patch_script).unwrap()
}