src/libpakfire/snapshot.c \
src/libpakfire/solution.c \
src/libpakfire/string.c \
+ src/libpakfire/stripper.c \
src/libpakfire/transaction.c \
src/libpakfire/util.c \
src/libpakfire/xfer.c
src/libpakfire/include/pakfire/snapshot.h \
src/libpakfire/include/pakfire/solution.h \
src/libpakfire/include/pakfire/string.h \
+ src/libpakfire/include/pakfire/stripper.h \
src/libpakfire/include/pakfire/transaction.h \
src/libpakfire/include/pakfire/util.h \
src/libpakfire/include/pakfire/xfer.h
#include <pakfire/scriptlet.h>
#include <pakfire/solution.h>
#include <pakfire/string.h>
+#include <pakfire/stripper.h>
#include <pakfire/transaction.h>
#include <pakfire/util.h>
return 0;
}
+static int pakfire_build_strip(struct pakfire_build* build) {
+ struct pakfire_stripper* stripper = NULL;
+ int r;
+
+ // Create a new stripper
+ r = pakfire_stripper_create(&stripper, build->pakfire, build->buildroot);
+ if (r < 0)
+ goto ERROR;
+
+ // Strip!
+ r = pakfire_stripper_run(stripper);
+ if (r < 0)
+ goto ERROR;
+
+ERROR:
+ if (stripper)
+ pakfire_stripper_unref(stripper);
+
+ return r;
+}
+
static void pakfire_build_free(struct pakfire_build* build) {
if (build->packages)
pakfire_packagelist_unref(build->packages);
if (r)
goto ERROR;
+ // Run the stripper
+ r = pakfire_build_strip(build);
+ if (r < 0)
+ goto ERROR;
+
// Done!
return 0;
--- /dev/null
+/*#############################################################################
+# #
+# Pakfire - The IPFire package management system #
+# Copyright (C) 2024 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_STRIPPER_H
+#define PAKFIRE_STRIPPER_H
+
+#ifdef PAKFIRE_PRIVATE
+
+struct pakfire_stripper;
+
+int pakfire_stripper_create(struct pakfire_stripper** stripper,
+ struct pakfire* pakfire, const char* path);
+
+struct pakfire_stripper* pakfire_stripper_ref(struct pakfire_stripper* stripper);
+struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* stripper);
+
+int pakfire_stripper_run(struct pakfire_stripper* stripper);
+
+#endif /* PAKFIRE_PRIVATE */
+#endif /* PAKFIRE_STRIPPER_H */
--- /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/>. #
+# #
+#############################################################################*/
+
+#include <errno.h>
+#include <stdlib.h>
+
+#include <pakfire/pakfire.h>
+#include <pakfire/string.h>
+#include <pakfire/stripper.h>
+
+struct pakfire_stripper {
+ struct pakfire_ctx* ctx;
+ int nrefs;
+
+ // Pakfire
+ struct pakfire* pakfire;
+
+ // Path
+ char path[PATH_MAX];
+
+ // Filelist
+ struct pakfire_filelist* filelist;
+};
+
+int pakfire_stripper_create(struct pakfire_stripper** stripper,
+ struct pakfire* pakfire, const char* path) {
+ struct pakfire_stripper* s = NULL;
+ int r;
+
+ // Allocate a new object
+ s = calloc(1, sizeof(*s));
+ if (!s)
+ return -errno;
+
+ // Store a reference to the context
+ s->ctx = pakfire_ctx(pakfire);
+
+ // Store a reference to Pakfire
+ s->pakfire = pakfire_ref(pakfire);
+
+ // Initialize the reference counter
+ s->nrefs = 1;
+
+ // Store the path
+ r = pakfire_string_set(s->path, path);
+ if (r < 0)
+ goto ERROR;
+
+ // Return the pointer
+ *stripper = pakfire_stripper_ref(s);
+
+ERROR:
+ if (s)
+ pakfire_stripper_unref(s);
+
+ return r;
+}
+
+static void pakfire_stripper_free(struct pakfire_stripper* stripper) {
+ if (stripper->pakfire)
+ pakfire_unref(stripper->pakfire);
+ if (stripper->ctx)
+ pakfire_ctx_unref(stripper->ctx);
+ free(stripper);
+}
+
+struct pakfire_stripper* pakfire_stripper_ref(struct pakfire_stripper* stripper) {
+ ++stripper->nrefs;
+
+ return stripper;
+}
+
+struct pakfire_stripper* pakfire_stripper_unref(struct pakfire_stripper* stripper) {
+ if (--stripper->nrefs > 0)
+ return stripper;
+
+ pakfire_stripper_free(stripper);
+ return NULL;
+}
+
+int pakfire_stripper_run(struct pakfire_stripper* stripper) {
+ return 0; // TODO
+}