#3 Merge upstream changes for Hyperscale
Merged a year ago by dcavalca. Opened a year ago by dcavalca.
rpms/ dcavalca/dnf c8s-sig-hyperscale  into  c8s-sig-hyperscale

@@ -0,0 +1,114 @@ 

+ From f1fbef17862e033bf9518bd318339b405f2664dd Mon Sep 17 00:00:00 2001

+ From: Nicola Sella <nsella@redhat.com>

+ Date: Mon, 22 Mar 2021 17:37:51 +0100

+ Subject: [PATCH 1/2] Better explain traceback of rpm.error with dnf

+ 

+ =changelog=

+ msg: Add dnf.error message to explain rpm.error traceback when package not found after resolving a transaction

+ type: bugfix

+ resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1815327

+ resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1887293

+ resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1909845

+ ---

+  dnf/db/group.py | 78 ++++++++++++++++++++++++++-----------------------

+  1 file changed, 41 insertions(+), 37 deletions(-)

+ 

+ diff --git a/dnf/db/group.py b/dnf/db/group.py

+ index 312e3b98..3a17019a 100644

+ --- a/dnf/db/group.py

+ +++ b/dnf/db/group.py

+ @@ -26,6 +26,7 @@ import dnf.exceptions

+  from dnf.i18n import _

+  from dnf.util import logger

+  

+ +import rpm

+  

+  class PersistorBase(object):

+      def __init__(self, history):

+ @@ -316,43 +317,46 @@ class RPMTransaction(object):

+          modular_problems = 0

+  

+          for tsi in self:

+ -            if tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADE:

+ -                hdr = tsi.pkg._header

+ -                modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ -                ts.addInstall(hdr, tsi, 'u')

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADED:

+ -                ts.addErase(tsi.pkg.idx)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_INSTALL:

+ -                hdr = tsi.pkg._header

+ -                modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ -                ts.addInstall(hdr, tsi, 'i')

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETE:

+ -                hdr = tsi.pkg._header

+ -                modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ -                ts.addInstall(hdr, tsi, 'u')

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETED:

+ -                ts.addErase(tsi.pkg.idx)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALL:

+ -                # note: in rpm 4.12 there should not be set

+ -                # rpm.RPMPROB_FILTER_REPLACEPKG to work

+ -                hdr = tsi.pkg._header

+ -                modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ -                ts.addReinstall(hdr, tsi)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALLED:

+ -                # Required when multiple packages with the same NEVRA marked as installed

+ -                ts.addErase(tsi.pkg.idx)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_REMOVE:

+ -                ts.addErase(tsi.pkg.idx)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADE:

+ -                hdr = tsi.pkg._header

+ -                modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ -                ts.addInstall(hdr, tsi, 'u')

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADED:

+ -                ts.addErase(tsi.pkg.idx)

+ -            elif tsi.action == libdnf.transaction.TransactionItemAction_REASON_CHANGE:

+ -                pass

+ -            else:

+ -                raise RuntimeError("TransactionItemAction not handled: %s" % tsi.action)

+ +            try:

+ +                if tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADE:

+ +                    hdr = tsi.pkg._header

+ +                    modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ +                    ts.addInstall(hdr, tsi, 'u')

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_DOWNGRADED:

+ +                    ts.addErase(tsi.pkg.idx)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_INSTALL:

+ +                    hdr = tsi.pkg._header

+ +                    modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ +                    ts.addInstall(hdr, tsi, 'i')

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETE:

+ +                    hdr = tsi.pkg._header

+ +                    modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ +                    ts.addInstall(hdr, tsi, 'u')

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_OBSOLETED:

+ +                    ts.addErase(tsi.pkg.idx)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALL:

+ +                    # note: in rpm 4.12 there should not be set

+ +                    # rpm.RPMPROB_FILTER_REPLACEPKG to work

+ +                    hdr = tsi.pkg._header

+ +                    modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ +                    ts.addReinstall(hdr, tsi)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_REINSTALLED:

+ +                    # Required when multiple packages with the same NEVRA marked as installed

+ +                    ts.addErase(tsi.pkg.idx)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_REMOVE:

+ +                    ts.addErase(tsi.pkg.idx)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADE:

+ +                    hdr = tsi.pkg._header

+ +                    modular_problems += self._test_fail_safe(hdr, tsi.pkg)

+ +                    ts.addInstall(hdr, tsi, 'u')

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_UPGRADED:

+ +                    ts.addErase(tsi.pkg.idx)

+ +                elif tsi.action == libdnf.transaction.TransactionItemAction_REASON_CHANGE:

+ +                    pass

+ +                else:

+ +                    raise RuntimeError("TransactionItemAction not handled: %s" % tsi.action)

+ +            except rpm.error as e:

+ +                raise dnf.exceptions.Error(_("An rpm exception occurred: %s" % e))

+          if modular_problems:

+              raise dnf.exceptions.Error(_("No available modular metadata for modular package"))

+  

+ -- 

+ 2.39.0

+ 

@@ -0,0 +1,50 @@ 

+ From 23742561dcb168604d9668815a8c1ebbdf516d39 Mon Sep 17 00:00:00 2001

+ From: Jan Kolarik <jkolarik@redhat.com>

+ Date: Wed, 23 Nov 2022 08:44:41 +0000

+ Subject: [PATCH 2/2] Ignore processing variable files with unsupported

+  encoding (RhBug:2141215)

+ 

+ This issue could be seen for example when there are some temporary files stored by text editors in the `/etc/dnf/vars` folder. These files could be in the binary format and causes `UnicodeDecodeError` exception to be thrown during processing of the var files.

+ 

+ = changelog =

+ type: bugfix

+ resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2141215

+ ---

+  dnf/conf/substitutions.py | 9 ++++++---

+  1 file changed, 6 insertions(+), 3 deletions(-)

+ 

+ diff --git a/dnf/conf/substitutions.py b/dnf/conf/substitutions.py

+ index 1281bdf0..4d0f0d55 100644

+ --- a/dnf/conf/substitutions.py

+ +++ b/dnf/conf/substitutions.py

+ @@ -18,13 +18,15 @@

+  # Red Hat, Inc.

+  #

+  

+ +import logging

+  import os

+  import re

+  

+ -import dnf

+ -import dnf.exceptions

+ +from dnf.i18n import _

+  

+  ENVIRONMENT_VARS_RE = re.compile(r'^DNF_VAR_[A-Za-z0-9_]+$')

+ +logger = logging.getLogger('dnf')

+ +

+  

+  class Substitutions(dict):

+      # :api

+ @@ -60,7 +62,8 @@ class Substitutions(dict):

+                              val = fp.readline()

+                          if val and val[-1] == '\n':

+                              val = val[:-1]

+ -                    except (OSError, IOError):

+ +                    except (OSError, IOError, UnicodeDecodeError) as e:

+ +                        logger.warning(_("Error when parsing a variable from file '{0}': {1}").format(filepath, e))

+                          continue

+                  if val is not None:

+                      self[fsvar] = val

+ -- 

+ 2.39.0

+ 

file added
+43
@@ -0,0 +1,43 @@ 

+ From 06b0081220d7e85134c61e6c86e723eb4a34b535 Mon Sep 17 00:00:00 2001

+ From: Matthew Almond <malmond@fb.com>

+ Date: Fri, 30 Apr 2021 13:11:04 -0700

+ Subject: [PATCH] Do not assume that a remote rpm is complete if present

+ 

+ We should not assume that a file present in the hashed directory for a remote

+ url is complete if present.

+ 

+ This manifests in two ways:

+ 

+ 1. `Can not load RPM file: ` if the headers are incomplete

+ 2. `Payload SHA256 digest: BAD` error otherwise

+ 

+ This isn't a common error in the field because most sites use `keepcache=0` in

+ `dnf.conf`. On the latter error the broken RPM is deleted, and the next run

+ will retry the download from scratch, and probably succeeding.

+ 

+ This impacts us because we use `keepcache=1` so once we get an interrupted

+ download, we can't (automatically) recover.

+ 

+ The fix here forces us to try to download/resume the file even if present on

+ disk, because we don't have any higher level metadata like digests to falsify

+ downloads without network.

+ 

+ This change makes an explicit decision to try to be more correct instead of

+ using an incomplete optimization.

+ ---

+  dnf/util.py | 2 --

+  1 file changed, 2 deletions(-)

+ 

+ diff --git a/dnf/util.py b/dnf/util.py

+ index b9dcd47081..9f0eb4abd2 100644

+ --- a/dnf/util.py

+ +++ b/dnf/util.py

+ @@ -88,8 +88,6 @@ def _urlopen_progress(url, conf, progress=None):

+      if progress is None:

+          progress = dnf.callback.NullDownloadProgress()

+      pload = dnf.repo.RemoteRPMPayload(url, conf, progress)

+ -    if os.path.exists(pload.local_path):

+ -        return pload.local_path

+      est_remote_size = sum([pload.download_size])

+      progress.start(1, est_remote_size)

+      targets = [pload._librepo_target()]

file modified
+53 -1
@@ -66,7 +66,7 @@ 

  

  Name:           dnf

  Version:        4.7.0

- Release:        14%{?dist}

+ Release:        15.1%{?dist}

  Summary:        %{pkg_summary}

  # For a breakdown of the licensing, see PACKAGE-LICENSING

  License:        GPLv2+
@@ -113,8 +113,16 @@ 

  Patch0035:      0035-Move-system-upgrade-plugin-to-core-RhBug-2054235.patch

  Patch0036:      0036-Add-support-for-rollback-of-group-upgrade-rollback-R.patch

  Patch0037:      0037-Document-changes-to-offline-upgrade-command.patch

+ Patch0038:      0038-Better-explain-traceback-of-rpm.error-with-dnf.patch

+ Patch0039:      0039-Ignore-processing-variable-files-with-unsupported-en.patch

  

  

+ 

+ Patch9998:      https://github.com/rpm-software-management/dnf/pull/1761.patch

+ Provides:       dnf(pr1761)

+ Requires:       libdnf(pr1164)

+ Provides:       dnf(pr1743)

+ 

  BuildArch:      noarch

  BuildRequires:  cmake

  BuildRequires:  gettext
@@ -413,9 +421,22 @@ 

  %{python3_sitelib}/%{name}/automatic/

  

  %changelog

+ * Thu Jan 19 2023 Davide Cavalca <dcavalca@centosproject.org> - 4.7.0-15.1

+ - Rebuild for Hyperscale

+ 

+ * Thu Jan 05 2023 Nicola Sella <nsella@redhat.com> - 4.7.0-15

+ - Ignore processing variable files with unsupported encoding (RhBug:2141215)

+ - Better explain traceback of rpm.error with dnf

+ 

+ * Fri Dec 16 2022 Davide Cavalca <dcavalca@centosproject.org> - 4.7.0-14.1

+ - Rebuild for Hyperscale

+ 

  * Wed Nov 30 2022 Nicola Sella <nsella@redhat.com> - 4.7.0-14

  - Document changes to offline-upgrade command (RhBug:1939975,2139324)

  

+ * Tue Nov 29 2022 Davide Cavalca <dcavalca@centosproject.org> - 4.7.0-13.1

+ - Rebuild for Hyperscale

+ 

  * Wed Oct 26 2022 Nicola Sella <nsella@redhat.com> - 4.7.0-13

  - Add support for rollback of group upgrade rollback (RhBug:2016070)

  - Move system-upgrade plugin to core (RhBug:2054235)
@@ -430,15 +451,24 @@ 

  - Set default value for variable to prevent crash (RhBug:2091636)

  - Don't include resolved advisories for obsoletes with sec. filters (RhBug:2101421)

  

+ * Tue Aug 02 2022 Manu Bretelle  <chantra@fb.com> - 4.7.0-11.1

+ - Rebuild for Hyperscale

+ 

  * Tue Jul 19 2022 Lukas Hrazky <lhrazky@redhat.com> - 4.7.0-11

  - [doc] Describe how gpg keys are stored for `repo_ggpcheck`

  - Add only relevant pkgs to upgrade transaction (RhBug:2097757)

  

+ * Wed Jun 01 2022 Manu Bretelle  <chantra@fb.com> - 4.7.0-10.1

+ - Rebuild for Hyperscale

+ 

  * Tue May 24 2022 Richard W.M. Jones <rjones@redhat.com> - 4.7.0-10

  - Backport fix for leaks of libsolv's page file descriptors in Base object

    resolves: rhbz#2087734

  - Include instructions for regenerating patches.

  

+ * Mon May 16 2022 Manu Bretelle <chantra@fb.com> - 4.7.0-9.1

+ - Rebuild for Hyperscale

+ 

  * Wed May 04 2022 Lukas Hrazky <lhrazky@redhat.com> - 4.7.0-8

  - Add documentation for query api flags

  - Fix processing of download errors
@@ -446,6 +476,9 @@ 

  - Fix remove when no repos are enabled

  - Improve "proxy" configuration option documentation

  

+ * Tue Feb 01 2022 Manu Bretelle <chantra@fb.com> - 4.7.0-5.1

+ - Rebuild for Hyperscale

+ 

  * Fri Jan 14 2022 Pavla Kratochvilova <pkratoch@redhat.com> - 4.7.0-7

  - Rebuild with new release number

  
@@ -462,6 +495,13 @@ 

  - [doc] Improve description of multilib_policy=all (RhBug:1996681,1995630)

  - [doc] Document default colors

  

+ * Fri Oct  1 2021 Neal Gompa <ngompa@centosproject.org> - 4.7.0-4.1

+ - Merge 4.7.0 update into hsx branch

+ - See 4.4.2-11.2..3 for changes

+ 

+ * Mon Sep 13 2021 Marek Blaha <mblaha@redhat.com> - 4.7.0-4

+ - Update translations (RhBug:1961632)

+ 

  * Mon Aug 16 2021 Pavla Kratochvilova <pkratoch@redhat.com> - 4.7.0-3

  - Improve signature checking using rpmkeys (RhBug:1967454)

  
@@ -499,6 +539,18 @@ 

  - [doc] Add documentation for config option sslverifystatus (RhBug:1814383)

  - The noroot plugin no longer exists, remove mention

  

+ * Fri Apr 30 2021 Matthew Almond <malmond@fb.com> - 4.4.2-11.3

+ - PR1761 bugfix

+ 

+ * Wed Mar 24 2021 Matthew Almond <malmond@fb.com> - 4.4.2-11.2

+ - Back out change on conflicts_dnf_plugins_core_version

+ 

+ * Wed Mar 17 2021 Matthew Almond <malmond@fb.com> - 4.4.2-11.1

+ - PR1743 bugfix (RhBug:1935465)

+ 

+ * Mon Mar 8 2021 Marek Blaha <mblaha@redhat.com> - 4.4.2-11

+ - Update translations

+ 

  * Thu Feb 11 2021 Nicola Sella <nsella@redhat.com> - 4.4.2-10

  - Allow stream switching if option enabled