commit 683eb35be255274f295590e0baa9784ea9783d01 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:37:03 2019 -0400 Package init diff --git a/Add-best-as-default-behavior-RhBug-1670776-1671683.patch b/Add-best-as-default-behavior-RhBug-1670776-1671683.patch new file mode 100644 index 0000000..3b8840e --- /dev/null +++ b/Add-best-as-default-behavior-RhBug-1670776-1671683.patch @@ -0,0 +1,40 @@ +From a07c124b4a249a7c98864f8236a569345dc4febe Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Mon, 4 Feb 2019 09:14:17 +0100 +Subject: [PATCH 082/175] Add best as default behavior (RhBug:1670776,1671683) + +The new default behavior should provide a better security. + +https://bugzilla.redhat.com/show_bug.cgi?id=1670776 +https://bugzilla.redhat.com/show_bug.cgi?id=1671683 +Signed-off-by: root +--- + doc/api_conf.rst | 2 +- + etc/dnf/dnf.conf | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/doc/api_conf.rst b/doc/api_conf.rst +index f86e4432..9dd6a6ab 100644 +--- a/doc/api_conf.rst ++++ b/doc/api_conf.rst +@@ -30,7 +30,7 @@ Configurable settings of the :class:`dnf.Base` object are stored into a :class:` + + .. attribute:: best + +- Boolean option, ``True`` instructs the solver to either use a package with the highest available version or fail. On ``False``, do not fail if the latest version can not be installed. Default is ``False``. ++ Boolean option, ``True`` instructs the solver to either use a package with the highest available version or fail. On ``False``, do not fail if the latest version can not be installed. Default is ``True``. + + .. attribute:: cachedir + +diff --git a/etc/dnf/dnf.conf b/etc/dnf/dnf.conf +index 81b3e44d..812c189f 100644 +--- a/etc/dnf/dnf.conf ++++ b/etc/dnf/dnf.conf +@@ -2,3 +2,4 @@ + gpgcheck=1 + installonly_limit=3 + clean_requirements_on_remove=True ++best=True +-- +2.19.1 + diff --git a/Fix-multilib-obsoletes-RhBug-1672947.patch b/Fix-multilib-obsoletes-RhBug-1672947.patch new file mode 100644 index 0000000..0c78a69 --- /dev/null +++ b/Fix-multilib-obsoletes-RhBug-1672947.patch @@ -0,0 +1,46 @@ +From 281c07db9664100b23150b89afa786fa56189aa9 Mon Sep 17 00:00:00 2001 +From: root +Date: Sat, 21 Dec 2019 22:00:50 +0800 +Subject: [PATCH] backport-Fix-multilib-obsoletes-RhBug-1672947 + +Signed-off-by: root +--- + dnf/base.py | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/dnf/base.py b/dnf/base.py +index bc05667..b5e2b42 100644 +--- a/dnf/base.py ++++ b/dnf/base.py +@@ -635,9 +635,10 @@ class Base(object): + for pkg in goal.list_installs(): + self._ds_callback.pkg_added(pkg, 'i') + obs = goal.obsoleted_by_package(pkg) +- # skip obsoleted packages that are not part of all_obsoleted +- # they are handled as upgrades/downgrades +- obs = [i for i in obs if i in all_obsoleted] ++ # Skip obsoleted packages that are not part of all_obsoleted, ++ # they are handled as upgrades/downgrades. ++ # Also keep RPMs with the same name - they're not always in all_obsoleted. ++ obs = [i for i in obs if i in all_obsoleted or i.name == pkg.name] + + # TODO: move to libdnf: getBestReason + reason = goal.get_reason(pkg) +@@ -669,9 +670,11 @@ class Base(object): + upgraded = obs.pop(0) + else: + obs.remove(upgraded) +- # skip obsoleted packages that are not part of all_obsoleted +- # they are handled as upgrades/downgrades +- obs = [i for i in obs if i in all_obsoleted] ++ # Skip obsoleted packages that are not part of all_obsoleted, ++ # they are handled as upgrades/downgrades. ++ # Also keep RPMs with the same name - they're not always in all_obsoleted. ++ obs = [i for i in obs if i in all_obsoleted or i.name == pkg.name] ++ + cb = lambda pkg: self._ds_callback.pkg_added(pkg, 'od') + dnf.util.mapall(cb, obs) + if pkg in self._get_installonly_query(): +-- +2.19.1 + diff --git a/Fix-the-installation-of-completion_helper.py.patch b/Fix-the-installation-of-completion_helper.py.patch new file mode 100644 index 0000000..2cea70e --- /dev/null +++ b/Fix-the-installation-of-completion_helper.py.patch @@ -0,0 +1,35 @@ +From c77f82e024226264ec04db8b6e1121f0d81d3c2a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= +Date: Thu, 4 Apr 2019 15:08:59 +0200 +Subject: [PATCH 173/175] Fix the installation of completion_helper.py +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Change introduced in df19a47d672b09683cc03620a41114cd4239e prevents the +installation of completion_helper.py on Fedora 30. + +Bug report: https://bugzilla.redhat.com/show_bug.cgi?id=1695853 + +Signed-off-by: Robert-André Mauchin +Signed-off-by: root +--- + dnf/cli/CMakeLists.txt | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/dnf/cli/CMakeLists.txt b/dnf/cli/CMakeLists.txt +index 5e335d0c..a32305bc 100644 +--- a/dnf/cli/CMakeLists.txt ++++ b/dnf/cli/CMakeLists.txt +@@ -1,4 +1,6 @@ + FILE(GLOB cli_SRCS *.py) + INSTALL (FILES ${cli_SRCS} DESTINATION ${PYTHON_INSTALL_DIR}/dnf/cli) ++# completion_helper.py is generated so the glob alone won't see it: ++INSTALL (FILES completion_helper.py DESTINATION ${PYTHON_INSTALL_DIR}/dnf/cli) + +-ADD_SUBDIRECTORY (commands) +\ No newline at end of file ++ADD_SUBDIRECTORY (commands) +-- +2.19.1 + diff --git a/Fix-traceback-with-repoquery-location-RhBug-1639827.patch b/Fix-traceback-with-repoquery-location-RhBug-1639827.patch new file mode 100644 index 0000000..3bc59cd --- /dev/null +++ b/Fix-traceback-with-repoquery-location-RhBug-1639827.patch @@ -0,0 +1,35 @@ +From 3d40275c0fd1a9781dafaefc9580ebf364ee9a6a Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Tue, 23 Oct 2018 13:11:31 +0200 +Subject: [PATCH 022/175] Fix traceback with repoquery --location + (RhBug:1639827) + +https://bugzilla.redhat.com/show_bug.cgi?id=1639827 + +Closes: #1249 +Approved by: m-blaha + +Signed-off-by: root +--- + dnf/package.py | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/dnf/package.py b/dnf/package.py +index c2b556a6..478cd07e 100644 +--- a/dnf/package.py ++++ b/dnf/package.py +@@ -242,10 +242,7 @@ class Package(hawkey.Package): + if mirrors: + return schemes_filter(mirrors) + elif self.repo.baseurl: +- if isinstance(self.repo.baseurl, list): +- return schemes_filter(self.repo.baseurl) +- else: +- return schemes_filter([self.repo.baseurl]) ++ return schemes_filter(self.repo.baseurl) + + def _is_local_pkg(self): + if self.repoid == "@System": +-- +2.19.1 + diff --git a/Format-messages-properly-RhBug-1509393.patch b/Format-messages-properly-RhBug-1509393.patch new file mode 100644 index 0000000..6fcc5b8 --- /dev/null +++ b/Format-messages-properly-RhBug-1509393.patch @@ -0,0 +1,80 @@ +From bfe98dc1383eb5ce5b8010bbade66d593d4bb556 Mon Sep 17 00:00:00 2001 +From: Rafal Luzynski +Date: Tue, 22 Jan 2019 16:32:10 +0100 +Subject: [PATCH 078/175] Format messages properly (RhBug:1509393) + +The error was caused by misplaced parentheses and caused the text to be +displayed always in English despite the translation being provided. + +https://bugzilla.redhat.com/show_bug.cgi?id=1509393 + +Closes: #1308 +Approved by: m-blaha + +Signed-off-by: root +--- + dnf/cli/commands/clean.py | 2 +- + dnf/conf/read.py | 4 ++-- + dnf/lock.py | 4 ++-- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/dnf/cli/commands/clean.py b/dnf/cli/commands/clean.py +index 8b8b1821..6ad48506 100644 +--- a/dnf/cli/commands/clean.py ++++ b/dnf/cli/commands/clean.py +@@ -116,7 +116,7 @@ class CleanCommand(commands.Command): + return + except dnf.exceptions.LockError as e: + if not self.base.conf.exit_on_lock: +- msg = _('Waiting for process with pid %d to finish.' % (e.pid)) ++ msg = _('Waiting for process with pid %d to finish.') % (e.pid) + logger.info(msg) + time.sleep(3) + else: +diff --git a/dnf/conf/read.py b/dnf/conf/read.py +index 9a28954e..a620b8dd 100644 +--- a/dnf/conf/read.py ++++ b/dnf/conf/read.py +@@ -58,7 +58,7 @@ class RepoReader(object): + try: + repo._populate(parser, id_, repofn, dnf.conf.PRIO_REPOCONFIG) + except ValueError as e: +- msg = _("Repository '%s': Error parsing config: %s" % (id_, e)) ++ msg = _("Repository '%s': Error parsing config: %s") % (id_, e) + raise dnf.exceptions.ConfigError(msg) + + # Ensure that the repo name is set +@@ -153,7 +153,7 @@ class ModuleReader(object): + _('Unknown configuration option: %s = %s in %s'), + ucd(name), ucd(value), ucd(module_path)) + except ValueError as e: +- msg = _("Module '%s': Error parsing config: %s" % (id_, e)) ++ msg = _("Module '%s': Error parsing config: %s") % (id_, e) + raise dnf.exceptions.ConfigError(msg) + + # TODO: unset module.name? +diff --git a/dnf/lock.py b/dnf/lock.py +index 23ae6f25..3ac01c68 100644 +--- a/dnf/lock.py ++++ b/dnf/lock.py +@@ -100,7 +100,7 @@ class ProcessLock(object): + msg = _('Malformed lock file found: %s.\n' + 'Ensure no other dnf process is running and ' + 'remove the lock file manually or run ' +- 'systemd-tmpfiles --remove dnf.conf.' % (self.target)) ++ 'systemd-tmpfiles --remove dnf.conf.') % (self.target) + raise LockError(msg) + + def _try_unlink(self): +@@ -136,7 +136,7 @@ class ProcessLock(object): + msg = '%s already locked by %d' % (self.description, pid) + raise ProcessLockError(msg, pid) + if inform or prev_pid != pid: +- msg = _('Waiting for process with pid %d to finish.' % (pid)) ++ msg = _('Waiting for process with pid %d to finish.') % (pid) + logger.info(msg) + inform = False + prev_pid = pid +-- +2.19.1 + diff --git a/Run-plugins-hook-safely-RhBug-1495482.patch b/Run-plugins-hook-safely-RhBug-1495482.patch new file mode 100644 index 0000000..aaeb258 --- /dev/null +++ b/Run-plugins-hook-safely-RhBug-1495482.patch @@ -0,0 +1,82 @@ +From f4161c41040710ef2de1fb8851b1cb4c5077505a Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Thu, 29 Nov 2018 16:39:04 +0100 +Subject: [PATCH 054/175] Run plugins hook safely (RhBug:1495482) + +It should prevent from critical problems caused by plugins. + +https://bugzilla.redhat.com/show_bug.cgi?id=1495482 +Signed-off-by: root +--- + dnf/plugin.py | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/dnf/plugin.py b/dnf/plugin.py +index f7aa0b21..91039cdc 100644 +--- a/dnf/plugin.py ++++ b/dnf/plugin.py +@@ -31,6 +31,7 @@ import logging + import operator + import os + import sys ++import traceback + + import dnf.logging + import dnf.pycomp +@@ -95,10 +96,14 @@ class Plugins(object): + self.plugin_cls = [] + self.plugins = [] + +- def _caller(method): +- def fn(self): +- dnf.util.mapall(operator.methodcaller(method), self.plugins) +- return fn ++ def _caller(self, method): ++ for plugin in self.plugins: ++ try: ++ getattr(plugin, method)() ++ except Exception: ++ exc_type, exc_value, exc_traceback = sys.exc_info() ++ except_list = traceback.format_exception(exc_type, exc_value, exc_traceback) ++ logger.critical(''.join(except_list)) + + def _check_enabled(self, conf, enable_plugins): + """Checks whether plugins are enabled or disabled in configuration files +@@ -131,19 +136,28 @@ class Plugins(object): + names = sorted(plugin.name for plugin in self.plugin_cls) + logger.debug(_('Loaded plugins: %s'), ', '.join(names)) + +- _run_pre_config = _caller('pre_config') ++ def _run_pre_config(self): ++ self._caller('pre_config') + +- _run_config = _caller('config') ++ def _run_config(self): ++ self._caller('config') + + def _run_init(self, base, cli=None): + for p_cls in self.plugin_cls: + plugin = p_cls(base, cli) + self.plugins.append(plugin) + +- run_sack = _caller('sack') +- run_resolved = _caller('resolved') +- run_pre_transaction = _caller('pre_transaction') +- run_transaction = _caller('transaction') ++ def run_sack(self): ++ self._caller('sack') ++ ++ def run_resolved(self): ++ self._caller('resolved') ++ ++ def run_pre_transaction(self): ++ self._caller('pre_transaction') ++ ++ def run_transaction(self): ++ self._caller('transaction') + + def _unload(self): + del sys.modules[DYNAMIC_PACKAGE] +-- +2.19.1 + diff --git a/Set-tsi-state-if-multiple-pkgs-have-same-nevra-RhBug.patch b/Set-tsi-state-if-multiple-pkgs-have-same-nevra-RhBug.patch new file mode 100644 index 0000000..ce151d6 --- /dev/null +++ b/Set-tsi-state-if-multiple-pkgs-have-same-nevra-RhBug.patch @@ -0,0 +1,185 @@ +From be1e853b422ca2dbbe30c0fa7d5549cd6c8a59a4 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Tue, 6 Nov 2018 15:38:00 +0100 +Subject: [PATCH 016/175] Set tsi state if multiple pkgs have same nevra + (RhBug:1642796) + +In case that package with same nevra is installed multiple times the +patch prevents that transaction end up with traceback: + +return _transaction.Swdb_endTransaction(self, dtEnd, rpmdbVersionEnd, +state) +RuntimeError: TransactionItem state is not set: + +https://bugzilla.redhat.com/show_bug.cgi?id=1642796 +Signed-off-by: root +--- + dnf/yum/rpmtrans.py | 80 ++++++++++++++++++++++----------------------- + 1 file changed, 40 insertions(+), 40 deletions(-) + +diff --git a/dnf/yum/rpmtrans.py b/dnf/yum/rpmtrans.py +index 9a80ab61..f8b76a71 100644 +--- a/dnf/yum/rpmtrans.py ++++ b/dnf/yum/rpmtrans.py +@@ -217,22 +217,23 @@ class RPMTransaction(object): + + if hasattr(cbkey, "pkg"): + tsi = cbkey +- return tsi.pkg, tsi.action, tsi ++ return [tsi] + + te = self._te_list[self._te_index] + te_nevra = dnf.util._te_nevra(te) +- if self._tsi_cache is not None: +- if str(self._tsi_cache) == te_nevra: +- return self._tsi_cache.pkg, self._tsi_cache.action, self._tsi_cache +- ++ if self._tsi_cache: ++ if str(self._tsi_cache[0]) == te_nevra: ++ return self._tsi_cache ++ items = [] + for tsi in self.base.transaction: + if tsi.action == libdnf.transaction.TransactionItemAction_REINSTALL: + # skip REINSTALL in order to return REINSTALLED + continue + if str(tsi) == te_nevra: +- self._tsi_cache = tsi +- return tsi.pkg, tsi.action, tsi +- ++ items.append(tsi) ++ if items: ++ self._tsi_cache = items ++ return items + raise RuntimeError("TransactionItem not found for key: %s" % cbkey) + + def callback(self, what, amount, total, key, client_data): +@@ -292,13 +293,14 @@ class RPMTransaction(object): + self._te_index = index + self.complete_actions += 1 + if not self.test: +- _, _, tsi = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) + for display in self.displays: +- display.filelog(tsi.pkg, tsi.action) ++ display.filelog(transaction_list[0].pkg, transaction_list[0].action) + + def _instOpenFile(self, key): + self.lastmsg = None +- pkg, _, _ = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) ++ pkg = transaction_list[0].pkg + rpmloc = pkg.localPkg() + try: + self.fd = open(rpmloc) +@@ -312,15 +314,16 @@ class RPMTransaction(object): + return self.fd.fileno() + + def _instCloseFile(self, key): +- _, _, tsi = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) + self.fd.close() + self.fd = None + + if self.test or not self.trans_running: + return +- +- if tsi.state == libdnf.transaction.TransactionItemState_UNKNOWN: +- tsi.state = libdnf.transaction.TransactionItemState_DONE ++ for tsi in transaction_list: ++ if tsi.state == libdnf.transaction.TransactionItemState_UNKNOWN: ++ tsi.state = libdnf.transaction.TransactionItemState_DONE ++ break + + for display in self.displays: + display.filelog(tsi.pkg, tsi.action) +@@ -333,27 +336,28 @@ class RPMTransaction(object): + display.progress(None, action, None, None, None, None) + + def _instProgress(self, amount, total, key): +- _, _, tsi = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) ++ pkg = transaction_list[0].pkg ++ action = transaction_list[0].action + for display in self.displays: +- display.progress( +- tsi.pkg, tsi.action, amount, total, self.complete_actions, +- self.total_actions) ++ display.progress(pkg, action, amount, total, self.complete_actions, self.total_actions) + + def _uninst_start(self, key): + self.total_removed += 1 + + def _uninst_progress(self, amount, total, key): +- _, _, tsi = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) ++ pkg = transaction_list[0].pkg ++ action = transaction_list[0].action + for display in self.displays: +- display.progress( +- tsi.pkg, tsi.action, amount, total, self.complete_actions, +- self.total_actions) ++ display.progress(pkg, action, amount, total, self.complete_actions, self.total_actions) + + def _unInstStop(self, key): +- _, _, tsi = self._extract_cbkey(key) +- +- if tsi.state == libdnf.transaction.TransactionItemState_UNKNOWN: +- tsi.state = libdnf.transaction.TransactionItemState_DONE ++ transaction_list = self._extract_cbkey(key) ++ for tsi in transaction_list: ++ if tsi.state == libdnf.transaction.TransactionItemState_UNKNOWN: ++ tsi.state = libdnf.transaction.TransactionItemState_DONE ++ break + + for display in self.displays: + display.filelog(tsi.pkg, tsi.action) +@@ -364,15 +368,15 @@ class RPMTransaction(object): + self._scriptout() + + def _cpioError(self, key): +- # In the case of a remove, we only have a name, not a tsi: +- pkg, _, _ = self._extract_cbkey(key) +- msg = "Error in cpio payload of rpm package %s" % pkg ++ transaction_list = self._extract_cbkey(key) ++ msg = "Error in cpio payload of rpm package %s" % transaction_list[0].pkg + for display in self.displays: + display.error(msg) + + def _unpackError(self, key): +- pkg, _, tsi = self._extract_cbkey(key) +- msg = "Error unpacking rpm package %s" % pkg ++ transaction_list = self._extract_cbkey(key) ++ tsi = transaction_list[0] ++ msg = "Error unpacking rpm package %s" % tsi.pkg + for display in self.displays: + display.error(msg) + tsi.state = libdnf.transaction.TransactionItemState_ERROR +@@ -382,13 +386,8 @@ class RPMTransaction(object): + # "total" carries fatal/non-fatal status + scriptlet_name = rpm.tagnames.get(amount, "") + +- pkg, _, _ = self._extract_cbkey(key) +- if pkg is not None: +- name = pkg.name +- elif dnf.util.is_string_type(key): +- name = key +- else: +- name = 'None' ++ transaction_list = self._extract_cbkey(key) ++ name = transaction_list[0].pkg.name + + msg = ("Error in %s scriptlet in rpm package %s" % (scriptlet_name, name)) + +@@ -401,7 +400,8 @@ class RPMTransaction(object): + if key is None and self._te_list == []: + pkg = 'None' + else: +- pkg, _, _ = self._extract_cbkey(key) ++ transaction_list = self._extract_cbkey(key) ++ pkg = transaction_list[0].pkg + complete = self.complete_actions if self.total_actions != 0 and self.complete_actions != 0 \ + else 1 + total = self.total_actions if self.total_actions != 0 and self.complete_actions != 0 else 1 +-- +2.19.1 + diff --git a/Solve-traceback-with-the-dnf-install-module-RhBug-16.patch b/Solve-traceback-with-the-dnf-install-module-RhBug-16.patch new file mode 100644 index 0000000..a4fe5ad --- /dev/null +++ b/Solve-traceback-with-the-dnf-install-module-RhBug-16.patch @@ -0,0 +1,31 @@ +From 3c88bc6d39a965d93452188de88e63cea7225d11 Mon Sep 17 00:00:00 2001 +From: Jaroslav Mracek +Date: Thu, 14 Mar 2019 16:24:57 +0100 +Subject: [PATCH 152/175] Solve traceback with the "dnf install @module" + (RhBug:1688823) + +Fix modular solver error formatting. The problem was only triggered in +presence of modular errors. + +https://bugzilla.redhat.com/show_bug.cgi?id=1688823 +Signed-off-by: root +--- + dnf/cli/commands/install.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dnf/cli/commands/install.py b/dnf/cli/commands/install.py +index 5e281089..e2f97ba6 100644 +--- a/dnf/cli/commands/install.py ++++ b/dnf/cli/commands/install.py +@@ -94,7 +94,7 @@ class InstallCommand(commands.Command): + module_debsolv_errors = e.module_debsolv_errors + if module_debsolv_errors: + logger.error(dnf.module.module_base.format_modular_solver_errors( +- module_debsolv_errors)) ++ module_debsolv_errors[0])) + else: + skipped_grp_specs = self.opts.grp_specs + if self.opts.filenames and nevra_forms: +-- +2.19.1 + diff --git a/automatic-Fix-the-systemd-ordering-loop-RhBug-163648.patch b/automatic-Fix-the-systemd-ordering-loop-RhBug-163648.patch new file mode 100644 index 0000000..25795bf --- /dev/null +++ b/automatic-Fix-the-systemd-ordering-loop-RhBug-163648.patch @@ -0,0 +1,136 @@ +From 1d1b389a965f8354a18d64d0cea3a8881f658cdf Mon Sep 17 00:00:00 2001 +From: root +Date: Sat, 21 Dec 2019 21:48:47 +0800 +Subject: [PATCH] backport-automatic-Fix-the-systemd-ordering-loop-RhBug-163648 + +Signed-off-by: root +--- + etc/systemd/dnf-automatic-download.service | 1 + + etc/systemd/dnf-automatic-download.timer | 3 +-- + etc/systemd/dnf-automatic-install.service | 1 + + etc/systemd/dnf-automatic-install.timer | 3 +-- + etc/systemd/dnf-automatic-notifyonly.service | 1 + + etc/systemd/dnf-automatic-notifyonly.timer | 3 +-- + etc/systemd/dnf-automatic.service | 1 + + etc/systemd/dnf-automatic.timer | 3 ++- + 8 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/etc/systemd/dnf-automatic-download.service b/etc/systemd/dnf-automatic-download.service +index 962a0a2..b60e6b7 100644 +--- a/etc/systemd/dnf-automatic-download.service ++++ b/etc/systemd/dnf-automatic-download.service +@@ -2,6 +2,7 @@ + Description=dnf automatic download updates + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted ++After=network-online.target + + [Service] + Type=oneshot +diff --git a/etc/systemd/dnf-automatic-download.timer b/etc/systemd/dnf-automatic-download.timer +index 3cad73d..bcb145c 100644 +--- a/etc/systemd/dnf-automatic-download.timer ++++ b/etc/systemd/dnf-automatic-download.timer +@@ -3,11 +3,10 @@ Description=dnf-automatic-download timer + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted + Wants=network-online.target +-After=network-online.target + + [Timer] + OnBootSec=1h + OnUnitInactiveSec=1d + + [Install] +-WantedBy=basic.target ++WantedBy=multi-user.target +diff --git a/etc/systemd/dnf-automatic-install.service b/etc/systemd/dnf-automatic-install.service +index 2dbf954..58e256a 100644 +--- a/etc/systemd/dnf-automatic-install.service ++++ b/etc/systemd/dnf-automatic-install.service +@@ -2,6 +2,7 @@ + Description=dnf automatic install updates + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted ++After=network-online.target + + [Service] + Type=oneshot +diff --git a/etc/systemd/dnf-automatic-install.timer b/etc/systemd/dnf-automatic-install.timer +index ea13f61..013bfe3 100644 +--- a/etc/systemd/dnf-automatic-install.timer ++++ b/etc/systemd/dnf-automatic-install.timer +@@ -3,11 +3,10 @@ Description=dnf-automatic-install timer + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted + Wants=network-online.target +-After=network-online.target + + [Timer] + OnBootSec=1h + OnUnitInactiveSec=1d + + [Install] +-WantedBy=basic.target ++WantedBy=multi-user.target +diff --git a/etc/systemd/dnf-automatic-notifyonly.service b/etc/systemd/dnf-automatic-notifyonly.service +index c8a21bc..3324c96 100644 +--- a/etc/systemd/dnf-automatic-notifyonly.service ++++ b/etc/systemd/dnf-automatic-notifyonly.service +@@ -2,6 +2,7 @@ + Description=dnf automatic notification of updates + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted ++After=network-online.target + + [Service] + Type=oneshot +diff --git a/etc/systemd/dnf-automatic-notifyonly.timer b/etc/systemd/dnf-automatic-notifyonly.timer +index 97e5411..45fb0b5 100644 +--- a/etc/systemd/dnf-automatic-notifyonly.timer ++++ b/etc/systemd/dnf-automatic-notifyonly.timer +@@ -3,11 +3,10 @@ Description=dnf-automatic-notifyonly timer + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted + Wants=network-online.target +-After=network-online.target + + [Timer] + OnBootSec=1h + OnUnitInactiveSec=1d + + [Install] +-WantedBy=basic.target ++WantedBy=multi-user.target +diff --git a/etc/systemd/dnf-automatic.service b/etc/systemd/dnf-automatic.service +index 0b390c8..d49775f 100644 +--- a/etc/systemd/dnf-automatic.service ++++ b/etc/systemd/dnf-automatic.service +@@ -2,6 +2,7 @@ + Description=dnf automatic + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted ++After=network-online.target + + [Service] + Type=oneshot +diff --git a/etc/systemd/dnf-automatic.timer b/etc/systemd/dnf-automatic.timer +index 62f1b70..64d6e92 100644 +--- a/etc/systemd/dnf-automatic.timer ++++ b/etc/systemd/dnf-automatic.timer +@@ -2,10 +2,11 @@ + Description=dnf-automatic timer + # See comment in dnf-makecache.service + ConditionPathExists=!/run/ostree-booted ++Wants=network-online.target + + [Timer] + OnBootSec=1h + OnUnitInactiveSec=1d + + [Install] +-WantedBy=basic.target ++WantedBy=multi-user.target +-- +2.19.1 + diff --git a/callback-Bring-PKG_ERASE-back-for-compatibility-reas.patch b/callback-Bring-PKG_ERASE-back-for-compatibility-reas.patch new file mode 100644 index 0000000..b6d770e --- /dev/null +++ b/callback-Bring-PKG_ERASE-back-for-compatibility-reas.patch @@ -0,0 +1,27 @@ +From 22106c470fe0decced1df17cb2b7b25c13ad3519 Mon Sep 17 00:00:00 2001 +From: Daniel Mach +Date: Wed, 12 Dec 2018 14:36:12 +0100 +Subject: [PATCH 105/175] [callback] Bring PKG_ERASE back for compatibility + reasons. + +Resolves: rhbz#1597182 +Signed-off-by: root +--- + dnf/callback.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/dnf/callback.py b/dnf/callback.py +index 967fb7a7..4b162fcf 100644 +--- a/dnf/callback.py ++++ b/dnf/callback.py +@@ -28,6 +28,7 @@ PKG_INSTALL = dnf.transaction.PKG_INSTALL # :api + PKG_OBSOLETE = dnf.transaction.PKG_OBSOLETE # :api + PKG_REINSTALL = dnf.transaction.PKG_REINSTALL # :api + PKG_REMOVE = dnf.transaction.PKG_ERASE # :api ++PKG_ERASE = PKG_REMOVE # deprecated, use PKG_REMOVE instead + PKG_UPGRADE = dnf.transaction.PKG_UPGRADE # :api + + PKG_CLEANUP = dnf.transaction.PKG_CLEANUP # :api +-- +2.19.1 + diff --git a/conf-setopt-not-create-rewrite-other-option_parser-o.patch b/conf-setopt-not-create-rewrite-other-option_parser-o.patch new file mode 100644 index 0000000..b00adbe --- /dev/null +++ b/conf-setopt-not-create-rewrite-other-option_parser-o.patch @@ -0,0 +1,56 @@ +From 2a05b85423fb343cf7fdd2ebdc437052345bf9e5 Mon Sep 17 00:00:00 2001 +From: Jaroslav Rohel +Date: Wed, 24 Oct 2018 06:21:41 +0200 +Subject: [PATCH 008/175] [conf] "setopt" not create/rewrite other + option_parser options + +Rewriting of option can damage it. +Example of crash (setopt will damages the excludepkgs option): +dnf --setopt=excludepkgs=a --excludepkgs=b +Traceback (most recent call last): + File "bin/dnf-2", line 58, in + main.user_main(sys.argv[1:], exit_code=True) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/main.py", line 179, in user_main + errcode = main(args) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/main.py", line 64, in main + return _main(base, args, cli_class, option_parser_class) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/main.py", line 95, in _main + cli.configure(list(map(ucd, args)), option_parser()) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/cli.py", line 816, in configure + opts = self.optparser.parse_main_args(args) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/option_parser.py", line 380, in parse_main_args + namespace, _unused_args = parser.parse_known_args(args) + File "/usr/lib64/python3.6/argparse.py", line 1766, in parse_known_args + namespace, args = self._parse_known_args(args, namespace) + File "/usr/lib64/python3.6/argparse.py", line 1972, in _parse_known_args + start_index = consume_optional(start_index) + File "/usr/lib64/python3.6/argparse.py", line 1912, in consume_optional + take_action(action, args, option_string) + File "/usr/lib64/python3.6/argparse.py", line 1840, in take_action + action(self, namespace, argument_values, option_string) + File "/home/jrohel/projects/rpm-software-management/dnf/dnf/cli/option_parser.py", line 74, in __call__ + self).__call__(parser, namespace, val, opt_str) + File "/usr/lib64/python3.6/argparse.py", line 958, in __call__ + items.append(values) +AttributeError: 'str' object has no attribute 'append' + +Signed-off-by: root +--- + dnf/cli/option_parser.py | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/dnf/cli/option_parser.py b/dnf/cli/option_parser.py +index 531ea438..e9040165 100644 +--- a/dnf/cli/option_parser.py ++++ b/dnf/cli/option_parser.py +@@ -114,7 +114,6 @@ class OptionParser(argparse.ArgumentParser): + setattr(namespace, 'repo_' + self.dest, self.repoopts) + else: + setattr(self.mainopts, k, v) +- setattr(namespace, k, v) + setattr(namespace, 'main_' + self.dest, self.mainopts) + + class ParseSpecGroupFileCallback(argparse.Action): +-- +2.19.1 + diff --git a/dnf-4.0.4.tar.gz b/dnf-4.0.4.tar.gz new file mode 100644 index 0000000..696ad32 Binary files /dev/null and b/dnf-4.0.4.tar.gz differ diff --git a/dnf.spec b/dnf.spec new file mode 100644 index 0000000..7e25978 --- /dev/null +++ b/dnf.spec @@ -0,0 +1,277 @@ +%bcond_with python2 +%bcond_without python3 + +%if %{with python2} + %global py2pluginpath %{python2_sitelib}/%{name}-plugins +%endif + +%if %{with python3} + %global py3pluginpath %{python3_sitelib}/%{name}-plugins +%endif + +Name: dnf +Version: 4.0.4 +Release: 2 +Summary: A software package manager that manages packages on Linux distributions. +License: GPLv2+ and GPLv2 and GPL +URL: https://github.com/rpm-software-management/dnf +Source0: https://github.com/rpm-software-management/dnf/archive/%{version}/%{name}-%{version}.tar.gz + +Patch6000: automatic-Fix-the-systemd-ordering-loop-RhBug-163648.patch +Patch6001: conf-setopt-not-create-rewrite-other-option_parser-o.patch +Patch6002: Set-tsi-state-if-multiple-pkgs-have-same-nevra-RhBug.patch +Patch6003: Fix-traceback-with-repoquery-location-RhBug-1639827.patch +Patch6004: Run-plugins-hook-safely-RhBug-1495482.patch +Patch6005: Format-messages-properly-RhBug-1509393.patch +Patch6006: Add-best-as-default-behavior-RhBug-1670776-1671683.patch +Patch6007: callback-Bring-PKG_ERASE-back-for-compatibility-reas.patch +Patch6008: Solve-traceback-with-the-dnf-install-module-RhBug-16.patch +Patch6009: Fix-multilib-obsoletes-RhBug-1672947.patch +Patch6010: Fix-the-installation-of-completion_helper.py.patch + +BuildArch: noarch +BuildRequires: cmake gettext python2-sphinx systemd bash-completion +Requires: libreport-filesystem systemd %{name} = %{version}-%{release} +%if %{with python3} +Requires: python3-%{name} = %{version}-%{release} +Recommends: (python3-dbus if NetworkManager) +%else +Requires: python2-%{name} = %{version}-%{release} +Recommends: (python2-dbus if NetworkManager) +%endif +Recommends: (sqlite if bash-completion) +%{?systemd_requires} +Provides: dnf-command(autoremove) dnf-command(check-update) dnf-command(clean) dnf-command(distro-sync) +Provides: dnf-command(downgrade) dnf-command(group) dnf-command(history) dnf-command(info) +Provides: dnf-command(install) dnf-command(list) dnf-command(makecache) dnf-command(mark) +Provides: dnf-command(provides) dnf-command(reinstall) dnf-command(remove) dnf-command(repolist) +Provides: dnf-command(repoquery) dnf-command(repository-packages) dnf-command(updateinfo) +Provides: dnf-command(search) dnf-command(upgrade) dnf-command(upgrade-to) +Provides: %{name}-conf = %{version}-%{release} dnf-data +Obsoletes: %{name}-conf <= %{version}-%{release} dnf-data +Conflicts: python2-dnf-plugins-core < 3.1 python3-dnf-plugins-core < 3.1 +Conflicts: python2-dnf-plugins-extras < 3.0.2 python3-dnf-plugins-extras < 3.0.2 + +%description +DNF is a software package manager that installs, updates, and removespackages +on RPM-based Linux distributions. It automatically computes dependencies and +determines the actions required to install packages.DNF also makes it easier +to maintain groups of machines, eliminating the need to manually update each +one using rpm. + +%package help +Summary: Help documents for dnf + +%description help +This package helps to deploy dnf and contains some man help files. + +%package -n yum +Requires: %{name} = %{version}-%{release} +Summary: A command-line package-management utility for RPM-based Linux distributions +Conflicts: yum < 3.4.3-505 + +%description -n yum +This package allows for automatic updates and package and dependency management on +RPM-based Linux distributions. + +%if %{with python2} +%package -n python2-dnf +Summary: Python 2 interface to DNF +%{?python_provide:%python_provide python2-%{name}} + +BuildRequires: python2-devel python2-libdnf python2-nose python2-hawkey >= 0.22.0 +BuildRequires: python2-libcomps >= 0.1.8 python2-libdnf >= 0.22.0 +BuildRequires: python2-rpm >= 4.14.0 libmodulemd >= 1.4.0 +BuildRequires: python2-gpg python2-enum34 pyliblzma python2-iniparse +Requires: libmodulemd >= 1.4.0 python2-gpg python2-enum34 +Requires: %{name}-data = %{version}-%{release} deltarpm python2-rpm >= 4.14.0 +Requires: python2-libdnf >= 0.22.0 python2-libcomps >= 0.1.8 +Requires: python2-hawkey >= 0.22.0 python2-libdnf pyliblzma python2-iniparse +Recommends: deltarpm python2-unbound rpm-plugin-systemd-inhibit +Conflicts: dnfdaemon < 0.3.19 + +%description -n python2-dnf +Python2 interface for DNF. +%endif + +%if %{with python3} +%package -n python3-dnf +Summary: Python 3 interface to DNF +%{?python_provide:%python_provide python3-%{name}} + +BuildRequires: python3-hawkey >= 0.22.0 python3-libdnf >= 0.22.0 +BuildRequires: python3-libcomps >= 0.1.8 libmodulemd >= 1.4.0 +BuildRequires: python3-devel python3-libdnf python3-iniparse +BuildRequires: python3-gpg python3-nose python3-rpm >= 4.14.0 +Requires: libmodulemd >= 1.4.0 python3-libdnf >= 0.22.0 +Requires: python3-hawkey >= 0.22.0 %{name}-data = %{version}-%{release} +Requires: python3-libcomps >= 0.1.8 python3-rpm >= 4.14.0 +Requires: python3-iniparse python3-gpg python3-libdnf deltarpm +Recommends: python3-unbound deltarpm rpm-plugin-systemd-inhibit + +%description -n python3-dnf +Python3 interface for DNF. +%endif + +%prep +%autosetup -p1 +mkdir python2 +mkdir python3 + +%build +%if %{with python2} + pushd python2 + %cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python2} + %make_build all doc-man + popd +%endif + +%if %{with python3} + pushd python3 + %cmake .. -DPYTHON_DESIRED:FILEPATH=%{__python3} + %make_build all doc-man + popd +%endif + +%install +%if %{with python2} + pushd python2 + %make_install + popd +%endif + +%if %{with python3} + pushd python3 + %make_install + popd +%endif + +%find_lang %{name} +install -d %{buildroot}{/etc/dnf/vars,/etc/dnf/plugins/,%{_localstatedir}/log/,%{_var}/cache/dnf/} +install -d %{buildroot}%{_sysconfdir}/%{name}/{modules.d,modules.defaults.d} +ln -sr %{buildroot}/etc/dnf/%{name}.conf %{buildroot}%{_sysconfdir}/yum.conf +touch %{buildroot}%{_localstatedir}/log/%{name}.log + +%if %{with python2} +install -d %{buildroot}%{py2pluginpath}/ +%endif +%if %{with python3} +install -d %{buildroot}%{py3pluginpath}/__pycache__/ +%endif + +%if %{with python3} +ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/dnf +mv %{buildroot}%{_bindir}/dnf-automatic-3 %{buildroot}%{_bindir}/dnf-automatic +ln -sr %{buildroot}%{_bindir}/dnf-3 %{buildroot}%{_bindir}/yum +%else +ln -sr %{buildroot}%{_bindir}/dnf-2 %{buildroot}%{_bindir}/dnf +mv %{buildroot}%{_bindir}/dnf-automatic-2 %{buildroot}%{_bindir}/dnf-automatic +ln -sr %{buildroot}%{_bindir}/dnf-2 %{buildroot}%{_bindir}/yum +%endif +rm -vf %{buildroot}%{_bindir}/dnf-automatic-* +install -d %{buildroot}%{_sysconfdir}/yum +ln -sr %{buildroot}/etc/dnf/vars %{buildroot}%{_sysconfdir}/yum/vars +ln -sr %{buildroot}/etc/dnf/plugins %{buildroot}%{_sysconfdir}/yum/pluginconf.d +ln -sr %{buildroot}/etc/dnf/protected.d %{buildroot}%{_sysconfdir}/yum/protected.d + + +%check +%if %{?_with_check:1}%{!?_with_check:0} + %if %{with python2} + pushd python2 + ctest -VV + popd + %endif + + %if %{with python3} + pushd python3 + ctest -VV + popd + %endif +%endif +%post +%systemd_post dnf-makecache.timer +%systemd_post dnf-automatic.timer +%systemd_post dnf-automatic-notifyonly.timer +%systemd_post dnf-automatic-download.timer +%systemd_post dnf-automatic-install.timer + +%preun +%systemd_preun dnf-makecache.timer +%systemd_preun dnf-automatic.timer +%systemd_preun dnf-automatic-notifyonly.timer +%systemd_preun dnf-automatic-download.timer +%systemd_preun dnf-automatic-install.timer + +%postun +%systemd_postun_with_restart dnf-makecache.timer +%systemd_postun_with_restart dnf-automatic.timer +%systemd_postun_with_restart dnf-automatic-notifyonly.timer +%systemd_postun_with_restart dnf-automatic-download.timer +%systemd_postun_with_restart dnf-automatic-install.timer + + +%files -f %{name}.lang +%license COPYING PACKAGE-LICENSING +%doc AUTHORS README.rst +%{_bindir}/%{name} +%{_var}/cache/%{name}/ +%{_unitdir}/%{name}-* +%{_datadir}/bash-completion/completions/%{name} +%{_tmpfilesdir}/%{name}.conf +%{_sysconfdir}/libreport/events.d/collect_dnf.conf +%{_bindir}/%{name}-automatic + +%dir /etc/dnf/{vars,modules.d,modules.defaults.d,protected.d,plugins} +%dir %{_datadir}/bash-completion/completions +%config(noreplace) /etc/dnf/%{name}.conf +%config(noreplace) /etc/dnf/protected.d/%{name}.conf +%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) /etc/dnf/automatic.conf +%ghost %{_localstatedir}/log/hawkey.log +%ghost %{_localstatedir}/log/%{name}.log +%ghost %{_localstatedir}/log/%{name}.librepo.log +%ghost %{_localstatedir}/log/%{name}.rpm.log +%ghost %{_localstatedir}/log/%{name}.plugin.log +%ghost %{_sharedstatedir}/%{name} +%ghost %{_sharedstatedir}/%{name}/groups.json +%ghost %{_sharedstatedir}/%{name}/yumdb +%ghost %{_sharedstatedir}/%{name}/history +%if %{with python3} +%{python3_sitelib}/%{name}/automatic/ +%else +%{python2_sitelib}/%{name}/automatic/ +%endif + +%if %{with python2} +%files -n python2-%{name} +%{_bindir}/%{name}-2 +%{python2_sitelib}/%{name}/ +%dir %{py2pluginpath} +%exclude %{python2_sitelib}/%{name}/automatic +%endif + +%if %{with python3} +%files -n python3-%{name} +%{_bindir}/%{name}-3 +%{python3_sitelib}/%{name}/ +%dir %{py3pluginpath} +%dir %{py3pluginpath}/__pycache__ +%exclude %{python3_sitelib}/%{name}/automatic +%endif + +%files -n yum +%{_bindir}/yum +%{_sysconfdir}/yum.conf +%{_sysconfdir}/yum/{vars,pluginconf.d,protected.d} + +%files help +%{_mandir}/man5/yum.conf.5.* +%{_mandir}/man5/%{name}.conf.5* +%{_mandir}/man8/yum* +%{_mandir}/man8/dnf* + +%changelog +* Fri Sep 20 2019 yanzhihua - 4.0.4-2 +- Package init. +