]> git.ipfire.org Git - pakfire.git/commitdiff
Support to install packages without recommended packages
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 2 Nov 2017 15:55:05 +0000 (16:55 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 2 Nov 2017 15:55:05 +0000 (16:55 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/request.c
src/libpakfire/include/pakfire/request.h
src/libpakfire/request.c
src/pakfire/cli.py

index 936cf798feb1437decfc3ac4fd78a27c42516ec0..df48b653d4ae3954860afad591845e3e47e8366e 100644 (file)
@@ -208,8 +208,18 @@ static PyObject* Request_get_problems(RequestObject* self) {
        return list;
 }
 
-static PyObject* Request_solve(RequestObject* self) {
-       int ret = pakfire_request_solve(self->request, 0);
+static PyObject* Request_solve(RequestObject* self, PyObject* args, PyObject *kwds) {
+       char* kwlist[] = {"without_recommends", NULL};
+
+       int without_recommends = 0;
+       if (!PyArg_ParseTupleAndKeywords(args, kwds, "|p", kwlist, &without_recommends))
+               return NULL;
+
+       int flags = 0;
+       if (without_recommends)
+               flags |= PAKFIRE_SOLVER_WITHOUT_RECOMMENDS;
+
+       int ret = pakfire_request_solve(self->request, flags);
 
        // Raise a DependencyError with all problems
        // if the request could not be solved
@@ -269,7 +279,7 @@ static struct PyMethodDef Request_methods[] = {
        {
                "solve",
                (PyCFunction)Request_solve,
-               METH_NOARGS,
+               METH_VARARGS|METH_KEYWORDS,
                NULL
        },
        { NULL }
index f29b0a975e2e44328ec07a00e713637778391a69..3b1f11c96dfc0e4a9c0fc9ec1544d3e3d41c4166 100644 (file)
@@ -33,8 +33,9 @@ enum _pakfire_request_op_flags {
 };
 
 enum _pakfire_solver_flags {
-       PAKFIRE_SOLVER_ALLOW_UNINSTALL = 1 << 0,
-       PAKFIRE_SOLVER_FORCE_BEST      = 1 << 1,
+       PAKFIRE_SOLVER_ALLOW_UNINSTALL    = 1 << 0,
+       PAKFIRE_SOLVER_FORCE_BEST         = 1 << 1,
+       PAKFIRE_SOLVER_WITHOUT_RECOMMENDS = 1 << 2,
 };
 
 PakfireRequest pakfire_request_create(PakfirePool pool);
index 24847d32a44097927d8030e0458ba077b4cacfc8..d8aaab6cb948e018d61707cac90a20f21d1c9b9f 100644 (file)
@@ -87,6 +87,10 @@ static void init_solver(PakfireRequest request, int flags) {
        if (flags & PAKFIRE_SOLVER_ALLOW_UNINSTALL)
                solver_set_flag(solver, SOLVER_FLAG_ALLOW_UNINSTALL, 1);
 
+       /* ignore recommends */
+       if (flags & PAKFIRE_SOLVER_WITHOUT_RECOMMENDS)
+               solver_set_flag(solver, SOLVER_FLAG_IGNORE_RECOMMENDED, 1);
+
        /* no vendor locking */
        solver_set_flag(solver, SOLVER_FLAG_ALLOW_VENDORCHANGE, 1);
 
index 9a63cace9f475d6195b588515862835b12339308..6ecb8b49902a970d93434f142d0a56b61d9e5164 100644 (file)
@@ -290,7 +290,7 @@ class Cli(object):
 
        def handle_install(self, ns):
                with self.pakfire(ns) as p:
-                       p.install(ns.package, ignore_recommended=ns.without_recommends)
+                       p.install(ns.package, without_recommends=ns.without_recommends)
 
        def handle_reinstall(self, ns):
                with self.pakfire(ns) as p: