From b8512ce0730e1575f4329e3b78a1540e5228d4f0 Mon Sep 17 00:00:00 2001 From: dacctal Date: Mon, 22 Jun 2026 18:42:08 +0000 Subject: i fixed the rest of the install functions --- README.md | 8 ++++---- bldit.lua | 4 ++-- config/init.lua | 2 +- src/lua_state.c | 39 ++++++++++++++++++++++++++++++++++----- 4 files changed, 41 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 1d3a2ab..7a9765f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@
-

pkgit

(package it!) -
# What is this? @@ -131,7 +129,9 @@ pkgit --install [url.git] This also works with the target and version syntax. ### Local install -If you want to install a package from a local code repository, and want to take advantage of pkgit's build system autodetection, you can enter that repository's root directory and install it from there: +If you want to install a package from a local code repository, +and want to take advantage of pkgit's build system autodetection, +you can enter that repository's root directory and install it from there: ``` pkgit --install . ``` @@ -142,7 +142,7 @@ You can also use pkgit as a sort of meta-build-system to automatically compile a ``` pkgit --build [/path/to/project] ``` -This can also be done without specifying the path (`pkgit build`) if you're in the project's root directory +This can also be done without specifying the path (`pkgit --build`) if you're in the project's root directory ## Removing Packages Removing (uninstalling) a package is as simple as it seems: diff --git a/bldit.lua b/bldit.lua index d2b503b..6efe80f 100644 --- a/bldit.lua +++ b/bldit.lua @@ -1,5 +1,5 @@ -bldit_version = "0.1.3" -package_version = "0.1.3" +bldit_version = "1.0.0" +package_version = "1.0.0" global_dependencies = { luajit = { diff --git a/config/init.lua b/config/init.lua index ee885aa..0557a89 100644 --- a/config/init.lua +++ b/config/init.lua @@ -148,7 +148,7 @@ build_systems = { in `repositories.`, `bldit.lua`, and right here in `build_systems`. - this template comes with two templates; + this table comes with two templates; `default` and `quiet`. the first is pretty self-explanatory; this is what you'd define as the default intended behavior of the diff --git a/src/lua_state.c b/src/lua_state.c index fcaf90c..435d602 100644 --- a/src/lua_state.c +++ b/src/lua_state.c @@ -205,11 +205,18 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target) "%s %s: 'targets.%s.pre_install' is not a function.\n", print_warning, lua_file, target ); - } else if (lua_pcall(L, 0, 0, 0) != LUA_OK) { + } else if (lua_pcall(L, 0, 1, 0) != LUA_OK) { if (is_verbose) printf( - "%s %s: 'targets.%s.pre_install' failed: %s\n", + "%s %s: 'targets.%s.pre_install' function borked: %s\n", print_warning, lua_file, target, lua_tostring(L, -1) ); + if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) { + printf( + "%s %s: 'targets.%s.pre_install' failed: %s\n", + print_error, lua_file, target, lua_tostring(L, -1) + ); + return false; + } } lua_pop(L, 1); lua_getfield(L, -1, "install"); @@ -223,12 +230,20 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target) } if (lua_pcall(L, 0, 0, 0) != LUA_OK) { if (is_verbose) printf( - "%s %s: 'targets.%s.install' failed: %s\n", + "%s %s: 'targets.%s.install' function borked: %s\n", print_warning, lua_file, target, lua_tostring(L, -1) ); lua_pop(L, 1); return false; } + if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) { + printf( + "%s %s: 'targets.%s.install' failed: %s\n", + print_error, lua_file, target, lua_tostring(L, -1) + ); + lua_pop(L, 1); + return false; + } lua_pop(L, 1); lua_getfield(L, -1, "post_install"); if (!lua_isfunction(L, -1)) { @@ -238,9 +253,15 @@ bool target_loop_install(lua_State *L, const char* lua_file, const char *target) ); } else if (lua_pcall(L, 0, 0, 0) != LUA_OK) { if (is_verbose) printf( - "%s %s: 'targets.%s.post_install' failed: %s\n", + "%s %s: 'targets.%s.post_install' function borked: %s\n", print_warning, lua_file, target, lua_tostring(L, -1) ); + if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) { + printf( + "%s %s: 'targets.%s.post_install' failed: %s\n", + print_error, lua_file, target, lua_tostring(L, -1) + ); + } } lua_pop(L, 1); return true; @@ -267,12 +288,20 @@ bool target_loop_uninstall(lua_State *L, const char *lua_file, const char *targe } if (lua_pcall(L, 0, 0, 0) != LUA_OK) { if (is_verbose) printf( - "%s %s: 'targets.%s.uninstall' failed: %s\n", + "%s %s: 'targets.%s.uninstall' function borked: %s\n", print_warning, lua_file, target, lua_tostring(L, -1) ); lua_pop(L, 1); return false; } + if (!lua_isnumber(L, -1) || lua_tonumber(L, -1) != 0) if (is_verbose) { + printf( + "%s %s: 'targets.%s.uninstall' failed: %s\n", + print_error, lua_file, target, lua_tostring(L, -1) + ); + lua_pop(L, 1); + return false; + } lua_pop(L, 1); return true; } -- cgit v1.2.3