From 6c74fc9cbbb7aa6aa51c06d042eed90c859255d4 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Aug 07 2020 18:28:45 +0000 Subject: import dnf-plugins-core-4.0.17-5.el8 --- diff --git a/SOURCES/0007-reposync-Add-latest-NEVRAs-per-stream-to-download-RhBug-1833074.patch b/SOURCES/0007-reposync-Add-latest-NEVRAs-per-stream-to-download-RhBug-1833074.patch new file mode 100644 index 0000000..583c949 --- /dev/null +++ b/SOURCES/0007-reposync-Add-latest-NEVRAs-per-stream-to-download-RhBug-1833074.patch @@ -0,0 +1,96 @@ +From 37d60b626fcb3e3f68b02c2c24e4ae5149cf223f Mon Sep 17 00:00:00 2001 +From: Marek Blaha +Date: Thu, 23 Jul 2020 16:27:22 +0200 +Subject: [PATCH] [reposync] Add latest NEVRAs per stream to download (RhBug: + 1833074) + +This covers situation when package with the newest NEVRA is part of +an older version of a stream and reposync was used with --newest-only +switch. +With this patch these package versions are going to be downloaded: +- the latest NEVRAs from non-modular packages +- all packages from stream version with the latest package NEVRA (in + case the latest NEVRA is part of multiple stream versions only the + highest is downloaded) +- all packages from the latest stream version + +https://bugzilla.redhat.com/show_bug.cgi?id=1833074 +--- + plugins/reposync.py | 53 ++++++++++++++++++++++++++++++++++++--------- + 1 file changed, 43 insertions(+), 10 deletions(-) + +diff --git a/plugins/reposync.py b/plugins/reposync.py +index 548a05b4..7556e7eb 100644 +--- a/plugins/reposync.py ++++ b/plugins/reposync.py +@@ -207,27 +207,60 @@ def download_metadata(self, repo): + + def _get_latest(self, query): + """ +- return query with latest nonmodular package and all packages from latest version per stream ++ return union of these queries: ++ - the latest NEVRAs from non-modular packages ++ - all packages from stream version with the latest package NEVRA ++ (this should not be needed but the latest package NEVRAs might be ++ part of an older module version) ++ - all packages from the latest stream version + """ + if not dnf.base.WITH_MODULES: + return query.latest() ++ + query.apply() + module_packages = self.base._moduleContainer.getModulePackages() + all_artifacts = set() + module_dict = {} # {NameStream: {Version: [modules]}} ++ artifact_version = {} # {artifact: {NameStream: [Version]}} + for module_package in module_packages: +- all_artifacts.update(module_package.getArtifacts()) ++ artifacts = module_package.getArtifacts() ++ all_artifacts.update(artifacts) + module_dict.setdefault(module_package.getNameStream(), {}).setdefault( + module_package.getVersionNum(), []).append(module_package) +- non_modular_latest = query.filter( ++ for artifact in artifacts: ++ artifact_version.setdefault(artifact, {}).setdefault( ++ module_package.getNameStream(), []).append(module_package.getVersionNum()) ++ ++ # the latest NEVRAs from non-modular packages ++ latest_query = query.filter( + pkg__neq=query.filter(nevra_strict=all_artifacts)).latest() +- latest_artifacts = set() +- for version_dict in module_dict.values(): +- keys = sorted(version_dict.keys(), reverse=True) +- for module in version_dict[keys[0]]: +- latest_artifacts.update(module.getArtifacts()) +- latest_modular_query = query.filter(nevra_strict=latest_artifacts) +- return latest_modular_query.union(non_modular_latest) ++ ++ # artifacts from the newest version and those versions that contain an artifact ++ # with the highest NEVRA ++ latest_stream_artifacts = set() ++ for namestream, version_dict in module_dict.items(): ++ # versions that will be synchronized ++ versions = set() ++ # add the newest stream version ++ versions.add(sorted(version_dict.keys(), reverse=True)[0]) ++ # collect all artifacts in all stream versions ++ stream_artifacts = set() ++ for modules in version_dict.values(): ++ for module in modules: ++ stream_artifacts.update(module.getArtifacts()) ++ # find versions to which the packages with the highest NEVRAs belong ++ for latest_pkg in query.filter(nevra_strict=stream_artifacts).latest(): ++ # here we depend on modules.yaml allways containing full NEVRA (including epoch) ++ nevra = "{0.name}-{0.epoch}:{0.version}-{0.release}.{0.arch}".format(latest_pkg) ++ # download only highest version containing the latest artifact ++ versions.add(max(artifact_version[nevra][namestream])) ++ # add all artifacts from selected versions for synchronization ++ for version in versions: ++ for module in version_dict[version]: ++ latest_stream_artifacts.update(module.getArtifacts()) ++ latest_query = latest_query.union(query.filter(nevra_strict=latest_stream_artifacts)) ++ ++ return latest_query + + def get_pkglist(self, repo): + query = self.base.sack.query(flags=hawkey.IGNORE_MODULAR_EXCLUDES).available().filterm( diff --git a/SPECS/dnf-plugins-core.spec b/SPECS/dnf-plugins-core.spec index 44dfd49..90d8492 100644 --- a/SPECS/dnf-plugins-core.spec +++ b/SPECS/dnf-plugins-core.spec @@ -32,7 +32,7 @@ Name: dnf-plugins-core Version: 4.0.17 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Core Plugins for DNF License: GPLv2+ URL: https://github.com/rpm-software-management/dnf-plugins-core @@ -43,6 +43,7 @@ Patch3: 0003-debug-Use-standard-demands.resolving-for-transaction.patch Patch4: 0004-Reorder-options-in-dnf-debug-man-page-alphabetically.patch Patch5: 0005-debug-Do-not-remove-install-only-packages-RhBug-1844.patch Patch6: 0006-Update-translations-RhBug-1820546.patch +Patch7: 0007-reposync-Add-latest-NEVRAs-per-stream-to-download-RhBug-1833074.patch BuildArch: noarch BuildRequires: cmake BuildRequires: gettext @@ -748,6 +749,9 @@ PYTHONPATH=./plugins nosetests-%{python3_version} -s tests/ %endif %changelog +* Wed Aug 05 2020 Nicola Sella - 4.0.17-5 +- [reposync] Add latest NEVRAs per stream to download (RhBug: 1833074) + * Tue Jul 28 2020 Marek Blaha - 4.0.17-4 - Debug-restore command do not remove installonly packages (RhBug:1844533) - Update translations (RhBug:1820546)