From: Michael Tremer Date: Wed, 3 Aug 2022 15:32:53 +0000 (+0000) Subject: execute: Drop old environment X-Git-Tag: 0.9.28~596 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0f78419b99a525c4fa34c1bfbcb33628fa4faf0f;p=pakfire.git execute: Drop old environment Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 894794249..c34700239 100644 --- a/Makefile.am +++ b/Makefile.am @@ -225,7 +225,6 @@ libpakfire_la_SOURCES = \ src/libpakfire/db.c \ src/libpakfire/dist.c \ src/libpakfire/downloader.c \ - src/libpakfire/execute.c \ src/libpakfire/file.c \ src/libpakfire/filelist.c \ src/libpakfire/jail.c \ @@ -262,7 +261,6 @@ pkginclude_HEADERS += \ src/libpakfire/include/pakfire/db.h \ src/libpakfire/include/pakfire/dist.h \ src/libpakfire/include/pakfire/downloader.h \ - src/libpakfire/include/pakfire/execute.h \ src/libpakfire/include/pakfire/file.h \ src/libpakfire/include/pakfire/filelist.h \ src/libpakfire/include/pakfire/i18n.h \ @@ -376,7 +374,6 @@ check_PROGRAMS += \ tests/libpakfire/db \ tests/libpakfire/dependencies \ tests/libpakfire/downloader \ - tests/libpakfire/execute \ tests/libpakfire/jail \ tests/libpakfire/key \ tests/libpakfire/makefile \ @@ -496,18 +493,6 @@ tests_libpakfire_downloader_CFLAGS = \ tests_libpakfire_downloader_LDADD = \ $(TESTSUITE_LDADD) -tests_libpakfire_execute_SOURCES = \ - tests/libpakfire/execute.c - -tests_libpakfire_execute_CPPFLAGS = \ - $(TESTSUITE_CPPFLAGS) - -tests_libpakfire_execute_CFLAGS = \ - $(TESTSUITE_CFLAGS) - -tests_libpakfire_execute_LDADD = \ - $(TESTSUITE_LDADD) - dist_tests_libpakfire_jail_SOURCES = \ tests/libpakfire/jail.c diff --git a/src/libpakfire/execute.c b/src/libpakfire/execute.c deleted file mode 100644 index b6304d4a0..000000000 --- a/src/libpakfire/execute.c +++ /dev/null @@ -1,63 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2019 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 . # -# # -#############################################################################*/ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -PAKFIRE_EXPORT int pakfire_execute(struct pakfire* pakfire, const char* argv[], char* envp[], - int flags, pakfire_execute_logging_callback logging_callback, void* data) { - struct pakfire_jail* jail = NULL; - int r; - - // Create a new jail - r = pakfire_jail_create(&jail, pakfire, flags); - if (r) - goto ERROR; - - // Setup logging - if (logging_callback) { - r = pakfire_jail_set_log_callback(jail, logging_callback, data); - if (r) - goto ERROR; - } - - // Import environment - r = pakfire_jail_import_env(jail, (const char**)envp); - if (r) - goto ERROR; - - // Execute the command - r = pakfire_jail_exec(jail, argv, NULL); - -ERROR: - if (jail) - pakfire_jail_unref(jail); - - return r; -} - diff --git a/src/libpakfire/include/pakfire/build.h b/src/libpakfire/include/pakfire/build.h index 1cfc425c1..cdb28b852 100644 --- a/src/libpakfire/include/pakfire/build.h +++ b/src/libpakfire/include/pakfire/build.h @@ -21,7 +21,6 @@ #ifndef PAKFIRE_BUILD_H #define PAKFIRE_BUILD_H -#include #include int pakfire_build(struct pakfire* pakfire, const char* path, const char* target, diff --git a/src/libpakfire/include/pakfire/execute.h b/src/libpakfire/include/pakfire/execute.h deleted file mode 100644 index 69ba55819..000000000 --- a/src/libpakfire/include/pakfire/execute.h +++ /dev/null @@ -1,38 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2019 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 . # -# # -#############################################################################*/ - -#ifndef PAKFIRE_EXECUTE_H -#define PAKFIRE_EXECUTE_H - -#include - -typedef int (*pakfire_execute_logging_callback)(struct pakfire* pakfire, void* data, - int priority, const char* line, size_t length); - -int pakfire_execute(struct pakfire* pakfire, const char* argv[], char* envp[], - int flags, pakfire_execute_logging_callback logging_callback, void* data); - -enum { - PAKFIRE_EXECUTE_NONE = 0, - PAKFIRE_EXECUTE_ENABLE_NETWORK = (1 << 0), - PAKFIRE_EXECUTE_INTERACTIVE = (1 << 1), -}; - -#endif /* PAKFIRE_EXECUTE_H */ diff --git a/src/libpakfire/libpakfire.sym b/src/libpakfire/libpakfire.sym index 0ffe35787..ed0d4c14f 100644 --- a/src/libpakfire/libpakfire.sym +++ b/src/libpakfire/libpakfire.sym @@ -28,7 +28,6 @@ global: pakfire_copy_out; pakfire_create; pakfire_erase; - pakfire_execute; pakfire_get_arch; pakfire_get_path; pakfire_get_repo; diff --git a/tests/libpakfire/execute.c b/tests/libpakfire/execute.c deleted file mode 100644 index 823646513..000000000 --- a/tests/libpakfire/execute.c +++ /dev/null @@ -1,45 +0,0 @@ -/*############################################################################# -# # -# Pakfire - The IPFire package management system # -# Copyright (C) 2019 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 . # -# # -#############################################################################*/ - -#include - -#include -#include - -#include "../testsuite.h" - -static const char* cmd[2] = { - "/usr/bin/does-not-exist", -}; - -static int test_does_not_exist(const struct test* t) { - ASSERT_FAILURE(pakfire_execute(t->pakfire, cmd, NULL, 0, NULL, NULL)); - - return EXIT_SUCCESS; - -FAIL: - return EXIT_FAILURE; -} - -int main(int argc, char** argv) { - testsuite_add_test(test_does_not_exist); - - return testsuite_run(); -}