diff --git a/.gitignore b/.gitignore index 57c8351..b10b256 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -SOURCES/microdnf-3.4.0.tar.gz +SOURCES/microdnf-3.8.0.tar.gz diff --git a/.microdnf.metadata b/.microdnf.metadata index 39c4f11..b8749a3 100644 --- a/.microdnf.metadata +++ b/.microdnf.metadata @@ -1 +1 @@ -aff8076a31c3d7a7e7b204f03d8a522415a657a1 SOURCES/microdnf-3.4.0.tar.gz +c59c103e4cf88420e13dfd5ab9cc1558f0723227 SOURCES/microdnf-3.8.0.tar.gz diff --git a/SOURCES/0001-Add-module-enable-disable-reset-command.patch b/SOURCES/0001-Add-module-enable-disable-reset-command.patch deleted file mode 100644 index f53eee7..0000000 --- a/SOURCES/0001-Add-module-enable-disable-reset-command.patch +++ /dev/null @@ -1,997 +0,0 @@ -From fa7e624c50dbfc0e47c0466e47f2f6acd20a6dff Mon Sep 17 00:00:00 2001 -From: Jaroslav Rohel -Date: Fri, 30 Oct 2020 13:45:17 +0100 -Subject: [PATCH 1/5] Add subcommands support - -Plugins with a '_' character in command name will implement subcommands. -Needed for modularity subcommands. -E.g. the "command_module_enable" plugin will implement the "enable" -subcommand of the "module" command. ---- - dnf/dnf-main.c | 96 +++++++++++++++++++++++++++++++++++++++----------- - 1 file changed, 76 insertions(+), 20 deletions(-) - -diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c -index b6a5a69..6cb8c0e 100644 ---- a/dnf/dnf-main.c -+++ b/dnf/dnf-main.c -@@ -305,6 +305,33 @@ new_global_opt_group (DnfContext *ctx) - return opt_grp; - } - -+/* -+ * The first non-option is the command/subcommand. -+ * Get it and remove it from arguments. -+ */ -+static const gchar * -+get_command (int *argc, -+ char *argv[]) -+{ -+ const gchar *cmd_name = NULL; -+ for (gint in = 1; in < *argc; in++) -+ { -+ if (cmd_name != NULL) -+ argv[in-1] = argv[in]; -+ else if (argv[in][0] != '-') -+ cmd_name = argv[in]; -+ } -+ if (cmd_name != NULL) --*argc; -+ return cmd_name; -+} -+ -+static gint -+compare_strings (gconstpointer a, -+ gconstpointer b) -+{ -+ return strcmp (a, b); -+} -+ - int - main (int argc, - char *argv[]) -@@ -316,6 +343,7 @@ main (int argc, - g_autoptr(GOptionContext) opt_ctx = g_option_context_new ("COMMAND"); - g_autoptr(GOptionContext) subcmd_opt_ctx = NULL; - g_autofree gchar *subcmd_opt_param = NULL; -+ GSList *cmds_with_subcmds = NULL; /* list of commands with subcommands */ - - setlocale (LC_ALL, ""); - -@@ -353,11 +381,26 @@ main (int argc, - if (!peas_engine_load_plugin (engine, info)) - continue; - if (peas_engine_provides_extension (engine, info, DNF_TYPE_COMMAND)) -- /* -- * At least 2 spaces between the command and its description are needed -- * so that help2man formats it correctly. -- */ -- g_string_append_printf (cmd_summary, "\n %-16s %s", peas_plugin_info_get_name (info), peas_plugin_info_get_description (info)); -+ { -+ g_autofree gchar *command_name = g_strdup (peas_plugin_info_get_name (info)); -+ -+ /* Plugins with a '_' character in command name implement subcommands. -+ E.g. the "command_module_enable" plugin implements the "enable" subcommand of the "module" command. */ -+ for (gchar *ptr = command_name; *ptr != '\0'; ++ptr) -+ { -+ if (*ptr == '_') -+ { -+ *ptr = ' '; -+ cmds_with_subcmds = g_slist_append (cmds_with_subcmds, g_strndup (command_name, ptr - command_name)); -+ break; -+ } -+ } -+ /* -+ * At least 2 spaces between the command and its description are needed -+ * so that help2man formats it correctly. -+ */ -+ g_string_append_printf (cmd_summary, "\n %-16s %s", command_name, peas_plugin_info_get_description (info)); -+ } - } - g_option_context_set_summary (opt_ctx, cmd_summary->str); - g_string_free (cmd_summary, TRUE); -@@ -471,19 +514,7 @@ main (int argc, - } - } - -- /* -- * The first non-option is the command. -- * Get it and remove it from arguments. -- */ -- const gchar *cmd_name = NULL; -- for (gint in = 1; in < argc; in++) -- { -- if (cmd_name != NULL) -- argv[in-1] = argv[in]; -- else if (argv[in][0] != '-') -- cmd_name = argv[in]; -- } -- if (cmd_name != NULL) --argc; -+ const gchar *cmd_name = get_command (&argc, argv); - - g_option_context_set_help_enabled (opt_ctx, TRUE); - -@@ -500,10 +531,25 @@ main (int argc, - - PeasPluginInfo *plug = NULL; - PeasExtension *exten = NULL; -- if (cmd_name != NULL) -+ const gchar *subcmd_name = NULL; -+ gboolean with_subcmds = FALSE; -+ -+ /* Find the plugin that implements the command cmd_name or its subcommand. -+ * Command name (cmd_name) can not contain '_' character. It is reserved for subcomands. */ -+ if (cmd_name != NULL && strchr(cmd_name, '_') == NULL) - { -+ with_subcmds = g_slist_find_custom (cmds_with_subcmds, cmd_name, compare_strings) != NULL; - g_autofree gchar *mod_name = g_strdup_printf ("command_%s", cmd_name); - plug = peas_engine_get_plugin_info (engine, mod_name); -+ if (plug == NULL && with_subcmds) -+ { -+ subcmd_name = get_command (&argc, argv); -+ if (subcmd_name != NULL) -+ { -+ g_autofree gchar *submod_name = g_strdup_printf ("command_%s_%s", cmd_name, subcmd_name); -+ plug = peas_engine_get_plugin_info (engine, submod_name); -+ } -+ } - if (plug != NULL) - exten = peas_extension_set_get_extension (cmd_exts, plug); - } -@@ -513,10 +559,18 @@ main (int argc, - error = g_error_new_literal (G_IO_ERROR, - G_IO_ERROR_FAILED, - "No command specified"); -- else -+ else if (!with_subcmds) - error = g_error_new (G_IO_ERROR, - G_IO_ERROR_FAILED, - "Unknown command: '%s'", cmd_name); -+ else if (subcmd_name) -+ error = g_error_new (G_IO_ERROR, -+ G_IO_ERROR_FAILED, -+ "Unknown subcommand: '%s'", subcmd_name); -+ else -+ error = g_error_new (G_IO_ERROR, -+ G_IO_ERROR_FAILED, -+ "Missing subcommand for command: '%s'", cmd_name); - - g_autofree gchar *help = g_option_context_get_help (opt_ctx, TRUE, NULL); - g_printerr ("This is microdnf, which implements subset of `dnf'.\n" -@@ -533,6 +587,8 @@ main (int argc, - goto out; - - out: -+ g_slist_free_full(cmds_with_subcmds, g_free); -+ - if (error != NULL) - { - const gchar *prefix = ""; --- -2.26.2 - - -From 88a2b95ebdc424091b93c381623bdb458a368b48 Mon Sep 17 00:00:00 2001 -From: Jaroslav Rohel -Date: Fri, 30 Oct 2020 14:16:34 +0100 -Subject: [PATCH 2/5] Add "module enable" command - ---- - dnf/CMakeLists.txt | 9 +- - dnf/meson.build | 9 ++ - .../module_enable/dnf-command-module_enable.c | 97 +++++++++++++++++++ - .../dnf-command-module_enable.gresource.xml | 6 ++ - .../module_enable/dnf-command-module_enable.h | 33 +++++++ - .../module_enable/module_enable.plugin | 9 ++ - microdnf.spec | 2 +- - 7 files changed, 163 insertions(+), 2 deletions(-) - create mode 100644 dnf/plugins/module_enable/dnf-command-module_enable.c - create mode 100644 dnf/plugins/module_enable/dnf-command-module_enable.gresource.xml - create mode 100644 dnf/plugins/module_enable/dnf-command-module_enable.h - create mode 100644 dnf/plugins/module_enable/module_enable.plugin - -diff --git a/dnf/CMakeLists.txt b/dnf/CMakeLists.txt -index 0705390..b673ce4 100644 ---- a/dnf/CMakeLists.txt -+++ b/dnf/CMakeLists.txt -@@ -35,6 +35,12 @@ glib_compile_resources (DNF_COMMAND_CLEAN plugins/clean/dnf-command-clean.gresou - INTERNAL) - list (APPEND DNF_COMMAND_CLEAN "plugins/clean/dnf-command-clean.c") - -+glib_compile_resources (DNF_COMMAND_MODULE_ENABLE plugins/module_enable/dnf-command-module_enable.gresource.xml -+ C_PREFIX dnf_command_module_enable -+ INTERNAL) -+list (APPEND DNF_COMMAND_MODULE_ENABLE "plugins/module_enable/dnf-command-module_enable.c") -+ -+ - include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - add_executable (microdnf dnf-main.c ${DNF_SRCS} - ${DNF_COMMAND_INSTALL} -@@ -43,7 +49,8 @@ add_executable (microdnf dnf-main.c ${DNF_SRCS} - ${DNF_COMMAND_UPDATE} - ${DNF_COMMAND_REPOLIST} - ${DNF_COMMAND_REPOQUERY} -- ${DNF_COMMAND_CLEAN}) -+ ${DNF_COMMAND_CLEAN} -+ ${DNF_COMMAND_MODULE_ENABLE}) - - target_link_libraries (microdnf - ${GLIB_LIBRARIES} -diff --git a/dnf/meson.build b/dnf/meson.build -index 12e11ac..d617453 100644 ---- a/dnf/meson.build -+++ b/dnf/meson.build -@@ -65,6 +65,15 @@ microdnf_srcs = [ - source_dir : 'plugins/clean', - ), - 'plugins/clean/dnf-command-clean.c', -+ -+ # module enable -+ gnome.compile_resources( -+ 'dnf-module_enable', -+ 'plugins/module_enable/dnf-command-module_enable.gresource.xml', -+ c_name : 'dnf_command_module_enable', -+ source_dir : 'plugins/module_enable', -+ ), -+ 'plugins/module_enable/dnf-command-module_enable.c', - ] - - microdnf = executable( -diff --git a/dnf/plugins/module_enable/dnf-command-module_enable.c b/dnf/plugins/module_enable/dnf-command-module_enable.c -new file mode 100644 -index 0000000..3081042 ---- /dev/null -+++ b/dnf/plugins/module_enable/dnf-command-module_enable.c -@@ -0,0 +1,97 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "dnf-command-module_enable.h" -+#include "dnf-utils.h" -+ -+struct _DnfCommandModuleEnable -+{ -+ PeasExtensionBase parent_instance; -+}; -+ -+static void dnf_command_module_enable_iface_init (DnfCommandInterface *iface); -+ -+G_DEFINE_DYNAMIC_TYPE_EXTENDED (DnfCommandModuleEnable, -+ dnf_command_module_enable, -+ PEAS_TYPE_EXTENSION_BASE, -+ 0, -+ G_IMPLEMENT_INTERFACE (DNF_TYPE_COMMAND, -+ dnf_command_module_enable_iface_init)) -+ -+static void -+dnf_command_module_enable_init (DnfCommandModuleEnable *self) -+{ -+} -+ -+static gboolean -+dnf_command_module_enable_run (DnfCommand *cmd, -+ int argc, -+ char *argv[], -+ GOptionContext *opt_ctx, -+ DnfContext *ctx, -+ GError **error) -+{ -+ g_auto(GStrv) pkgs = NULL; -+ const GOptionEntry opts[] = { -+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &pkgs, NULL, NULL }, -+ { NULL } -+ }; -+ g_option_context_add_main_entries (opt_ctx, opts, NULL); -+ -+ if (!g_option_context_parse (opt_ctx, &argc, &argv, error)) -+ return FALSE; -+ -+ if (pkgs == NULL) -+ { -+ g_set_error_literal (error, -+ G_IO_ERROR, -+ G_IO_ERROR_FAILED, -+ "Modules are not specified"); -+ return FALSE; -+ } -+ -+ return dnf_context_enable_modules (ctx, (const char **)pkgs, error); -+} -+ -+static void -+dnf_command_module_enable_class_init (DnfCommandModuleEnableClass *klass) -+{ -+} -+ -+static void -+dnf_command_module_enable_iface_init (DnfCommandInterface *iface) -+{ -+ iface->run = dnf_command_module_enable_run; -+} -+ -+static void -+dnf_command_module_enable_class_finalize (DnfCommandModuleEnableClass *klass) -+{ -+} -+ -+G_MODULE_EXPORT void -+dnf_command_module_enable_register_types (PeasObjectModule *module) -+{ -+ dnf_command_module_enable_register_type (G_TYPE_MODULE (module)); -+ -+ peas_object_module_register_extension_type (module, -+ DNF_TYPE_COMMAND, -+ DNF_TYPE_COMMAND_MODULE_ENABLE); -+} -diff --git a/dnf/plugins/module_enable/dnf-command-module_enable.gresource.xml b/dnf/plugins/module_enable/dnf-command-module_enable.gresource.xml -new file mode 100644 -index 0000000..4b99047 ---- /dev/null -+++ b/dnf/plugins/module_enable/dnf-command-module_enable.gresource.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ module_enable.plugin -+ -+ -diff --git a/dnf/plugins/module_enable/dnf-command-module_enable.h b/dnf/plugins/module_enable/dnf-command-module_enable.h -new file mode 100644 -index 0000000..d489331 ---- /dev/null -+++ b/dnf/plugins/module_enable/dnf-command-module_enable.h -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#pragma once -+ -+#include "dnf-command.h" -+#include -+ -+G_BEGIN_DECLS -+ -+#define DNF_TYPE_COMMAND_MODULE_ENABLE dnf_command_module_enable_get_type () -+G_DECLARE_FINAL_TYPE (DnfCommandModuleEnable, dnf_command_module_enable, DNF, COMMAND_MODULE_ENABLE, PeasExtensionBase) -+ -+G_MODULE_EXPORT void dnf_command_module_enable_register_types (PeasObjectModule *module); -+ -+G_END_DECLS -diff --git a/dnf/plugins/module_enable/module_enable.plugin b/dnf/plugins/module_enable/module_enable.plugin -new file mode 100644 -index 0000000..91da9fb ---- /dev/null -+++ b/dnf/plugins/module_enable/module_enable.plugin -@@ -0,0 +1,9 @@ -+[Plugin] -+Module = command_module_enable -+Embedded = dnf_command_module_enable_register_types -+Name = module_enable -+Description = Enable a module stream -+Authors = Jaroslav Rohel -+License = GPL-3.0+ -+Copyright = Copyright (C) 2020 Red Hat, Inc. -+X-Command-Syntax = module enable module-spec [module-spec…] -diff --git a/microdnf.spec b/microdnf.spec -index db8e35e..3648e46 100644 ---- a/microdnf.spec -+++ b/microdnf.spec -@@ -1,4 +1,4 @@ --%global libdnf_version 0.43.1 -+%global libdnf_version 0.55.0 - - Name: microdnf - Version: 3.4.0 --- -2.26.2 - - -From 7cc7bb7202cb79d6bb6daa63e32109134c273627 Mon Sep 17 00:00:00 2001 -From: Jaroslav Mracek -Date: Fri, 23 Oct 2020 16:04:48 +0200 -Subject: [PATCH 3/5] Add reports of module changes - ---- - dnf/dnf-utils.c | 16 ++++++++++++++-- - 1 file changed, 14 insertions(+), 2 deletions(-) - -diff --git a/dnf/dnf-utils.c b/dnf/dnf-utils.c -index c58f519..5984f22 100644 ---- a/dnf/dnf-utils.c -+++ b/dnf/dnf-utils.c -@@ -68,8 +68,15 @@ dnf_utils_print_transaction (DnfContext *ctx) - - if (pkgs->len == 0) - { -- g_print ("Nothing to do.\n"); -- return FALSE; -+ g_autofree char * report = dnf_context_get_module_report (ctx); -+ if (report) -+ { -+ g_print ("%s\n", report); -+ return TRUE; -+ } else { -+ g_print ("Nothing to do.\n"); -+ return FALSE; -+ } - } - - struct libscols_line *ln; -@@ -147,6 +154,11 @@ dnf_utils_print_transaction (DnfContext *ctx) - g_print (" %-15s %4d packages\n", "Removing:", pkgs_remove->len); - g_print (" %-15s %4d packages\n", "Downgrading:", pkgs_downgrade->len); - -+ g_autofree char * report = dnf_context_get_module_report (ctx); -+ if (report) -+ { -+ g_print ("%s\n", report); -+ } - /* check for test mode */ - DnfTransaction *txn = dnf_context_get_transaction (ctx); - if (dnf_transaction_get_flags (txn) & DNF_TRANSACTION_FLAG_TEST) --- -2.26.2 - - -From 6c4dceac5012231923187c3bbb16de4bda23789c Mon Sep 17 00:00:00 2001 -From: Jaroslav Mracek -Date: Mon, 2 Nov 2020 12:05:01 +0100 -Subject: [PATCH 4/5] Allow to commit module changes and report module switch - as an error - ---- - .../module_enable/dnf-command-module_enable.c | 28 ++++++++++++++++++- - 1 file changed, 27 insertions(+), 1 deletion(-) - -diff --git a/dnf/plugins/module_enable/dnf-command-module_enable.c b/dnf/plugins/module_enable/dnf-command-module_enable.c -index 3081042..a5a4701 100644 ---- a/dnf/plugins/module_enable/dnf-command-module_enable.c -+++ b/dnf/plugins/module_enable/dnf-command-module_enable.c -@@ -67,7 +67,33 @@ dnf_command_module_enable_run (DnfCommand *cmd, - return FALSE; - } - -- return dnf_context_enable_modules (ctx, (const char **)pkgs, error); -+ if (!dnf_context_module_enable (ctx, (const char **)pkgs, error)) -+ { -+ return FALSE; -+ } -+ if (!dnf_context_module_switched_check (ctx, error)) -+ { -+ return FALSE; -+ } -+ -+ if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), DNF_NONE, error)) -+ { -+ if (g_error_matches (*error, DNF_ERROR, DNF_ERROR_NO_PACKAGES_TO_UPDATE)) -+ { -+ g_clear_error (error); -+ } else { -+ return FALSE; -+ } -+ } -+ if (!dnf_utils_print_transaction (ctx)) -+ { -+ return TRUE; -+ } -+ if (!dnf_context_run (ctx, NULL, error)) -+ { -+ return FALSE; -+ } -+ return TRUE; - } - - static void --- -2.26.2 - - -From 6c86306c9c0725c73c3d4ec704f932e372e09585 Mon Sep 17 00:00:00 2001 -From: Jaroslav Mracek -Date: Mon, 2 Nov 2020 15:17:29 +0100 -Subject: [PATCH 5/5] Add module enable and disable commands - ---- - dnf/CMakeLists.txt | 14 +- - dnf/meson.build | 18 +++ - .../dnf-command-module_disable.c | 119 +++++++++++++++++ - .../dnf-command-module_disable.gresource.xml | 6 + - .../dnf-command-module_disable.h | 33 +++++ - .../module_disable/module_disable.plugin | 9 ++ - .../module_reset/dnf-command-module_reset.c | 123 ++++++++++++++++++ - .../dnf-command-module_reset.gresource.xml | 6 + - .../module_reset/dnf-command-module_reset.h | 33 +++++ - dnf/plugins/module_reset/module_reset.plugin | 9 ++ - 10 files changed, 369 insertions(+), 1 deletion(-) - create mode 100644 dnf/plugins/module_disable/dnf-command-module_disable.c - create mode 100644 dnf/plugins/module_disable/dnf-command-module_disable.gresource.xml - create mode 100644 dnf/plugins/module_disable/dnf-command-module_disable.h - create mode 100644 dnf/plugins/module_disable/module_disable.plugin - create mode 100644 dnf/plugins/module_reset/dnf-command-module_reset.c - create mode 100644 dnf/plugins/module_reset/dnf-command-module_reset.gresource.xml - create mode 100644 dnf/plugins/module_reset/dnf-command-module_reset.h - create mode 100644 dnf/plugins/module_reset/module_reset.plugin - -diff --git a/dnf/CMakeLists.txt b/dnf/CMakeLists.txt -index b673ce4..1d640be 100644 ---- a/dnf/CMakeLists.txt -+++ b/dnf/CMakeLists.txt -@@ -40,6 +40,16 @@ glib_compile_resources (DNF_COMMAND_MODULE_ENABLE plugins/module_enable/dnf-comm - INTERNAL) - list (APPEND DNF_COMMAND_MODULE_ENABLE "plugins/module_enable/dnf-command-module_enable.c") - -+glib_compile_resources (DNF_COMMAND_MODULE_DISABLE plugins/module_disable/dnf-command-module_disable.gresource.xml -+ C_PREFIX dnf_command_module_disable -+ INTERNAL) -+list (APPEND DNF_COMMAND_MODULE_DISABLE "plugins/module_disable/dnf-command-module_disable.c") -+ -+glib_compile_resources (DNF_COMMAND_MODULE_RESET plugins/module_reset/dnf-command-module_reset.gresource.xml -+ C_PREFIX dnf_command_module_reset -+ INTERNAL) -+list (APPEND DNF_COMMAND_MODULE_RESET "plugins/module_reset/dnf-command-module_reset.c") -+ - - include_directories (${CMAKE_CURRENT_SOURCE_DIR}) - add_executable (microdnf dnf-main.c ${DNF_SRCS} -@@ -50,7 +60,9 @@ add_executable (microdnf dnf-main.c ${DNF_SRCS} - ${DNF_COMMAND_REPOLIST} - ${DNF_COMMAND_REPOQUERY} - ${DNF_COMMAND_CLEAN} -- ${DNF_COMMAND_MODULE_ENABLE}) -+ ${DNF_COMMAND_MODULE_ENABLE} -+ ${DNF_COMMAND_MODULE_DISABLE} -+ ${DNF_COMMAND_MODULE_RESET}) - - target_link_libraries (microdnf - ${GLIB_LIBRARIES} -diff --git a/dnf/meson.build b/dnf/meson.build -index d617453..b456202 100644 ---- a/dnf/meson.build -+++ b/dnf/meson.build -@@ -74,6 +74,24 @@ microdnf_srcs = [ - source_dir : 'plugins/module_enable', - ), - 'plugins/module_enable/dnf-command-module_enable.c', -+ -+ # module disable -+ gnome.compile_resources( -+ 'dnf-module_disable', -+ 'plugins/module_disable/dnf-command-module_disable.gresource.xml', -+ c_name : 'dnf_command_module_disable', -+ source_dir : 'plugins/module_disable', -+ ), -+ 'plugins/module_disable/dnf-command-module_disable.c', -+ -+ # module reset -+ gnome.compile_resources( -+ 'dnf-module_reset', -+ 'plugins/module_reset/dnf-command-module_reset.gresource.xml', -+ c_name : 'dnf_command_module_reset', -+ source_dir : 'plugins/module_reset', -+ ), -+ 'plugins/module_reset/dnf-command-module_reset.c', - ] - - microdnf = executable( -diff --git a/dnf/plugins/module_disable/dnf-command-module_disable.c b/dnf/plugins/module_disable/dnf-command-module_disable.c -new file mode 100644 -index 0000000..eedb77c ---- /dev/null -+++ b/dnf/plugins/module_disable/dnf-command-module_disable.c -@@ -0,0 +1,119 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "dnf-command-module_disable.h" -+#include "dnf-utils.h" -+ -+struct _DnfCommandModuleDisable -+{ -+ PeasExtensionBase parent_instance; -+}; -+ -+static void dnf_command_module_disable_iface_init (DnfCommandInterface *iface); -+ -+G_DEFINE_DYNAMIC_TYPE_EXTENDED (DnfCommandModuleDisable, -+ dnf_command_module_disable, -+ PEAS_TYPE_EXTENSION_BASE, -+ 0, -+ G_IMPLEMENT_INTERFACE (DNF_TYPE_COMMAND, -+ dnf_command_module_disable_iface_init)) -+ -+static void -+dnf_command_module_disable_init (DnfCommandModuleDisable *self) -+{ -+} -+ -+static gboolean -+dnf_command_module_disable_run (DnfCommand *cmd, -+ int argc, -+ char *argv[], -+ GOptionContext *opt_ctx, -+ DnfContext *ctx, -+ GError **error) -+{ -+ g_auto(GStrv) pkgs = NULL; -+ const GOptionEntry opts[] = { -+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &pkgs, NULL, NULL }, -+ { NULL } -+ }; -+ g_option_context_add_main_entries (opt_ctx, opts, NULL); -+ -+ if (!g_option_context_parse (opt_ctx, &argc, &argv, error)) -+ return FALSE; -+ -+ if (pkgs == NULL) -+ { -+ g_set_error_literal (error, -+ G_IO_ERROR, -+ G_IO_ERROR_FAILED, -+ "Modules are not specified"); -+ return FALSE; -+ } -+ -+ if (!dnf_context_module_disable (ctx, (const char **)pkgs, error)) -+ { -+ return FALSE; -+ } -+ -+ if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), DNF_NONE, error)) -+ { -+ if (g_error_matches (*error, DNF_ERROR, DNF_ERROR_NO_PACKAGES_TO_UPDATE)) -+ { -+ g_clear_error (error); -+ } else { -+ return FALSE; -+ } -+ } -+ if (!dnf_utils_print_transaction (ctx)) -+ { -+ return TRUE; -+ } -+ if (!dnf_context_run (ctx, NULL, error)) -+ { -+ return FALSE; -+ } -+ return TRUE; -+} -+ -+static void -+dnf_command_module_disable_class_init (DnfCommandModuleDisableClass *klass) -+{ -+} -+ -+static void -+dnf_command_module_disable_iface_init (DnfCommandInterface *iface) -+{ -+ iface->run = dnf_command_module_disable_run; -+} -+ -+static void -+dnf_command_module_disable_class_finalize (DnfCommandModuleDisableClass *klass) -+{ -+} -+ -+G_MODULE_EXPORT void -+dnf_command_module_disable_register_types (PeasObjectModule *module) -+{ -+ dnf_command_module_disable_register_type (G_TYPE_MODULE (module)); -+ -+ peas_object_module_register_extension_type (module, -+ DNF_TYPE_COMMAND, -+ DNF_TYPE_COMMAND_MODULE_DISABLE); -+} -diff --git a/dnf/plugins/module_disable/dnf-command-module_disable.gresource.xml b/dnf/plugins/module_disable/dnf-command-module_disable.gresource.xml -new file mode 100644 -index 0000000..50a1295 ---- /dev/null -+++ b/dnf/plugins/module_disable/dnf-command-module_disable.gresource.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ module_disable.plugin -+ -+ -diff --git a/dnf/plugins/module_disable/dnf-command-module_disable.h b/dnf/plugins/module_disable/dnf-command-module_disable.h -new file mode 100644 -index 0000000..55f1786 ---- /dev/null -+++ b/dnf/plugins/module_disable/dnf-command-module_disable.h -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#pragma once -+ -+#include "dnf-command.h" -+#include -+ -+G_BEGIN_DECLS -+ -+#define DNF_TYPE_COMMAND_MODULE_DISABLE dnf_command_module_disable_get_type () -+G_DECLARE_FINAL_TYPE (DnfCommandModuleDisable, dnf_command_module_disable, DNF, COMMAND_MODULE_DISABLE, PeasExtensionBase) -+ -+G_MODULE_EXPORT void dnf_command_module_disable_register_types (PeasObjectModule *module); -+ -+G_END_DECLS -diff --git a/dnf/plugins/module_disable/module_disable.plugin b/dnf/plugins/module_disable/module_disable.plugin -new file mode 100644 -index 0000000..fc1d912 ---- /dev/null -+++ b/dnf/plugins/module_disable/module_disable.plugin -@@ -0,0 +1,9 @@ -+[Plugin] -+Module = command_module_disable -+Embedded = dnf_command_module_disable_register_types -+Name = module_disable -+Description = Disable a module stream -+Authors = Jaroslav Mracek -+License = GPL-3.0+ -+Copyright = Copyright (C) 2020 Red Hat, Inc. -+X-Command-Syntax = module disable module-spec [module-spec…] -diff --git a/dnf/plugins/module_reset/dnf-command-module_reset.c b/dnf/plugins/module_reset/dnf-command-module_reset.c -new file mode 100644 -index 0000000..912c53e ---- /dev/null -+++ b/dnf/plugins/module_reset/dnf-command-module_reset.c -@@ -0,0 +1,123 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#include "dnf-command-module_reset.h" -+#include "dnf-utils.h" -+ -+struct _DnfCommandModuleReset -+{ -+ PeasExtensionBase parent_instance; -+}; -+ -+static void dnf_command_module_reset_iface_init (DnfCommandInterface *iface); -+ -+G_DEFINE_DYNAMIC_TYPE_EXTENDED (DnfCommandModuleReset, -+ dnf_command_module_reset, -+ PEAS_TYPE_EXTENSION_BASE, -+ 0, -+ G_IMPLEMENT_INTERFACE (DNF_TYPE_COMMAND, -+ dnf_command_module_reset_iface_init)) -+ -+static void -+dnf_command_module_reset_init (DnfCommandModuleReset *self) -+{ -+} -+ -+static gboolean -+dnf_command_module_reset_run (DnfCommand *cmd, -+ int argc, -+ char *argv[], -+ GOptionContext *opt_ctx, -+ DnfContext *ctx, -+ GError **error) -+{ -+ g_auto(GStrv) pkgs = NULL; -+ const GOptionEntry opts[] = { -+ { G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &pkgs, NULL, NULL }, -+ { NULL } -+ }; -+ g_option_context_add_main_entries (opt_ctx, opts, NULL); -+ -+ if (!g_option_context_parse (opt_ctx, &argc, &argv, error)) -+ return FALSE; -+ -+ if (pkgs == NULL) -+ { -+ g_set_error_literal (error, -+ G_IO_ERROR, -+ G_IO_ERROR_FAILED, -+ "Modules are not specified"); -+ return FALSE; -+ } -+ -+ if (!dnf_context_module_reset (ctx, (const char **)pkgs, error)) -+ { -+ return FALSE; -+ } -+ if (!dnf_context_module_switched_check (ctx, error)) -+ { -+ return FALSE; -+ } -+ -+ if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), DNF_NONE, error)) -+ { -+ if (g_error_matches (*error, DNF_ERROR, DNF_ERROR_NO_PACKAGES_TO_UPDATE)) -+ { -+ g_clear_error (error); -+ } else { -+ return FALSE; -+ } -+ } -+ if (!dnf_utils_print_transaction (ctx)) -+ { -+ return TRUE; -+ } -+ if (!dnf_context_run (ctx, NULL, error)) -+ { -+ return FALSE; -+ } -+ return TRUE; -+} -+ -+static void -+dnf_command_module_reset_class_init (DnfCommandModuleResetClass *klass) -+{ -+} -+ -+static void -+dnf_command_module_reset_iface_init (DnfCommandInterface *iface) -+{ -+ iface->run = dnf_command_module_reset_run; -+} -+ -+static void -+dnf_command_module_reset_class_finalize (DnfCommandModuleResetClass *klass) -+{ -+} -+ -+G_MODULE_EXPORT void -+dnf_command_module_reset_register_types (PeasObjectModule *module) -+{ -+ dnf_command_module_reset_register_type (G_TYPE_MODULE (module)); -+ -+ peas_object_module_register_extension_type (module, -+ DNF_TYPE_COMMAND, -+ DNF_TYPE_COMMAND_MODULE_RESET); -+} -diff --git a/dnf/plugins/module_reset/dnf-command-module_reset.gresource.xml b/dnf/plugins/module_reset/dnf-command-module_reset.gresource.xml -new file mode 100644 -index 0000000..27e3b15 ---- /dev/null -+++ b/dnf/plugins/module_reset/dnf-command-module_reset.gresource.xml -@@ -0,0 +1,6 @@ -+ -+ -+ -+ module_reset.plugin -+ -+ -diff --git a/dnf/plugins/module_reset/dnf-command-module_reset.h b/dnf/plugins/module_reset/dnf-command-module_reset.h -new file mode 100644 -index 0000000..65dcd47 ---- /dev/null -+++ b/dnf/plugins/module_reset/dnf-command-module_reset.h -@@ -0,0 +1,33 @@ -+/* -+ * Copyright (C) 2020 Red Hat, Inc. -+ * -+ * Licensed under the GNU Lesser General Public License Version 2.1 -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library 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 -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+ */ -+ -+#pragma once -+ -+#include "dnf-command.h" -+#include -+ -+G_BEGIN_DECLS -+ -+#define DNF_TYPE_COMMAND_MODULE_RESET dnf_command_module_reset_get_type () -+G_DECLARE_FINAL_TYPE (DnfCommandModuleReset, dnf_command_module_reset, DNF, COMMAND_MODULE_RESET, PeasExtensionBase) -+ -+G_MODULE_EXPORT void dnf_command_module_reset_register_types (PeasObjectModule *module); -+ -+G_END_DECLS -diff --git a/dnf/plugins/module_reset/module_reset.plugin b/dnf/plugins/module_reset/module_reset.plugin -new file mode 100644 -index 0000000..c680f08 ---- /dev/null -+++ b/dnf/plugins/module_reset/module_reset.plugin -@@ -0,0 +1,9 @@ -+[Plugin] -+Module = command_module_reset -+Embedded = dnf_command_module_reset_register_types -+Name = module_reset -+Description = Reset a module stream -+Authors = Jaroslav Mracek -+License = GPL-3.0+ -+Copyright = Copyright (C) 2020 Red Hat, Inc. -+X-Command-Syntax = module reset module-spec [module-spec…] --- -2.26.2 - diff --git a/SOURCES/0001-Revert-Dont-set-default-value-of-assumeyes-to-TRUE.patch b/SOURCES/0001-Revert-Dont-set-default-value-of-assumeyes-to-TRUE.patch new file mode 100644 index 0000000..66574df --- /dev/null +++ b/SOURCES/0001-Revert-Dont-set-default-value-of-assumeyes-to-TRUE.patch @@ -0,0 +1,41 @@ +From f60d1b6930b4602a24ae2ce4078795268384c87d Mon Sep 17 00:00:00 2001 +From: Pavla Kratochvilova +Date: Thu, 20 May 2021 11:06:27 +0200 +Subject: [PATCH] Revert "Don't set default value of "assumeyes" to TRUE" + +This reverts commit 9e028a51fea6eceee0de6e155374a0bd81289e14. +--- + dnf/dnf-main.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c +index 661dfee..cfaf714 100644 +--- a/dnf/dnf-main.c ++++ b/dnf/dnf-main.c +@@ -595,6 +595,14 @@ main (int argc, + { + dnf_conf_main_set_option ("assumeyes", DNF_CONF_COMMANDLINE, "1", NULL); + } ++ else ++ { ++ enum DnfConfPriority priority; ++ dnf_utils_conf_main_get_bool_opt ("assumeyes", &priority); ++ /* microdnf has a default value for "assumeyes" equal to TRUE, backward compatibility */ ++ if (priority == DNF_CONF_DEFAULT) ++ dnf_conf_main_set_option ("assumeyes", DNF_CONF_COMMANDLINE, "1", NULL); ++ } + } + + const gchar *cmd_name = get_command (&argc, argv); +@@ -609,6 +617,8 @@ main (int argc, + g_set_prgname (prg_name); + g_autofree gchar *help = g_option_context_get_help (opt_ctx, TRUE, NULL); + g_print ("%s", help); ++ g_print ("Notes:\n"); ++ g_print (" The \"--assumeyes\" option is turned on by default. To switch it to an interactive prompt, specify \"assumeyes=0\" in the configuration file.\n\n"); + goto out; + } + +-- +libgit2 1.0.1 + diff --git a/SOURCES/0002-Add-support-for-setting-a-platform-module-ID.patch b/SOURCES/0002-Add-support-for-setting-a-platform-module-ID.patch deleted file mode 100644 index ef0d380..0000000 --- a/SOURCES/0002-Add-support-for-setting-a-platform-module-ID.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 4f9a7a0eda7b5d30a5697b07809fc1a93cb976d1 Mon Sep 17 00:00:00 2001 -From: Neal Gompa -Date: Fri, 20 Nov 2020 06:01:16 -0500 -Subject: [PATCH] Add support for setting a platform module ID - -Now that Micro DNF supports modularity, we need to be able to selectively -override what it detects as the platform module when working with -installroots that have modular content when they differ from the host. - -nsella -Note: the commit 7419ab465a04af525e39005e33ff869647c6bde2 was omitted ---- - dnf/dnf-main.c | 16 +++++++++++++++- - 1 file changed, 15 insertions(+), 1 deletion(-) - -diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c -index 6cb8c0e..2ea3d76 100644 ---- a/dnf/dnf-main.c -+++ b/dnf/dnf-main.c -@@ -131,6 +131,20 @@ process_global_option (const gchar *option_name, - } - } - } -+ else if (strcmp (setopt[0], "module_platform_id") == 0) -+ { -+ const char *module_platform_id = setopt[1]; -+ if (module_platform_id[0] != '\0') -+ { -+ dnf_context_set_platform_module (ctx, module_platform_id); -+ } -+ else -+ { -+ local_error = g_error_new (G_OPTION_ERROR, G_OPTION_ERROR_BAD_VALUE, -+ "Empty value in: %s", value); -+ ret = FALSE; -+ } -+ } - else if (strcmp (setopt[0], "cachedir") == 0) - { - cachedir_used = TRUE; -@@ -212,7 +226,7 @@ static const GOptionEntry global_opts[] = { - { "refresh", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_refresh, "Set metadata as expired before running the command", NULL }, - { "releasever", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Override the value of $releasever in config and repo files", "RELEASEVER" }, - { "setopt", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, -- "Override a configuration option (install_weak_deps=0/1, cachedir=, reposdir=,,..., tsflags=nodocs/test, varsdir=,,...)", "