diff --git a/0002-Add-pre_configuration-def-for-commands.patch b/0002-Add-pre_configuration-def-for-commands.patch new file mode 100644 index 0000000..5b2da5c --- /dev/null +++ b/0002-Add-pre_configuration-def-for-commands.patch @@ -0,0 +1,61 @@ +From 38e5c4a43d56ea48c2706e1722a504b8a1d38ca7 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Thu, 21 Sep 2017 15:47:04 +0200 +Subject: [PATCH] Add pre_configuration() def for commands + +It allows to set up thinks before configuration of repos (like releasever). +--- + dnf/cli/cli.py | 2 +- + dnf/cli/commands/__init__.py | 5 +++++ + doc/api_cli.rst | 6 ++++++ + 3 files changed, 12 insertions(+), 1 deletion(-) + +diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py +index e481cc2d..641b4464 100644 +--- a/dnf/cli/cli.py ++++ b/dnf/cli/cli.py +@@ -878,7 +878,7 @@ class Cli(object): + self.demands.cacheonly = True + if opts.obsoletes: + self.base.conf.obsoletes = True +- ++ self.command.pre_configure() + # with cachedir in place we can configure stuff depending on it: + self.base._activate_persistor() + +diff --git a/dnf/cli/commands/__init__.py b/dnf/cli/commands/__init__.py +index 7608c851..9a40f779 100644 +--- a/dnf/cli/commands/__init__.py ++++ b/dnf/cli/commands/__init__.py +@@ -124,6 +124,11 @@ class Command(object): + """Define command specific options and arguments. #:api""" + pass + ++ def pre_configure(self): ++ # :api ++ """Do any command-specific pre-configuration.""" ++ pass ++ + def configure(self): + # :api + """Do any command-specific configuration.""" +diff --git a/doc/api_cli.rst b/doc/api_cli.rst +index ab5863b8..71e6860d 100644 +--- a/doc/api_cli.rst ++++ b/doc/api_cli.rst +@@ -90,6 +90,12 @@ When packaging your custom command, we recommend you to define a virtual provide + CLI configure phase when one of the command's aliases is parsed from `dnf` + commandline. `cli` is an instance of :class:`dnf.cli.Cli`. + ++ .. method:: pre_configure() ++ ++ Perform any pre-configuration on the command itself and on the CLI. Typically, the command ++ implements this call to set up releasever or enable/disable repository. This method is called ++ before configuration of repos. ++ + .. method:: configure() + + Perform any configuration on the command itself and on the CLI. Typically, the command implements this call to set up any :class:`demands <.DemandSheet>`, tweak the global configuration or the repository configuration. This method is called immediately after the CLI/extension is finished configuring DNF. +-- +2.13.5 + diff --git a/dnf.spec b/dnf.spec index 8bdd3db..9a52549 100644 --- a/dnf.spec +++ b/dnf.spec @@ -51,7 +51,7 @@ Name: dnf Version: 2.6.3 -Release: 11%{?dist} +Release: 12%{?dist} Summary: Package manager forked from Yum, using libsolv as a dependency resolver # For a breakdown of the licensing, see PACKAGE-LICENSING License: GPLv2+ and GPLv2 and GPL @@ -62,6 +62,7 @@ URL: https://github.com/rpm-software-management/dnf Source0: %{name}-%{version}.tar.gz Patch0: %{name}-nose-use-module.patch Patch1: 0001-Re-introduce-dnf-automatic.-service-timer.patch +Patch2: 0002-Add-pre_configuration-def-for-commands.patch Patch35: 0035-base-set-priority-to-hawkey-repo-as-well-RhBug-14700.patch BuildArch: noarch @@ -524,6 +525,9 @@ popd %endif %changelog +* Fri Sep 22 2017 Jaroslav Mracek - 2.6.3-12 +- Added support for command pre_configuration + * Wed Sep 13 2017 Jeroen van Meeuwen - 2.6.3-11 - Added patch to obey repository priority configuration