]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
libpakfire: Remove the unused copy_in/copy_out functions
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Sep 2023 13:59:01 +0000 (13:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 25 Sep 2023 13:59:01 +0000 (13:59 +0000)
Fixes: #12973
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/pakfire.c
src/libpakfire/include/pakfire/pakfire.h
src/libpakfire/libpakfire.sym
src/libpakfire/pakfire.c

index e17a8d6388dbe4dfc8f2184f2e27063f001d8c53..6a8dc55bf30d21ea418b928cdfd50fce3d445823 100644 (file)
@@ -829,48 +829,6 @@ static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
        return ret;
 }
 
-static PyObject* Pakfire_copy_in(PakfireObject* self, PyObject* args) {
-       const char* src = NULL;
-       const char* dst = NULL;
-
-       if (!PyArg_ParseTuple(args, "ss", &src, &dst))
-               return NULL;
-
-       Py_BEGIN_ALLOW_THREADS
-
-       int r = pakfire_copy_in(self->pakfire, src, dst);
-       if (r) {
-               Py_BLOCK_THREADS
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       Py_END_ALLOW_THREADS
-
-       Py_RETURN_NONE;
-}
-
-static PyObject* Pakfire_copy_out(PakfireObject* self, PyObject* args) {
-       const char* src = NULL;
-       const char* dst = NULL;
-
-       if (!PyArg_ParseTuple(args, "ss", &src, &dst))
-               return NULL;
-
-       Py_BEGIN_ALLOW_THREADS
-
-       int r = pakfire_copy_out(self->pakfire, src, dst);
-       if (r) {
-               Py_BLOCK_THREADS
-               PyErr_SetFromErrno(PyExc_OSError);
-               return NULL;
-       }
-
-       Py_END_ALLOW_THREADS
-
-       Py_RETURN_NONE;
-}
-
 static PyObject* Pakfire_get_repos(PakfireObject* self) {
        struct pakfire_repolist* repos = pakfire_get_repos(self->pakfire);
        if (!repos) {
@@ -1253,18 +1211,6 @@ static struct PyMethodDef Pakfire_methods[] = {
                METH_NOARGS,
                NULL,
        },
-       {
-               "copy_in",
-               (PyCFunction)Pakfire_copy_in,
-               METH_VARARGS,
-               NULL,
-       },
-       {
-               "copy_out",
-               (PyCFunction)Pakfire_copy_out,
-               METH_VARARGS,
-               NULL,
-       },
        {
                "dist",
                (PyCFunction)Pakfire_dist,
index 2084e69c2a4ab56d440e494cedec86ad80e72111..8cf822b1c85dd62d03fbe7e5d9a5a95f13a3dd7b 100644 (file)
@@ -65,9 +65,6 @@ int pakfire_refresh(struct pakfire* pakfire, int flags);
 
 int pakfire_list_keys(struct pakfire* pakfire, struct pakfire_key*** keys);
 
-int pakfire_copy_in(struct pakfire* pakfire, const char* src, const char* dst);
-int pakfire_copy_out(struct pakfire* pakfire, const char* src, const char* dst);
-
 const char* pakfire_get_arch(struct pakfire* pakfire);
 
 int pakfire_version_compare(struct pakfire* pakfire, const char* evr1, const char* evr2);
index 26dce9ba58793d37832346c8f1a1602a1a342a0c..5c50074f9797ab2ad32541453664a73cbaf728d2 100644 (file)
@@ -23,8 +23,6 @@ global:
        # pakfire
        pakfire_check;
        pakfire_clean;
-       pakfire_copy_in;
-       pakfire_copy_out;
        pakfire_create;
        pakfire_get_arch;
        pakfire_get_path;
index 535b32b1136fb81c994be0297a7d72f12280870c..fb3ca747ac2a700bc9fdc6ba4af55b83a338e9ee 100644 (file)
@@ -1281,115 +1281,6 @@ PAKFIRE_EXPORT int pakfire_refresh(struct pakfire* pakfire, int flags) {
        return pakfire_repo_walk(pakfire, __pakfire_repo_refresh, &flags);
 }
 
-enum pakfire_copy_direction {
-       PAKFIRE_COPY_IN,
-       PAKFIRE_COPY_OUT,
-};
-
-static int __pakfire_copy(struct pakfire* pakfire, const char* src, const char* dst,
-               enum pakfire_copy_direction direction) {
-       struct archive* reader = NULL;
-       struct archive* writer = NULL;
-       struct archive_entry* entry = NULL;
-       FILE* f = NULL;
-       int r = 1;
-
-       DEBUG(pakfire, "Copying %s to %s\n", src, dst);
-
-       // Open the source file
-       f = fopen(src, "r");
-       if (!f) {
-               ERROR(pakfire, "Could not open %s: %m\n", src);
-               goto ERROR;
-       }
-
-       // Allocate reader
-       reader = pakfire_make_archive_disk_reader(pakfire, (direction == PAKFIRE_COPY_OUT));
-       if (!reader)
-               goto ERROR;
-
-       // Allocate writer
-       writer = pakfire_make_archive_disk_writer(pakfire, (direction == PAKFIRE_COPY_IN));
-       if (!writer)
-               goto ERROR;
-
-       // Create a new entry
-       entry = archive_entry_new();
-       if (!entry)
-               goto ERROR;
-
-       // Set the source path
-       archive_entry_copy_sourcepath(entry, src);
-
-       // Set the destination path
-       archive_entry_set_pathname(entry, dst);
-
-       // Read everything from source file
-       r = archive_read_disk_entry_from_file(reader, entry, fileno(f), NULL);
-       if (r) {
-               ERROR(pakfire, "Could not read from %s: %m\n", src);
-               goto ERROR;
-       }
-
-       // Write file to destination
-       r = archive_write_header(writer, entry);
-       if (r) {
-               ERROR(pakfire, "Could not write %s: %m\n", dst);
-               goto ERROR;
-       }
-
-       // Copy payload
-       if (archive_entry_filetype(entry) == AE_IFREG) {
-               r = pakfire_archive_copy_data_from_file(pakfire, writer, f);
-               if (r)
-                       goto ERROR;
-       }
-
-ERROR:
-       if (f)
-               fclose(f);
-       if (entry)
-               archive_entry_free(entry);
-       if (reader)
-               archive_read_free(reader);
-       if (writer)
-               archive_write_free(writer);
-
-       return r;
-}
-
-PAKFIRE_EXPORT int pakfire_copy_in(struct pakfire* pakfire, const char* src, const char* dst) {
-       char path[PATH_MAX];
-       int r;
-
-       if (pakfire_on_root(pakfire)) {
-               errno = ENOTSUP;
-               return 1;
-       }
-
-       r = pakfire_path(pakfire, path, "%s", dst);
-       if (r)
-               return r;
-
-       return __pakfire_copy(pakfire, src, path, PAKFIRE_COPY_IN);
-}
-
-PAKFIRE_EXPORT int pakfire_copy_out(struct pakfire* pakfire, const char* src, const char* dst) {
-       char path[PATH_MAX];
-       int r;
-
-       if (pakfire_on_root(pakfire)) {
-               errno = ENOTSUP;
-               return 1;
-       }
-
-       r = pakfire_path(pakfire, path, "%s", src);
-       if (r)
-               return r;
-
-       return __pakfire_copy(pakfire, path, dst, PAKFIRE_COPY_OUT);
-}
-
 PAKFIRE_EXPORT const char* pakfire_get_arch(struct pakfire* pakfire) {
        return pakfire->arches.nominal;
 }