aboutsummaryrefslogtreecommitdiff
path: root/src/pkg_install.c
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-07-17 01:50:49 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-07-17 01:50:49 +0000
commit76ee567986a12c22e6a606d74e31425facf9f5f4 (patch)
tree00ace954ed8ffb89fb780b0dfeb22a31a01d0244 /src/pkg_install.c
parent7019724ab5c818e18fb5ee61b6b14487c47da3ec (diff)
can install/remove packages, doesn't segfault (?)
Diffstat (limited to 'src/pkg_install.c')
-rw-r--r--src/pkg_install.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/pkg_install.c b/src/pkg_install.c
index b727d01..6a8f774 100644
--- a/src/pkg_install.c
+++ b/src/pkg_install.c
@@ -36,13 +36,13 @@ void install_dependencies(lua_State *L) {
const char *depname = lua_tostring(L, -2);
if (depname && lua_istable(L, -1)) {
lua_getfield(L, -1, "url");
- str_slc dep_url = mstrslc(lua_tostring(L, -1));
+ str dep_url = mstr(lua_tostring(L, -1));
lua_pop(L, 1);
+ package_t pkg = pkg_create(&dep_url);
+ str_free(&dep_url);
lua_getfield(L, -1, "version");
- str_slc dep_version = mstrslc(lua_tostring(L, -1));
+ pkg.version = mstr(lua_tostring(L, -1));
lua_pop(L, 1);
- package_t pkg = pkg_create(dep_url);
- pkg.version = str_from_str_slc(dep_version);
const int top = lua_gettop(L);
char cwd[MAX_PATH_LEN];
if (getcwd(cwd, sizeof(cwd)) != NULL) {
@@ -157,21 +157,33 @@ void pkg_install(package_t *pkg) {
//} else {
log_pkgit("fetching " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
if (!fetch(pkg)) return;
- log_pkgit("fetched " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
+ if (flags.verbose) log_pkgit("fetched " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
//}
log_pkgit("building " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
if (!build(pkg)) return;
- log_pkgit("built " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
+ if (flags.verbose) log_pkgit("built " GREEN "%.*s" COLOR_RESET , str_fmt(&pkg->name));
bool install_success = false;
- log_info("attempting init.lua: 'repositories.%.*s.install'", str_fmt(&pkg->name));
+ if (flags.verbose)
+ log_info(
+ "attempting init.lua: 'repositories.%.*s.install'",
+ str_fmt(&pkg->name)
+ );
if (!install_success && repo_install(pkg))
install_success = true;
- log_info("attempting bldit.lua: 'repositories.%.*s.install'", str_fmt(&pkg->name));
+ if (flags.verbose)
+ log_info(
+ "attempting bldit.lua: 'repositories.%.*s.install'",
+ str_fmt(&pkg->name)
+ );
if (!install_success && bldit_install(pkg))
install_success = true;
- log_info("attempting init.lua: 'build_systems'", str_fmt(&pkg->name));
+ if (flags.verbose)
+ log_info(
+ "attempting init.lua: 'build_systems'",
+ str_fmt(&pkg->name)
+ );
if (!install_success && config_install(pkg))
install_success = true;
if (!install_success) {