From ea6745dd7ad75c85d0ea4471e9f3357532fb0eb0 Mon Sep 17 00:00:00 2001 From: dacctal Date: Sun, 7 Jun 2026 05:58:15 +0000 Subject: tiny fixes & .editorconfig (thx indium) --- src/install_pkg.c | 98 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 46 deletions(-) (limited to 'src/install_pkg.c') diff --git a/src/install_pkg.c b/src/install_pkg.c index 4e3b3c6..8831499 100644 --- a/src/install_pkg.c +++ b/src/install_pkg.c @@ -3,63 +3,69 @@ #include #include -#include "install_pkg.h" #include "add_repo.h" -#include "fetch_src.h" #include "build.h" -//#include "copy_install.h" -//#include "link_install.h" +#include "fetch_src.h" +#include "install_pkg.h" +// #include "copy_install.h" +// #include "link_install.h" #include "lua_state.h" #include "name_from_url.h" #include "vars.h" void install_pkg(Pkg pkg) { - if (!pkg.is_local) { - printf("%sfetching %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - fetch_src(pkg); - if (is_verbose) printf("%sfetched %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - } + if (!pkg.is_local) { + printf("%sfetching %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + fetch_src(pkg); + if (is_verbose) + printf("%sfetched %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + } - printf("%sbuilding %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - build(pkg); - if (is_verbose) printf("%sbuilt %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + printf("%sbuilding %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + build(pkg); + if (is_verbose) + printf("%sbuilt %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - printf("%sinstalling %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - bool install_success = false; - if (!install_success && repo_install(pkg.url)) install_success = true; - if (!install_success && bldit_install(pkg.target)) install_success = true; - if (!install_success && config_install(pkg.src)) install_success = true; - if (!install_success) { - printf("%sno install function availible for package: %s\n", - print_error, pkg.name); - return; - } - //is_auto_installed = true; - //if (is_auto_installed) { - // if (is_symlink_install) { - // link_install(pkg.src); - // } else { - // copy_install(pkg.src); - // } - //} - printf("%sinstalled %s%s%s\n", print_success, green, pkg.name, color_reset); + printf("%sinstalling %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + bool install_success = false; + if (!install_success && repo_install(pkg.name)) + install_success = true; + if (!install_success && bldit_install(pkg.target)) + install_success = true; + if (!install_success && config_install(pkg.src)) + install_success = true; + if (!install_success) { + printf("%sno install function availible for package: %s\n", print_error, + pkg.name); + return; + } + // is_auto_installed = true; + // if (is_auto_installed) { + // if (is_symlink_install) { + // link_install(pkg.src); + // } else { + // copy_install(pkg.src); + // } + // } + printf("%sinstalled %s%s%s\n", print_success, green, pkg.name, color_reset); - bool repo_exists = false; - for (size_t i = 0; i < cached_repos_count; i++) { - char *repo_name = name_from_url(cached_repos[i].source_value); - if (strcmp(repo_name, pkg.name) == 0) { - repo_exists = true; - } - free(repo_name); + bool repo_exists = false; + for (size_t i = 0; i < cached_repos_count; i++) { + char *repo_name = name_from_url(cached_repos[i].source_value); + if (strcmp(repo_name, pkg.name) == 0) { + repo_exists = true; } + free(repo_name); + } - if (!repo_exists) { - printf("%sadding %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - if (pkg.url && strlen(pkg.url) > 0) { - add_repo(pkg.url, pkg.name); - } - printf("%sadded %s%s%s\n", print_pkgit, green, pkg.name, color_reset); - } else { - if (is_verbose) printf("%srepo already exists, done\n", print_pkgit); + if (!repo_exists) { + printf("%sadding %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + if (pkg.url && strlen(pkg.url) > 0) { + add_repo(pkg.url, pkg.name); } + printf("%sadded %s%s%s\n", print_pkgit, green, pkg.name, color_reset); + } else { + if (is_verbose) + printf("%srepo already exists, done\n", print_pkgit); + } } \ No newline at end of file -- cgit v1.2.3