diff --git a/0001-Allow-to-set-cacheonly-from-commands-and-conf-RhBug-.patch b/0001-Allow-to-set-cacheonly-from-commands-and-conf-RhBug-.patch new file mode 100644 index 0000000..703ad04 --- /dev/null +++ b/0001-Allow-to-set-cacheonly-from-commands-and-conf-RhBug-.patch @@ -0,0 +1,32 @@ +From bc11bf599ce3102656fa42b0ad0a6c7270822f30 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Mon, 27 Nov 2017 14:35:32 +0100 +Subject: [PATCH 1/3] Allow to set cacheonly from commands and conf + (RhBug:1492036) + +The formal code reacts only to --cacheonly option. + +https://bugzilla.redhat.com/show_bug.cgi?id=1492036 +--- + dnf/cli/cli.py | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/dnf/cli/cli.py b/dnf/cli/cli.py +index f60cdced..11fbed31 100644 +--- a/dnf/cli/cli.py ++++ b/dnf/cli/cli.py +@@ -741,7 +741,10 @@ class Cli(object): + if not os.getegid() == 0: + raise dnf.exceptions.Error(_('This command has to be run under the root user.')) + +- if not demands.cacheonly: ++ if demands.cacheonly or self.base.conf.cacheonly: ++ self.base.conf.cacheonly = True ++ repos.all()._md_only_cached = True ++ else: + if demands.freshest_metadata: + for repo in repos.iter_enabled(): + repo._md_expire_cache() +-- +2.13.6 + diff --git a/0002-Remove-redundant-conf-option-cacheonly.patch b/0002-Remove-redundant-conf-option-cacheonly.patch new file mode 100644 index 0000000..8005180 --- /dev/null +++ b/0002-Remove-redundant-conf-option-cacheonly.patch @@ -0,0 +1,25 @@ +From 777df1098f4215edb8339a56c1807c9217715142 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Mon, 27 Nov 2017 14:38:08 +0100 +Subject: [PATCH 2/3] Remove redundant conf option cacheonly + +The option was defined twice in "dnf.conf". +--- + dnf/conf/config.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/dnf/conf/config.py b/dnf/conf/config.py +index f0c39665..f2098fc6 100644 +--- a/dnf/conf/config.py ++++ b/dnf/conf/config.py +@@ -778,7 +778,6 @@ class MainConf(BaseConfig): + # runtime only options + self._add_option('downloadonly', BoolOption(False, runtimeonly=True)) + self._add_option('ignorearch', BoolOption(False)) +- self._add_option('cacheonly', BoolOption(False)) + + @property + def get_reposdir(self): +-- +2.13.6 + diff --git a/0003-Remove-unnecessary-code-for-set-cacheonly.patch b/0003-Remove-unnecessary-code-for-set-cacheonly.patch new file mode 100644 index 0000000..2be79b0 --- /dev/null +++ b/0003-Remove-unnecessary-code-for-set-cacheonly.patch @@ -0,0 +1,44 @@ +From aebbc222b85a7949a705360ea51b7c987126c2d8 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Tue, 28 Nov 2017 09:21:40 +0100 +Subject: [PATCH 3/3] Remove unnecessary code for set cacheonly + +Attribute repo._md_only_cached is set on different place during +_progress_demands(). +--- + dnf/repo.py | 5 ----- + tests/test_cli.py | 2 -- + 2 files changed, 7 deletions(-) + +diff --git a/dnf/repo.py b/dnf/repo.py +index e9ce597e..75a11a47 100644 +--- a/dnf/repo.py ++++ b/dnf/repo.py +@@ -858,11 +858,6 @@ class Repo(dnf.conf.RepoConf): + else: + return self._try_revive_by_repomd() + +- def _configure_from_options(self, opts): +- if getattr(opts, 'cacheonly', None): +- self._md_only_cached = True +- super(Repo, self)._configure_from_options(opts) +- + def disable(self): + # :api + self.enabled = False +diff --git a/tests/test_cli.py b/tests/test_cli.py +index f4ea27ee..8963783a 100644 +--- a/tests/test_cli.py ++++ b/tests/test_cli.py +@@ -136,8 +136,6 @@ class CliTest(TestCase): + self.assertTrue(self.base.repos['comb'].enabled) + self.assertFalse(self.base.repos["comb"].gpgcheck) + self.assertFalse(self.base.repos["comb"].repo_gpgcheck) +- self.assertEqual(self.base.repos["comb"]._sync_strategy, +- dnf.repo.SYNC_ONLY_CACHE) + + def test_configure_repos_expired(self, _): + """Ensure that --cacheonly beats the expired status.""" +-- +2.13.6 + diff --git a/dnf.spec b/dnf.spec index b65d03a..6e7cc89 100644 --- a/dnf.spec +++ b/dnf.spec @@ -25,12 +25,15 @@ Name: dnf Version: 2.7.5 -Release: 1%{?dist} +Release: 2%{?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 URL: https://github.com/rpm-software-management/dnf Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0: 0001-Allow-to-set-cacheonly-from-commands-and-conf-RhBug-.patch +Patch1: 0002-Remove-redundant-conf-option-cacheonly.patch +Patch2: 0003-Remove-unnecessary-code-for-set-cacheonly.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -372,6 +375,9 @@ popd %endif %changelog +* Wed Nov 29 2017 Jaroslav Mracek - 2.7.5-2 +- Fix problem with demands.cacheonly that caused problems for system-upgrade + * Wed Oct 18 2017 Igor Gnatenko - 2.7.5-1 - Improve performance for excludes and includes handling (RHBZ #1500361) - Fixed problem of handling checksums for local repositories (RHBZ #1502106)