From: Michael Tremer Date: Mon, 5 Jul 2021 20:33:50 +0000 (+0000) Subject: install: Make --without-recommended work X-Git-Tag: 0.9.28~1106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c572abee2bcd95111eefa5044d0c2a96188c9b90;p=pakfire.git install: Make --without-recommended work Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/pakfire.c b/src/_pakfire/pakfire.c index de87c3e35..e1507af8e 100644 --- a/src/_pakfire/pakfire.c +++ b/src/_pakfire/pakfire.c @@ -275,21 +275,23 @@ ERROR: static PyObject* Pakfire_install(PakfireObject* self, PyObject* args, PyObject* kwargs) { char* kwlist[] = { "packages", - "include_recommended", + "without_recommended", NULL }; char** packages = NULL; - int include_recommended = 1; - int flags = 0; + int without_recommended = 0; + int solver_flags = 0; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&|$p", kwlist, - convert_packages, &packages, &include_recommended)) + convert_packages, &packages, &without_recommended)) return NULL; - // XXX include_recommended + // Do not install recommended packages + if (without_recommended) + solver_flags |= PAKFIRE_REQUEST_WITHOUT_RECOMMENDED; // Run pakfire_install - int r = pakfire_install(self->pakfire, 0, (const char**)packages, NULL, flags, NULL); + int r = pakfire_install(self->pakfire, solver_flags, (const char**)packages, NULL, 0, NULL); if (r) PyErr_SetFromErrno(PyExc_OSError); diff --git a/src/libpakfire/include/pakfire/request.h b/src/libpakfire/include/pakfire/request.h index 71bee5593..6b2db6b25 100644 --- a/src/libpakfire/include/pakfire/request.h +++ b/src/libpakfire/include/pakfire/request.h @@ -30,6 +30,10 @@ struct pakfire_request; #include enum pakfire_request_flags { + PAKFIRE_REQUEST_WITHOUT_RECOMMENDED = 1 << 0, +}; + +enum pakfire_request_job_flags { PAKFIRE_REQUEST_KEEP_DEPS = 1 << 0, PAKFIRE_REQUEST_KEEP_ORPHANED = 1 << 1, }; @@ -37,7 +41,6 @@ enum pakfire_request_flags { enum _pakfire_solver_flags { PAKFIRE_SOLVER_ALLOW_UNINSTALL = 1 << 0, PAKFIRE_SOLVER_FORCE_BEST = 1 << 1, - PAKFIRE_SOLVER_WITHOUT_RECOMMENDS = 1 << 2, PAKFIRE_SOLVER_ALLOW_DOWNGRADE = 1 << 3, PAKFIRE_SOLVER_ALLOW_VENDORCHANGE = 1 << 4, }; diff --git a/src/libpakfire/request.c b/src/libpakfire/request.c index 5ec58e514..02f5d2d27 100644 --- a/src/libpakfire/request.c +++ b/src/libpakfire/request.c @@ -118,7 +118,8 @@ static int setup_solver(struct pakfire_request* request, int flags) { if (flags & PAKFIRE_SOLVER_ALLOW_VENDORCHANGE) solver_set_flag(request->solver, SOLVER_FLAG_ALLOW_VENDORCHANGE, 1); - if (flags & PAKFIRE_SOLVER_WITHOUT_RECOMMENDS) + // Do not install any recommended packages + if (flags & PAKFIRE_REQUEST_WITHOUT_RECOMMENDED) solver_set_flag(request->solver, SOLVER_FLAG_IGNORE_RECOMMENDED, 1); // Add multiinstall packages diff --git a/src/pakfire/cli.py b/src/pakfire/cli.py index b86088fd6..85317c798 100644 --- a/src/pakfire/cli.py +++ b/src/pakfire/cli.py @@ -82,7 +82,7 @@ class Cli(object): help=_("Install one or more packages to the system")) install.add_argument("package", nargs="+", help=_("Give name of at least one package to install")) - install.add_argument("--without-recommends", action="store_true", + install.add_argument("--without-recommended", action="store_true", help=_("Don't install recommended packages")) install.set_defaults(func=self.handle_install) @@ -264,7 +264,7 @@ class Cli(object): def handle_install(self, ns): p = self.pakfire(ns) - p.install(ns.package, include_recommended=not ns.without_recommends) + p.install(ns.package, without_recommended=not ns.without_recommended) def handle_reinstall(self, ns): with self.pakfire(ns) as p: