aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-08-14 07:37:03 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-08-14 07:37:03 +0000
commit536b651f4086fe01d0bd1f743f54ef650524b122 (patch)
treeb63a9554ac3ca0d94dc2e9f7da583ad6ca0b358c /include
parent4fa342bcfdb5ebcbe65cabe1fb9ac3a46ea4ddca (diff)
i made the install work (kinda)
Diffstat (limited to 'include')
-rw-r--r--include/files.h29
-rw-r--r--include/lua_state.h19
-rw-r--r--include/pkg.h14
3 files changed, 58 insertions, 4 deletions
diff --git a/include/files.h b/include/files.h
new file mode 100644
index 0000000..24712e9
--- /dev/null
+++ b/include/files.h
@@ -0,0 +1,29 @@
+/*
+
+ pkgit - package it!
+
+ Copyright (C) 2026 dacctal
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+*/
+
+#ifndef PKGIT_FILES_H
+#define PKGIT_FILES_H
+
+#include <stdbool.h>
+
+bool file_exists(const char *path);
+bool is_directory(const char *path);
+
+#endif
diff --git a/include/lua_state.h b/include/lua_state.h
index db689fe..6c36f37 100644
--- a/include/lua_state.h
+++ b/include/lua_state.h
@@ -18,18 +18,31 @@ void free_lua_config(void);
do { \
lua_getfield(L, -1, name); \
if (!lua_is##type(L, -1)) { \
- log_error("lua: expected type '" #type "' for %s in %.*s", \
+ log_error("lua: expected type '" #type "' for '%s' in '%.*s'", \
name, str_fmt(file)); \
lua_pop(L, pop_num); \
return false; \
} \
} while (0)
+#define lua_get_table(name, file, pop_num) \
+ do { \
+ lua_pushstring(L, name); \
+ lua_gettable(L, -2); \
+ lua_pop(L, 1); \
+ if (!lua_istable(L, -1)) { \
+ log_error("lua: expected type 'table' for '%s' in '%.*s'", \
+ name, str_fmt(file)); \
+ /*lua_pop(L, pop_num);*/ \
+ return false; \
+ } \
+ } while (0)
+
#define lua_run_function(name, file, params, returns, pop_num) \
do { \
- if (lua_pcall(L, params, returns, 0) { \
+ if (lua_pcall(L, params, returns, 0)) { \
log_error("lua: '%s' function borked in %.*s: %s", \
- name, str_fmt(file)), lua_tostring(L, -1); \
+ name, str_fmt(file), lua_tostring(L, -1)); \
lua_pop(L, pop_num); \
return false; \
} \
diff --git a/include/pkg.h b/include/pkg.h
index 15990ab..af720d5 100644
--- a/include/pkg.h
+++ b/include/pkg.h
@@ -9,6 +9,9 @@ typedef struct package_t {
bool is_local;
} package_t;
+package_t pkg_create(str *arg);
+
+bool pkg_exists(str *name);
bool pkg_hook_url(package_t *pkg);
str pkg_get_url(package_t *pkg);
bool pkg_hook_setup(package_t *pkg);
@@ -17,6 +20,15 @@ bool pkg_hook_install(package_t *pkg);
bool pkg_hook_remove(package_t *pkg);
bool pkg_hook_on_update(package_t *pkg);
bool pkg_hook_fetch_sources(package_t *pkg);
-str pkg_hook_fetch_latest_version(package_t *pkg);
+bool pkg_hook_fetch_latest_version(package_t *pkg);
+str pkg_get_latest_version(package_t *pkg);
+
+bool pkg_setup(package_t *pkg);
+bool pkg_build(package_t *pkg);
+bool pkg_install(package_t *pkg);
+bool pkg_remove(package_t *pkg);
+bool pkg_update(package_t *pkg);
+
+void pkg_free(package_t *pkg);
#endif