aboutsummaryrefslogtreecommitdiff
path: root/src/hooks.c
diff options
context:
space:
mode:
authordacctal <donotcontactmevia@email.invalid>2026-08-09 07:30:59 +0000
committerdacctal <donotcontactmevia@email.invalid>2026-08-09 07:30:59 +0000
commit4fa342bcfdb5ebcbe65cabe1fb9ac3a46ea4ddca (patch)
treee7398fc7b26e9bd225f2c10ed0557baa771fca78 /src/hooks.c
parente2cda84ebbd073ece54692c6a3d785afc6148268 (diff)
checkpoint (it doesn't compile)
Diffstat (limited to 'src/hooks.c')
-rw-r--r--src/hooks.c87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/hooks.c b/src/hooks.c
new file mode 100644
index 0000000..f47d928
--- /dev/null
+++ b/src/hooks.c
@@ -0,0 +1,87 @@
+/*
+
+ 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/>.
+
+*/
+
+#include <stdio.h>
+#include <string.h>
+
+#include "common.h"
+#include "log.h"
+#include "lua_state.h"
+#include "pkg.h"
+#include "str.h"
+#include "state.h"
+
+bool pkg_exists(str *name) {
+ lua_get_field_type("pkgs", table, &config.init_path, 1);
+ lua_get_field_type(name->data, table, &config.init_path, 2);
+ return true;
+}
+
+bool pkg_hook_url(package_t *pkg) {
+ lua_get_field_type("pkgs", table, &config.init_path, 1);
+ lua_get_field_type(pkg->name.data, table, &config.init_path, 2);
+ lua_get_field_type("url", string, &config.init_path, 3);
+ return true;
+}
+
+str pkg_get_url(package_t *pkg) {
+ str url = str_new();
+ if (!pkg_hook_url(pkg)) return url;
+ url = mstr(lua_tostring(L, -1));
+ return url;
+}
+
+bool pkg_hook_fetch_sources(package_t *pkg) {
+ return true;
+}
+
+str pkg_hook_fetch_latest_version(package_t *pkg) {
+ str version = {0};
+ return version;
+}
+
+bool pkg_hook_recipe(char *recipe, package_t *pkg) {
+ lua_get_field_type("pkgs", table, &config.init_path, 1);
+ lua_get_field_type(pkg->name.data, table, &config.init_path, 2);
+ lua_get_field_type("recipe", table, &config.init_path, 3);
+ lua_get_field_type(recipe, function, &config.init_path, 4);
+ return true;
+}
+
+bool pkg_hook_setup(package_t *pkg) {
+ pkg_hook_recipe("setup", pkg);
+ return true;
+}
+
+bool pkg_hook_build(package_t *pkg) {
+ return true;
+}
+
+bool pkg_hook_install(package_t *pkg) {
+ return true;
+}
+
+bool pkg_hook_remove(package_t *pkg) {
+ return true;
+}
+
+bool pkg_hook_on_update(package_t *pkg) {
+ return true;
+}