|
|
94e8a5 |
From 88602163094d654451a9586121aa8ff6fd7c96b0 Mon Sep 17 00:00:00 2001
|
|
|
94e8a5 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
94e8a5 |
Date: Wed, 23 Oct 2019 13:14:45 +0200
|
|
|
94e8a5 |
Subject: [PATCH 1/3] Add option best for transactions (RhBug:1679476)
|
|
|
94e8a5 |
|
|
|
94e8a5 |
It adds option `--best` plus default is handled from libdnf.conf and
|
|
|
94e8a5 |
dnf.conf
|
|
|
94e8a5 |
|
|
|
94e8a5 |
https://bugzilla.redhat.com/show_bug.cgi?id=1679476
|
|
|
94e8a5 |
---
|
|
|
94e8a5 |
dnf/dnf-main.c | 7 ++++++-
|
|
|
94e8a5 |
dnf/plugins/install/dnf-command-install.c | 7 ++++++-
|
|
|
94e8a5 |
dnf/plugins/update/dnf-command-update.c | 8 ++++++--
|
|
|
94e8a5 |
3 files changed, 18 insertions(+), 4 deletions(-)
|
|
|
94e8a5 |
|
|
|
94e8a5 |
diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c
|
|
|
94e8a5 |
index 693ad7f..0dce9b2 100644
|
|
|
94e8a5 |
--- a/dnf/dnf-main.c
|
|
|
94e8a5 |
+++ b/dnf/dnf-main.c
|
|
|
94e8a5 |
@@ -28,6 +28,7 @@
|
|
|
94e8a5 |
|
|
|
94e8a5 |
static gboolean opt_yes = TRUE;
|
|
|
94e8a5 |
static gboolean opt_nodocs = FALSE;
|
|
|
94e8a5 |
+static gboolean opt_best = FALSE;
|
|
|
94e8a5 |
static gboolean show_help = FALSE;
|
|
|
94e8a5 |
static gboolean dl_pkgs_printed = FALSE;
|
|
|
94e8a5 |
static GSList *enable_disable_repos = NULL;
|
|
|
94e8a5 |
@@ -82,6 +83,7 @@ process_global_option (const gchar *option_name,
|
|
|
94e8a5 |
|
|
|
94e8a5 |
static const GOptionEntry global_opts[] = {
|
|
|
94e8a5 |
{ "assumeyes", 'y', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &opt_yes, "Does nothing, we always assume yes", NULL },
|
|
|
94e8a5 |
+ { "best", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_best, "Try the best available package versions in transactions", NULL },
|
|
|
94e8a5 |
{ "disablerepo", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Disable repository by an id", "ID" },
|
|
|
94e8a5 |
{ "enablerepo", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Enable repository by an id", "ID" },
|
|
|
94e8a5 |
{ "nodocs", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_nodocs, "Install packages without docs", NULL },
|
|
|
94e8a5 |
@@ -283,7 +285,10 @@ main (int argc,
|
|
|
94e8a5 |
|
|
|
94e8a5 |
dnf_transaction_set_flags (txn, flags);
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
-
|
|
|
94e8a5 |
+ if (!show_help && opt_best)
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ dnf_context_set_best(opt_best);
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
/*
|
|
|
94e8a5 |
* The first non-option is the command.
|
|
|
94e8a5 |
* Get it and remove it from arguments.
|
|
|
94e8a5 |
diff --git a/dnf/plugins/install/dnf-command-install.c b/dnf/plugins/install/dnf-command-install.c
|
|
|
94e8a5 |
index ea549da..0b2f5e5 100644
|
|
|
94e8a5 |
--- a/dnf/plugins/install/dnf-command-install.c
|
|
|
94e8a5 |
+++ b/dnf/plugins/install/dnf-command-install.c
|
|
|
94e8a5 |
@@ -73,7 +73,12 @@ dnf_command_install_run (DnfCommand *cmd,
|
|
|
94e8a5 |
if (!dnf_context_install (ctx, *pkg, error))
|
|
|
94e8a5 |
return FALSE;
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
- if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), DNF_INSTALL, error))
|
|
|
94e8a5 |
+ DnfGoalActions flags = DNF_INSTALL;
|
|
|
94e8a5 |
+ if (dnf_context_get_best())
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ flags |= DNF_FORCE_BEST;
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
+ if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), flags, error))
|
|
|
94e8a5 |
return FALSE;
|
|
|
94e8a5 |
if (!dnf_utils_print_transaction (ctx))
|
|
|
94e8a5 |
return TRUE;
|
|
|
94e8a5 |
diff --git a/dnf/plugins/update/dnf-command-update.c b/dnf/plugins/update/dnf-command-update.c
|
|
|
94e8a5 |
index 652d902..7bf1334 100644
|
|
|
94e8a5 |
--- a/dnf/plugins/update/dnf-command-update.c
|
|
|
94e8a5 |
+++ b/dnf/plugins/update/dnf-command-update.c
|
|
|
94e8a5 |
@@ -70,8 +70,12 @@ dnf_command_update_run (DnfCommand *cmd,
|
|
|
94e8a5 |
return FALSE;
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
-
|
|
|
94e8a5 |
- if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), 0, error))
|
|
|
94e8a5 |
+ DnfGoalActions flags = 0;
|
|
|
94e8a5 |
+ if (dnf_context_get_best())
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ flags |= DNF_FORCE_BEST;
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
+ if (!dnf_goal_depsolve (dnf_context_get_goal (ctx), flags, error))
|
|
|
94e8a5 |
return FALSE;
|
|
|
94e8a5 |
if (!dnf_utils_print_transaction (ctx))
|
|
|
94e8a5 |
return TRUE;
|
|
|
94e8a5 |
--
|
|
|
94e8a5 |
2.21.0
|
|
|
94e8a5 |
|
|
|
94e8a5 |
|
|
|
94e8a5 |
From 6a4a490d368fc7982264f8ab898e4bd195576b30 Mon Sep 17 00:00:00 2001
|
|
|
94e8a5 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
94e8a5 |
Date: Wed, 23 Oct 2019 13:15:17 +0200
|
|
|
94e8a5 |
Subject: [PATCH 2/3] Initialized to use tito.
|
|
|
94e8a5 |
|
|
|
94e8a5 |
---
|
|
|
94e8a5 |
.tito/packages/.readme | 3 +++
|
|
|
94e8a5 |
.tito/tito.props | 5 +++++
|
|
|
94e8a5 |
2 files changed, 8 insertions(+)
|
|
|
94e8a5 |
create mode 100644 .tito/packages/.readme
|
|
|
94e8a5 |
create mode 100644 .tito/tito.props
|
|
|
94e8a5 |
|
|
|
94e8a5 |
diff --git a/.tito/packages/.readme b/.tito/packages/.readme
|
|
|
94e8a5 |
new file mode 100644
|
|
|
94e8a5 |
index 0000000..b9411e2
|
|
|
94e8a5 |
--- /dev/null
|
|
|
94e8a5 |
+++ b/.tito/packages/.readme
|
|
|
94e8a5 |
@@ -0,0 +1,3 @@
|
|
|
94e8a5 |
+the .tito/packages directory contains metadata files
|
|
|
94e8a5 |
+named after their packages. Each file has the latest tagged
|
|
|
94e8a5 |
+version and the project's relative directory.
|
|
|
94e8a5 |
diff --git a/.tito/tito.props b/.tito/tito.props
|
|
|
94e8a5 |
new file mode 100644
|
|
|
94e8a5 |
index 0000000..eab3f19
|
|
|
94e8a5 |
--- /dev/null
|
|
|
94e8a5 |
+++ b/.tito/tito.props
|
|
|
94e8a5 |
@@ -0,0 +1,5 @@
|
|
|
94e8a5 |
+[buildconfig]
|
|
|
94e8a5 |
+builder = tito.builder.Builder
|
|
|
94e8a5 |
+tagger = tito.tagger.VersionTagger
|
|
|
94e8a5 |
+changelog_do_not_remove_cherrypick = 0
|
|
|
94e8a5 |
+changelog_format = %s (%ae)
|
|
|
94e8a5 |
--
|
|
|
94e8a5 |
2.21.0
|
|
|
94e8a5 |
|
|
|
94e8a5 |
|
|
|
94e8a5 |
From 4af6a4c76e7bce0ce06188319b0b4c21a235266c Mon Sep 17 00:00:00 2001
|
|
|
94e8a5 |
From: Jaroslav Mracek <jmracek@redhat.com>
|
|
|
94e8a5 |
Date: Wed, 23 Oct 2019 15:07:55 +0200
|
|
|
94e8a5 |
Subject: [PATCH 3/3] Add option --nobest
|
|
|
94e8a5 |
|
|
|
94e8a5 |
It is used to overwrite configuration of best option. It is useful when
|
|
|
94e8a5 |
best=True is default.
|
|
|
94e8a5 |
---
|
|
|
94e8a5 |
dnf/dnf-main.c | 22 ++++++++++++++++++----
|
|
|
94e8a5 |
1 file changed, 18 insertions(+), 4 deletions(-)
|
|
|
94e8a5 |
|
|
|
94e8a5 |
diff --git a/dnf/dnf-main.c b/dnf/dnf-main.c
|
|
|
94e8a5 |
index 0dce9b2..4f19489 100644
|
|
|
94e8a5 |
--- a/dnf/dnf-main.c
|
|
|
94e8a5 |
+++ b/dnf/dnf-main.c
|
|
|
94e8a5 |
@@ -29,6 +29,7 @@
|
|
|
94e8a5 |
static gboolean opt_yes = TRUE;
|
|
|
94e8a5 |
static gboolean opt_nodocs = FALSE;
|
|
|
94e8a5 |
static gboolean opt_best = FALSE;
|
|
|
94e8a5 |
+static gboolean opt_nobest = FALSE;
|
|
|
94e8a5 |
static gboolean show_help = FALSE;
|
|
|
94e8a5 |
static gboolean dl_pkgs_printed = FALSE;
|
|
|
94e8a5 |
static GSList *enable_disable_repos = NULL;
|
|
|
94e8a5 |
@@ -86,6 +87,7 @@ static const GOptionEntry global_opts[] = {
|
|
|
94e8a5 |
{ "best", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_best, "Try the best available package versions in transactions", NULL },
|
|
|
94e8a5 |
{ "disablerepo", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Disable repository by an id", "ID" },
|
|
|
94e8a5 |
{ "enablerepo", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Enable repository by an id", "ID" },
|
|
|
94e8a5 |
+ { "nobest", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_nobest, "Do not limit the transaction to the best candidates", NULL },
|
|
|
94e8a5 |
{ "nodocs", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_NONE, &opt_nodocs, "Install packages without docs", NULL },
|
|
|
94e8a5 |
{ "releasever", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Override the value of $releasever in config and repo files", "RELEASEVER" },
|
|
|
94e8a5 |
{ "setopt", '\0', G_OPTION_FLAG_NONE, G_OPTION_ARG_CALLBACK, process_global_option, "Set transaction flag, like tsflags=nodocs", "FLAG" },
|
|
|
94e8a5 |
@@ -284,11 +286,23 @@ main (int argc,
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
|
|
|
94e8a5 |
dnf_transaction_set_flags (txn, flags);
|
|
|
94e8a5 |
+ if (opt_best && opt_nobest)
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ error = g_error_new_literal(G_OPTION_ERROR,
|
|
|
94e8a5 |
+ G_OPTION_ERROR_BAD_VALUE,
|
|
|
94e8a5 |
+ "Argument --nobest is not allowed with argument --best");
|
|
|
94e8a5 |
+ goto out;
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
+ if (opt_best)
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ dnf_context_set_best(TRUE);
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
+ else if (opt_nobest)
|
|
|
94e8a5 |
+ {
|
|
|
94e8a5 |
+ dnf_context_set_best(FALSE);
|
|
|
94e8a5 |
+ }
|
|
|
94e8a5 |
}
|
|
|
94e8a5 |
- if (!show_help && opt_best)
|
|
|
94e8a5 |
- {
|
|
|
94e8a5 |
- dnf_context_set_best(opt_best);
|
|
|
94e8a5 |
- }
|
|
|
94e8a5 |
+
|
|
|
94e8a5 |
/*
|
|
|
94e8a5 |
* The first non-option is the command.
|
|
|
94e8a5 |
* Get it and remove it from arguments.
|
|
|
94e8a5 |
--
|
|
|
94e8a5 |
2.21.0
|
|
|
94e8a5 |
|