src/libpakfire/arch.c \
src/libpakfire/archive.c \
src/libpakfire/build.c \
+ src/libpakfire/buildservice.c \
src/libpakfire/cgroup.c \
src/libpakfire/compress.c \
src/libpakfire/config.c \
src/libpakfire/include/pakfire/arch.h \
src/libpakfire/include/pakfire/archive.h \
src/libpakfire/include/pakfire/build.h \
+ src/libpakfire/include/pakfire/buildservice.h \
src/libpakfire/include/pakfire/cgroup.h \
src/libpakfire/include/pakfire/compress.h \
src/libpakfire/include/pakfire/config.h \
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2021 Pakfire development team #
+# #
+# 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 3 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 <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#include <errno.h>
+#include <stdlib.h>
+
+#include <pakfire/buildservice.h>
+#include <pakfire/ctx.h>
+#include <pakfire/private.h>
+
+struct pakfire_buildservice {
+ struct pakfire_ctx* ctx;
+ int nrefs;
+};
+
+static void pakfire_buildservice_free(struct pakfire_buildservice* service) {
+ if (service->ctx)
+ pakfire_ctx_unref(service->ctx);
+
+ free(service);
+}
+
+PAKFIRE_EXPORT int pakfire_buildservice_create(
+ struct pakfire_buildservice** service, struct pakfire_ctx* ctx) {
+ struct pakfire_buildservice* s = NULL;
+
+ // Allocate some memory
+ s = calloc(1, sizeof(*s));
+ if (!s)
+ return -errno;
+
+ // Store a reference to the context
+ s->ctx = pakfire_ctx_ref(ctx);
+
+ // Initialize the reference counter
+ s->nrefs = 1;
+
+ // Return the pointer
+ *service = s;
+
+ return 0;
+}
+
+PAKFIRE_EXPORT struct pakfire_buildservice* pakfire_buildservice_ref(
+ struct pakfire_buildservice* service) {
+ ++service->nrefs;
+
+ return service;
+}
+
+PAKFIRE_EXPORT struct pakfire_buildservice* pakfire_buildservice_unref(
+ struct pakfire_buildservice* service) {
+ if (--service->nrefs > 0)
+ return service;
+
+ pakfire_buildservice_free(service);
+ return NULL;
+}
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2023 Pakfire development team #
+# #
+# 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 3 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 <http://www.gnu.org/licenses/>. #
+# #
+#############################################################################*/
+
+#ifndef PAKFIRE_BUILDSERVICE_H
+#define PAKFIRE_BUILDSERVICE_H
+
+struct pakfire_buildservice;
+
+#include <pakfire/ctx.h>
+
+int pakfire_buildservice_create(struct pakfire_buildservice** service, struct pakfire_ctx* ctx);
+
+struct pakfire_buildservice* pakfire_buildservice_ref(struct pakfire_buildservice* service);
+struct pakfire_buildservice* pakfire_buildservice_unref(struct pakfire_buildservice* service);
+
+#endif /* PAKFIRE_BUILDSERVICE_H */
pakfire_build_unref;
pakfire_shell;
+ # buildservice
+ pakfire_buildservice_create;
+ pakfire_buildservice_ref;
+ pakfire_buildservice_unref;
+
# dependencies
pakfire_static_version_compare;