]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Drop relations entirely
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 29 Apr 2021 22:49:15 +0000 (22:49 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 29 Apr 2021 22:49:15 +0000 (22:49 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
15 files changed:
Makefile.am
src/_pakfire/_pakfiremodule.c
src/_pakfire/package.c
src/_pakfire/relation.c [deleted file]
src/_pakfire/relation.h [deleted file]
src/_pakfire/request.c
src/libpakfire/db.c
src/libpakfire/include/pakfire/package.h
src/libpakfire/include/pakfire/relation.h [deleted file]
src/libpakfire/include/pakfire/relationlist.h [deleted file]
src/libpakfire/include/pakfire/types.h
src/libpakfire/package.c
src/libpakfire/parser.c
src/libpakfire/relation.c [deleted file]
src/libpakfire/relationlist.c [deleted file]

index ef90387567fdf6feb2903b2b2671d7b637ba6a9e..539895511f8a7b50c24f63a56eaaaaa6d0aeb0bf 100644 (file)
@@ -177,8 +177,6 @@ _pakfire_la_SOURCES = \
        src/_pakfire/problem.h \
        src/_pakfire/progressbar.c \
        src/_pakfire/progressbar.h \
-       src/_pakfire/relation.c \
-       src/_pakfire/relation.h \
        src/_pakfire/repo.c \
        src/_pakfire/repo.h \
        src/_pakfire/request.c \
@@ -261,8 +259,6 @@ libpakfire_la_SOURCES = \
        src/libpakfire/problem.c \
        src/libpakfire/progressbar.c \
        src/libpakfire/pwd.c \
-       src/libpakfire/relation.c \
-       src/libpakfire/relationlist.c \
        src/libpakfire/repo.c \
        src/libpakfire/repolist.c \
        src/libpakfire/request.c \
@@ -297,8 +293,6 @@ pkginclude_HEADERS += \
        src/libpakfire/include/pakfire/problem.h \
        src/libpakfire/include/pakfire/progressbar.h \
        src/libpakfire/include/pakfire/pwd.h \
-       src/libpakfire/include/pakfire/relation.h \
-       src/libpakfire/include/pakfire/relationlist.h \
        src/libpakfire/include/pakfire/repo.h \
        src/libpakfire/include/pakfire/repolist.h \
        src/libpakfire/include/pakfire/request.h \
index 4b1fc4ed046ae2abb7a397684d2d12bc70e4c32f..557348549d0a6f17aeaa7aa6f08a4e1128275595 100644 (file)
@@ -31,7 +31,6 @@
 #include "parser.h"
 #include "problem.h"
 #include "progressbar.h"
-#include "relation.h"
 #include "repo.h"
 #include "request.h"
 #include "solution.h"
@@ -156,13 +155,6 @@ PyMODINIT_FUNC PyInit__pakfire(void) {
        Py_INCREF(&RepoType);
        PyModule_AddObject(module, "Repo", (PyObject *)&RepoType);
 
-       // Relation
-       if (PyType_Ready(&RelationType) < 0)
-               return NULL;
-
-       Py_INCREF(&RelationType);
-       PyModule_AddObject(module, "Relation", (PyObject *)&RelationType);
-
        // Request
        if (PyType_Ready(&RequestType) < 0)
                return NULL;
index b378e84ba47a525de4c3dc18c7f0266df15d5b93..3773a5cf00cdf6920fc4c4b488abe7167c1cc12b 100644 (file)
 #include <pakfire/file.h>
 #include <pakfire/filelist.h>
 #include <pakfire/package.h>
-#include <pakfire/relationlist.h>
 #include <pakfire/repo.h>
 #include <pakfire/util.h>
 
 #include "package.h"
 #include "pakfire.h"
-#include "relation.h"
 #include "repo.h"
 
 PyObject* new_package(PyTypeObject* type, PakfirePackage pkg) {
diff --git a/src/_pakfire/relation.c b/src/_pakfire/relation.c
deleted file mode 100644 (file)
index ac4f21c..0000000
+++ /dev/null
@@ -1,137 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2011 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 <Python.h>
-
-#include <pakfire/package.h>
-#include <pakfire/packagelist.h>
-#include <pakfire/relation.h>
-#include <pakfire/types.h>
-#include <pakfire/util.h>
-
-#include "package.h"
-#include "relation.h"
-
-PyObject* new_relation(PyTypeObject* type, PakfireRelation relation) {
-       RelationObject* self = (RelationObject *)type->tp_alloc(type, 0);
-       if (self) {
-               self->relation = pakfire_relation_ref(relation);
-       }
-
-       return (PyObject*)self;
-}
-
-static PyObject* Relation_new(PyTypeObject* type, PyObject* args, PyObject* kwds) {
-       RelationObject* self = (RelationObject *)type->tp_alloc(type, 0);
-       if (self) {
-               self->relation = NULL;
-       }
-
-       return (PyObject*)self;
-}
-
-static void Relation_dealloc(RelationObject* self) {
-       pakfire_relation_unref(self->relation);
-
-       Py_TYPE(self)->tp_free((PyObject *)self);
-}
-
-static int Relation_init(RelationObject* self, PyObject* args, PyObject* kwds) {
-       PakfireObject* pakfire;
-       const char* relation;
-
-       if (!PyArg_ParseTuple(args, "O!s", &PakfireType, &pakfire, &relation))
-               return -1;
-
-       self->relation = pakfire_relation_create_from_string(pakfire->pakfire, relation);
-       if (!self->relation) {
-               PyErr_Format(PyExc_ValueError, "No such relation: %s", relation);
-               return -1;
-       }
-
-       return 0;
-}
-
-static long Relation_hash(RelationObject* self) {
-       return pakfire_relation_get_id(self->relation);
-}
-
-static PyObject* Relation_repr(RelationObject* self) {
-       char* relation = pakfire_relation_str(self->relation);
-
-       PyObject* repr = PyUnicode_FromFormat("<_pakfire.Relation %s>", relation);
-       free(relation);
-
-       return repr;
-}
-
-static PyObject* Relation_str(RelationObject* self) {
-       char* relation = pakfire_relation_str(self->relation);
-
-       PyObject* str = PyUnicode_FromString(relation);
-       free(relation);
-
-       return str;
-}
-
-static PyObject* Relation_get_providers(RelationObject* self) {
-       PakfirePackageList packagelist = pakfire_relation_providers(self->relation);
-
-       PyObject* list = PyList_New(0);
-       for (unsigned int i = 0; i < pakfire_packagelist_count(packagelist); i++) {
-               PakfirePackage package = pakfire_packagelist_get(packagelist, i);
-
-               PyObject* obj = new_package(&PackageType, package);
-               PyList_Append(list, obj);
-
-               pakfire_package_unref(package);
-               Py_DECREF(obj);
-       }
-
-       pakfire_packagelist_unref(packagelist);
-
-       return list;
-}
-
-static struct PyGetSetDef Relation_getsetters[] = {
-       {
-               "providers",
-               (getter)Relation_get_providers,
-               NULL,
-               NULL,
-               NULL
-       },
-       { NULL },
-};
-
-PyTypeObject RelationType = {
-       PyVarObject_HEAD_INIT(NULL, 0)
-       tp_name:            "_pakfire.Relation",
-       tp_basicsize:       sizeof(RelationObject),
-       tp_flags:           Py_TPFLAGS_DEFAULT|Py_TPFLAGS_BASETYPE,
-       tp_new:             Relation_new,
-       tp_dealloc:         (destructor)Relation_dealloc,
-       tp_init:            (initproc)Relation_init,
-       tp_doc:             "Relation object",
-       tp_hash:            (hashfunc)Relation_hash,
-       tp_repr:            (reprfunc)Relation_repr,
-       tp_str:             (reprfunc)Relation_str,
-       tp_getset:          Relation_getsetters,
-};
diff --git a/src/_pakfire/relation.h b/src/_pakfire/relation.h
deleted file mode 100644 (file)
index 412b5b1..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2011 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 PYTHON_PAKFIRE_RELATION_H
-#define PYTHON_PAKFIRE_RELATION_H
-
-#include <Python.h>
-
-#include <pakfire/types.h>
-
-#include "pakfire.h"
-
-typedef struct {
-    PyObject_HEAD
-    PakfireRelation relation;
-} RelationObject;
-
-extern PyTypeObject RelationType;
-
-PyObject* new_relation(PyTypeObject* type, PakfireRelation relation);
-
-#endif /* PYTHON_PAKFIRE_RELATION_H */
index e1ec3cbbd569f35631438155a5bcbf51e6fe9867..eef117f2edfcd28ce30ec0cbf51000a0aa855e03 100644 (file)
@@ -26,7 +26,6 @@
 #include "package.h"
 #include "pakfire.h"
 #include "problem.h"
-#include "relation.h"
 #include "request.h"
 #include "transaction.h"
 
index 27cde2ba94be4bc07f3020c03abf52fc720b029d..20a8602795342b7c446a9d9e338faa8fb8d808f9 100644 (file)
@@ -32,7 +32,6 @@
 #include <pakfire/package.h>
 #include <pakfire/pakfire.h>
 #include <pakfire/private.h>
-#include <pakfire/relationlist.h>
 #include <pakfire/repo.h>
 #include <pakfire/types.h>
 #include <pakfire/util.h>
index 2457086f52c1579b24f6fefc3b4f0b2052fd8aea..e4e04a158f04d51feec73e9eeedd2c039397d429 100644 (file)
@@ -24,8 +24,6 @@
 #include <time.h>
 
 #include <pakfire/filelist.h>
-#include <pakfire/relation.h>
-#include <pakfire/relationlist.h>
 #include <pakfire/types.h>
 
 PakfirePackage pakfire_package_create(Pakfire pakfire, PakfireRepo repo,
diff --git a/src/libpakfire/include/pakfire/relation.h b/src/libpakfire/include/pakfire/relation.h
deleted file mode 100644 (file)
index d76bcf4..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2013 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_RELATION_H
-#define PAKFIRE_RELATION_H
-
-#include <solv/pool.h>
-#include <solv/pooltypes.h>
-#include <solv/queue.h>
-
-#include <pakfire/types.h>
-
-PakfireRelation pakfire_relation_create(Pakfire pakfire, const char* name, int cmp_type, const char* evr);
-PakfireRelation pakfire_relation_create_from_id(Pakfire pakfire, Id id);
-PakfireRelation pakfire_relation_create_from_string(Pakfire pakfire, const char* s);
-
-PakfireRelation pakfire_relation_ref(PakfireRelation relation);
-PakfireRelation pakfire_relation_unref(PakfireRelation relation);
-
-Id pakfire_relation_get_id(PakfireRelation relation);
-char* pakfire_relation_str(PakfireRelation relation);
-
-PakfirePackageList pakfire_relation_providers(PakfireRelation relation);
-
-int pakfire_relation2queue(const PakfireRelation relation, Queue* queue, int solver_action);
-
-#endif /* PAKFIRE_RELATION_H */
diff --git a/src/libpakfire/include/pakfire/relationlist.h b/src/libpakfire/include/pakfire/relationlist.h
deleted file mode 100644 (file)
index 9ca38a0..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2013 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_RELATIONLIST_H
-#define PAKFIRE_RELATIONLIST_H
-
-#include <pakfire/types.h>
-
-int pakfire_relationlist_create(PakfireRelationList* list, Pakfire pakfire);
-int pakfire_relationlist_create_from_string(PakfireRelationList* list,
-       Pakfire pakfire, const char* s);
-
-PakfireRelationList pakfire_relationlist_ref(PakfireRelationList relationlist);
-PakfireRelationList pakfire_relationlist_unref(PakfireRelationList relationlist);
-
-void pakfire_relationlist_add(PakfireRelationList relationlist, PakfireRelation relation);
-size_t pakfire_relationlist_size(PakfireRelationList relationlist);
-
-PakfireRelation pakfire_relationlist_get(PakfireRelationList relationlist, int index);
-
-void pakfire_relationlist_sort(PakfireRelationList list);
-
-#ifdef PAKFIRE_PRIVATE
-
-int pakfire_relationlist_from_queue(PakfireRelationList* list, Pakfire pakfire, Queue q);
-Queue* pakfire_relationlist_get_queue(PakfireRelationList list);
-
-#endif
-
-#endif /* PAKFIRE_RELATIONLIST_H */
index 9af95f987a191f33a698d52d41b81840de72fcf4..e394b23f82835d8e5a40f13eb7702067650adc50 100644 (file)
@@ -33,8 +33,6 @@ typedef struct _PakfirePackage* PakfirePackage;
 typedef struct _PakfirePackageList* PakfirePackageList;
 typedef struct _PakfireParser* PakfireParser;
 typedef struct _PakfireProblem* PakfireProblem;
-typedef struct _PakfireRelation* PakfireRelation;
-typedef struct _PakfireRelationList* PakfireRelationList;
 typedef struct _PakfireRepo* PakfireRepo;
 typedef struct _PakfireSolution* PakfireSolution;
 typedef struct _PakfireStep* PakfireStep;
index d8d1bc53b823a2b1279282a4a5f2f05ac5ecc890..7b9db5759ba9fad83bfb6bca5e904d5c0b425564 100644 (file)
@@ -39,8 +39,6 @@
 #include <pakfire/package.h>
 #include <pakfire/pakfire.h>
 #include <pakfire/private.h>
-#include <pakfire/relation.h>
-#include <pakfire/relationlist.h>
 #include <pakfire/repo.h>
 #include <pakfire/util.h>
 
@@ -640,20 +638,6 @@ ERROR:
        return array;
 }
 
-static void pakfire_package_set_relationlist(PakfirePackage pkg, Id type,
-               PakfireRelationList relationlist, Id marker) {
-       Solvable* s = get_solvable(pkg);
-       Queue* q = pakfire_relationlist_get_queue(relationlist);
-
-#if 0
-       // This implemention should be the fastest, but unfortunately does not work.
-       solvable_set_deparray(s, type, q, marker);
-#else
-       for (int i = 0; i < q->count; i++)
-               solvable_add_deparray(s, type, q->elements[i], marker);
-#endif
-}
-
 static void pakfire_package_add_dep(PakfirePackage pkg, Id type,
                const char* dep, Id marker) {
        Solvable* s = get_solvable(pkg);
@@ -670,11 +654,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_provides(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_PROVIDES, -SOLVABLE_FILEMARKER);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_provides(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_PROVIDES, relationlist, -SOLVABLE_FILEMARKER);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_provides(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_provides(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_PROVIDES, dep, -SOLVABLE_FILEMARKER);
 }
 
@@ -682,11 +662,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_prerequires(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_REQUIRES, SOLVABLE_PREREQMARKER);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_prerequires(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_REQUIRES, relationlist, SOLVABLE_PREREQMARKER);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_prerequires(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_prerequires(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_REQUIRES, dep, SOLVABLE_PREREQMARKER);
 }
 
@@ -694,11 +670,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_requires(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_REQUIRES, -SOLVABLE_PREREQMARKER);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_requires(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_REQUIRES, relationlist, -SOLVABLE_PREREQMARKER);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_requires(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_requires(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_REQUIRES, dep, -SOLVABLE_PREREQMARKER);
 }
 
@@ -706,11 +678,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_conflicts(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_CONFLICTS, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_conflicts(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_CONFLICTS, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_conflicts(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_conflicts(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_CONFLICTS, dep, 0);
 }
 
@@ -718,11 +686,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_obsoletes(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_OBSOLETES, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_obsoletes(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_OBSOLETES, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_obsoletes(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_obsoletes(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_OBSOLETES, dep, 0);
 }
 
@@ -730,11 +694,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_recommends(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_RECOMMENDS, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_recommends(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_RECOMMENDS, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_recommends(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_recommends(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_RECOMMENDS, dep, 0);
 }
 
@@ -742,11 +702,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_suggests(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_SUGGESTS, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_suggests(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_SUGGESTS, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_suggests(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_suggests(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_SUGGESTS, dep, 0);
 }
 
@@ -754,11 +710,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_supplements(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_SUPPLEMENTS, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_supplements(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_SUPPLEMENTS, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_supplements(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_supplements(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_SUPPLEMENTS, dep, 0);
 }
 
@@ -766,11 +718,7 @@ PAKFIRE_EXPORT char** pakfire_package_get_enhances(PakfirePackage pkg) {
        return pakfire_package_get_relationlist(pkg, SOLVABLE_ENHANCES, 0);
 }
 
-PAKFIRE_EXPORT void pakfire_package_set_enhances(PakfirePackage pkg, PakfireRelationList relationlist) {
-       pakfire_package_set_relationlist(pkg, SOLVABLE_ENHANCES, relationlist, 0);
-}
-
-PAKFIRE_EXPORT void pakfire_package_add_enhances(PakfirePackage pkg, const char* dep) {
+void pakfire_package_add_enhances(PakfirePackage pkg, const char* dep) {
        pakfire_package_add_dep(pkg, SOLVABLE_ENHANCES, dep, 0);
 }
 
index 7b17a271274c654bc7f8e834be1563ba691e441a..a79413a71080b7009a9eb86f8c39b4b7d1a3920e 100644 (file)
@@ -847,20 +847,29 @@ PAKFIRE_EXPORT int pakfire_parser_create_package(PakfireParser parser,
        }
 
        if (is_source) {
-               PakfireRelationList list;
-
                // Fetch build dependencies
                char* requires = pakfire_parser_get(parser, "build", "requires");
 
                if (requires && *requires) {
-                       r = pakfire_relationlist_create_from_string(&list, parser->pakfire, requires);
-                       if (r) {
-                               pakfire_relationlist_unref(list);
-                               goto CLEANUP;
-                       }
+                       char* p = requires;
+
+                       while (*p) {
+                               char* e = strchr(p, '\n');
 
-                       pakfire_package_set_requires(*pkg, list);
-                       pakfire_relationlist_unref(list);
+                               // Terminate the string
+                               if (e)
+                                       *e = '\0';
+
+                               // Add the dependency
+                               pakfire_package_add_requires(*pkg, p);
+
+                               // End loop when we reached the end
+                               if (!e)
+                                       break;
+
+                               // Or continue at the next line
+                               p = e + 1;
+                       }
                }
        }
 
diff --git a/src/libpakfire/relation.c b/src/libpakfire/relation.c
deleted file mode 100644 (file)
index 5a16696..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2013 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 <stdlib.h>
-
-#include <solv/pooltypes.h>
-#include <solv/queue.h>
-#include <solv/solver.h>
-
-#include <pakfire/logging.h>
-#include <pakfire/packagelist.h>
-#include <pakfire/pakfire.h>
-#include <pakfire/private.h>
-#include <pakfire/relation.h>
-#include <pakfire/types.h>
-#include <pakfire/util.h>
-
-struct _PakfireRelation {
-       Pakfire pakfire;
-       Id id;
-       int nrefs;
-};
-
-const char* delimiters[] = {
-       ">=", ">", "<=", "<", "=", NULL,
-};
-
-static int cmp2type(const char* s) {
-       if (strcmp(s, ">=") == 0)
-               return PAKFIRE_GE;
-
-       if (strcmp(s, ">") == 0)
-               return PAKFIRE_GT;
-
-       if (strcmp(s, "<=") == 0)
-               return PAKFIRE_LE;
-
-       if (strcmp(s, "<") == 0)
-               return PAKFIRE_LT;
-
-       if (strcmp(s, "=") == 0)
-               return PAKFIRE_EQ;
-
-       return 0;
-}
-
-static int cmptype2relflags(int type) {
-       int flags = 0;
-
-       if (type & PAKFIRE_EQ)
-               flags |= REL_EQ;
-       if (type & PAKFIRE_LT)
-               flags |= REL_LT;
-       if (type & PAKFIRE_GT)
-               flags |= REL_GT;
-
-       return flags;
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relation_create(Pakfire pakfire, const char* name, int cmp_type, const char* evr) {
-       Pool* p = pakfire_get_solv_pool(pakfire);
-
-       Id id = pool_str2id(p, name, 1);
-
-       if (id == STRID_NULL || id == STRID_EMPTY)
-               return NULL;
-
-       if (evr) {
-               Id ievr = pool_str2id(p, evr, 1);
-               int flags = cmptype2relflags(cmp_type);
-               id = pool_rel2id(p, id, ievr, flags, 1);
-       }
-
-       return pakfire_relation_create_from_id(pakfire, id);
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relation_create_from_id(Pakfire pakfire, Id id) {
-       PakfireRelation relation = calloc(1, sizeof(*relation));
-       if (relation) {
-               DEBUG(pakfire, "Allocated Relation at %p\n", relation);
-               relation->nrefs = 1;
-
-               relation->pakfire = pakfire_ref(pakfire);
-               relation->id = id;
-       }
-
-       return relation;
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relation_create_from_string(Pakfire pakfire, const char* s) {
-       DEBUG(pakfire, "Parsing relation from string: %s\n", s);
-
-       char* name;
-       char* evr;
-
-       const char** delim = delimiters;
-       while (*delim) {
-               pakfire_string_partition(s, *delim, &name, &evr);
-
-               // Nothing to do for no match
-               if (!name && !evr) {
-                       delim++;
-                       continue;
-               }
-
-               // Create new relation object
-               PakfireRelation rel = pakfire_relation_create(pakfire, name, cmp2type(*delim), evr);
-
-               // Cleanup
-               free(name);
-               free(evr);
-
-               return rel;
-       }
-
-       // No delimiter was found
-       return pakfire_relation_create(pakfire, s, 0, NULL);
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relation_ref(PakfireRelation relation) {
-       relation->nrefs++;
-
-       return relation;
-}
-
-static void pakfire_relation_free(PakfireRelation relation) {
-       DEBUG(relation->pakfire, "Releasing Relation at %p\n", relation);
-
-       pakfire_unref(relation->pakfire);
-       free(relation);
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relation_unref(PakfireRelation relation) {
-       if (!relation)
-               return NULL;
-
-       if (--relation->nrefs > 0)
-               return relation;
-
-       pakfire_relation_free(relation);
-       return NULL;
-}
-
-PAKFIRE_EXPORT Id pakfire_relation_get_id(PakfireRelation relation) {
-       return relation->id;
-}
-
-PAKFIRE_EXPORT char* pakfire_relation_str(PakfireRelation relation) {
-       Pool* pool = pakfire_get_solv_pool(relation->pakfire);
-
-       const char* str = pool_dep2str(pool, relation->id);
-
-       return strdup(str);
-}
-
-PAKFIRE_EXPORT int pakfire_relation2queue(const PakfireRelation relation, Queue* queue, int solver_action) {
-       queue_push2(queue, SOLVER_SOLVABLE_PROVIDES|solver_action, relation->id);
-
-       return 0;
-}
-
-PAKFIRE_EXPORT PakfirePackageList pakfire_relation_providers(PakfireRelation relation) {
-       Queue q;
-       queue_init(&q);
-
-       pakfire_relation2queue(relation, &q, 0);
-
-       PakfirePackageList list = pakfire_packagelist_from_queue(relation->pakfire, &q);
-
-       queue_free(&q);
-
-       return list;
-}
diff --git a/src/libpakfire/relationlist.c b/src/libpakfire/relationlist.c
deleted file mode 100644 (file)
index af8f004..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*#############################################################################
-#                                                                             #
-# Pakfire - The IPFire package management system                              #
-# Copyright (C) 2013 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 <string.h>
-
-#include <solv/pooltypes.h>
-#include <solv/queue.h>
-
-#include <pakfire/logging.h>
-#include <pakfire/pakfire.h>
-#include <pakfire/private.h>
-#include <pakfire/relation.h>
-#include <pakfire/relationlist.h>
-#include <pakfire/types.h>
-#include <pakfire/util.h>
-
-struct _PakfireRelationList {
-       Pakfire pakfire;
-       Queue queue;
-       int nrefs;
-};
-
-PAKFIRE_EXPORT int pakfire_relationlist_create(PakfireRelationList* list, Pakfire pakfire) {
-       PakfireRelationList l = calloc(1, sizeof(*l));
-       if (!l)
-               return ENOMEM;
-
-       DEBUG(pakfire, "Allocated RelationList at %p\n", l);
-       l->pakfire = pakfire_ref(pakfire);
-       l->nrefs = 1;
-
-       queue_init(&l->queue);
-
-       *list = l;
-       return 0;
-}
-
-PAKFIRE_EXPORT int pakfire_relationlist_create_from_string(PakfireRelationList* list, Pakfire pakfire, const char* s) {
-       int r = pakfire_relationlist_create(list, pakfire);
-       if (r)
-               return r;
-
-       // Split input by newline
-       char** elements = pakfire_split_string(s, '\n');
-       if (!elements)
-               return 1;
-
-       for (char** element = elements; *element; element++) {
-               PakfireRelation rel = pakfire_relation_create_from_string(pakfire, *element);
-               if (rel) {
-                       pakfire_relationlist_add(*list, rel);
-                       pakfire_relation_unref(rel);
-               }
-
-               free(*element);
-       }
-
-       free(elements);
-
-       return 0;
-}
-
-PAKFIRE_EXPORT PakfireRelationList pakfire_relationlist_ref(PakfireRelationList relationlist) {
-       relationlist->nrefs++;
-
-       return relationlist;
-}
-
-static void pakfire_relationlist_free(PakfireRelationList relationlist) {
-       DEBUG(relationlist->pakfire, "Releasing RelationList at %p\n", relationlist);
-       pakfire_unref(relationlist->pakfire);
-
-       queue_free(&relationlist->queue);
-       free(relationlist);
-}
-
-PAKFIRE_EXPORT PakfireRelationList pakfire_relationlist_unref(PakfireRelationList relationlist) {
-       if (!relationlist)
-               return NULL;
-
-       if (--relationlist->nrefs > 0)
-               return relationlist;
-
-       pakfire_relationlist_free(relationlist);
-       return NULL;
-}
-
-PAKFIRE_EXPORT void pakfire_relationlist_add(PakfireRelationList relationlist, PakfireRelation relation) {
-       queue_push(&relationlist->queue, pakfire_relation_get_id(relation));
-}
-
-PAKFIRE_EXPORT size_t pakfire_relationlist_size(PakfireRelationList relationlist) {
-       return relationlist->queue.count;
-}
-
-PAKFIRE_EXPORT int pakfire_relationlist_from_queue(PakfireRelationList* list, Pakfire pakfire, Queue q) {
-       int r = pakfire_relationlist_create(list, pakfire);
-       if (r)
-               return r;
-
-       // Release old queue
-       queue_free(&(*list)->queue);
-
-       // Copy the queue
-       queue_init_clone(&(*list)->queue, &q);
-
-       return 0;
-}
-
-PAKFIRE_EXPORT PakfireRelation pakfire_relationlist_get(PakfireRelationList relationlist, int index) {
-       if (index >= relationlist->queue.count)
-               return NULL;
-
-       Id id = relationlist->queue.elements[index];
-
-       return pakfire_relation_create_from_id(relationlist->pakfire, id);
-}
-
-Queue* pakfire_relationlist_get_queue(PakfireRelationList list) {
-       return &list->queue;
-}
-
-static int __sort(const void* _rel1, const void* _rel2, void* _pool) {
-       const char* s1 = pool_dep2str((Pool*)_pool, *(Id*)_rel1);
-       const char* s2 = pool_dep2str((Pool*)_pool, *(Id*)_rel2);
-
-       return strcmp(s1, s2);
-}
-
-PAKFIRE_EXPORT void pakfire_relationlist_sort(PakfireRelationList list) {
-       Pool* pool = pakfire_get_solv_pool(list->pakfire);
-
-       qsort_r(list->queue.elements, list->queue.count, sizeof(*list->queue.elements),
-               __sort, pool);
-}