Fix package set whitelist
This commit is contained in:
parent
ccb3abf912
commit
a45af95feb
147
0001-gather-Fix-package-set-whitelist.patch
Normal file
147
0001-gather-Fix-package-set-whitelist.patch
Normal file
@ -0,0 +1,147 @@
|
||||
From 56e00505e0f757f2376f6127808f472b3fb67900 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
||||
Date: Fri, 9 Mar 2018 13:45:03 +0100
|
||||
Subject: [PATCH] gather: Fix package set whitelist
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
We need to include all relevant arches, not just the base one (including
|
||||
noarch and src). However the list can be shortened by only listing
|
||||
NEVRs, because that should be unique.
|
||||
|
||||
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
||||
---
|
||||
pungi/gather_dnf.py | 9 ++++-----
|
||||
pungi/phases/gather/methods/method_deps.py | 9 ++++++---
|
||||
tests/test_gather.py | 23 +++++++++--------------
|
||||
tests/test_gather_method_deps.py | 8 ++++----
|
||||
4 files changed, 23 insertions(+), 26 deletions(-)
|
||||
|
||||
diff --git a/pungi/gather_dnf.py b/pungi/gather_dnf.py
|
||||
index f4dda5b3..2c2d7691 100644
|
||||
--- a/pungi/gather_dnf.py
|
||||
+++ b/pungi/gather_dnf.py
|
||||
@@ -19,7 +19,7 @@ from itertools import count
|
||||
import logging
|
||||
import os
|
||||
|
||||
-from kobo.rpmlib import parse_nvra
|
||||
+from kobo.rpmlib import parse_nvra, parse_nvr
|
||||
|
||||
import pungi.common
|
||||
import pungi.dnf_wrapper
|
||||
@@ -374,13 +374,12 @@ class Gather(GatherBase):
|
||||
with Profiler("Gather._apply_excludes():apply-package-whitelist'"):
|
||||
to_keep = []
|
||||
for pattern in self.opts.package_whitelist:
|
||||
- nvra = parse_nvra(pattern)
|
||||
- nvra.pop('src')
|
||||
+ nvr = parse_nvr(pattern)
|
||||
try:
|
||||
- nvra['epoch'] = int(nvra.pop('epoch'))
|
||||
+ nvr['epoch'] = int(nvr.pop('epoch'))
|
||||
except ValueError:
|
||||
pass
|
||||
- to_keep.extend(self._query.filter(**nvra).run())
|
||||
+ to_keep.extend(self._query.filter(**nvr).run())
|
||||
|
||||
for queue in all_queues:
|
||||
setattr(self, queue, getattr(self, queue).filter(pkg=to_keep).latest().apply())
|
||||
diff --git a/pungi/phases/gather/methods/method_deps.py b/pungi/phases/gather/methods/method_deps.py
|
||||
index 1f38f9a1..f6a765a9 100644
|
||||
--- a/pungi/phases/gather/methods/method_deps.py
|
||||
+++ b/pungi/phases/gather/methods/method_deps.py
|
||||
@@ -23,7 +23,7 @@ from kobo.rpmlib import parse_nvra
|
||||
from pungi.util import rmtree, get_arch_variant_data
|
||||
from pungi.wrappers.pungi import PungiWrapper
|
||||
|
||||
-from pungi.arch import tree_arch_to_yum_arch
|
||||
+from pungi.arch import tree_arch_to_yum_arch, get_valid_arches
|
||||
import pungi.phases.gather
|
||||
|
||||
import pungi.phases.gather.method
|
||||
@@ -109,8 +109,11 @@ def write_pungi_config(compose, arch, variant, packages, groups, filter_packages
|
||||
|
||||
package_whitelist = set()
|
||||
if variant.pkgset:
|
||||
- for rpm_obj in variant.pkgset.rpms_by_arch.get(arch, []):
|
||||
- package_whitelist.add(rpm_obj.nevra)
|
||||
+ multilib = get_arch_variant_data(compose.conf, 'multilib', arch, variant)
|
||||
+ for i in get_valid_arches(arch, multilib=multilib, add_noarch=True, add_src=True):
|
||||
+ for rpm_obj in variant.pkgset.rpms_by_arch.get(i, []):
|
||||
+ package_whitelist.add(
|
||||
+ '{0.name}-{1}:{0.version}-{0.release}'.format(rpm_obj, rpm_obj.epoch or 0))
|
||||
|
||||
pungi_wrapper.write_kickstart(
|
||||
ks_path=pungi_cfg, repos=repos, groups=groups, packages=packages_str,
|
||||
diff --git a/tests/test_gather.py b/tests/test_gather.py
|
||||
index 81df6324..1daf3c60 100644
|
||||
--- a/tests/test_gather.py
|
||||
+++ b/tests/test_gather.py
|
||||
@@ -1853,18 +1853,14 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
|
||||
"dummy-bash",
|
||||
]
|
||||
package_whitelist = [
|
||||
- "dummy-basesystem-10.0-6.noarch",
|
||||
- "dummy-basesystem-10.0-6.src",
|
||||
- "dummy-bash-debuginfo-4.2.37-5.x86_64",
|
||||
- "dummy-bash-4.2.37-5.x86_64",
|
||||
- "dummy-bash-4.2.37-5.src",
|
||||
- "dummy-filesystem-4.2.37-6.x86_64",
|
||||
- "dummy-filesystem-4.2.37-6.src",
|
||||
- "dummy-glibc-common-2.14-5.x86_64",
|
||||
- "dummy-glibc-debuginfo-common-2.14-5.x86_64",
|
||||
- "dummy-glibc-debuginfo-2.14-5.x86_64",
|
||||
- "dummy-glibc-2.14-5.x86_64",
|
||||
- "dummy-glibc-2.14-5.src",
|
||||
+ "dummy-basesystem-10.0-6",
|
||||
+ "dummy-bash-debuginfo-4.2.37-5",
|
||||
+ "dummy-bash-4.2.37-5",
|
||||
+ "dummy-filesystem-4.2.37-6",
|
||||
+ "dummy-glibc-common-2.14-5",
|
||||
+ "dummy-glibc-debuginfo-common-2.14-5",
|
||||
+ "dummy-glibc-debuginfo-2.14-5",
|
||||
+ "dummy-glibc-2.14-5",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="none", package_whitelist=package_whitelist)
|
||||
|
||||
@@ -1900,8 +1896,7 @@ class DNFDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
|
||||
def test_package_whitelist(self):
|
||||
packages = ['*']
|
||||
whitelist = [
|
||||
- 'dummy-bash-4.2.37-6.x86_64',
|
||||
- 'dummy-bash-4.2.37-6.src',
|
||||
+ 'dummy-bash-4.2.37-6',
|
||||
]
|
||||
|
||||
pkg_map = self.go(packages, None, package_whitelist=whitelist)
|
||||
diff --git a/tests/test_gather_method_deps.py b/tests/test_gather_method_deps.py
|
||||
index 31bf82b7..0bebb74e 100644
|
||||
--- a/tests/test_gather_method_deps.py
|
||||
+++ b/tests/test_gather_method_deps.py
|
||||
@@ -64,9 +64,9 @@ class TestWritePungiConfig(helpers.PungiTestCase):
|
||||
pkgs = [('pkg1', None), ('pkg2', 'x86_64')]
|
||||
grps = ['grp1']
|
||||
filter = [('pkg3', None), ('pkg4', 'x86_64')]
|
||||
- self.compose.variants['Server'].pkgset.rpms_by_arch['x86_64'] = [
|
||||
- mock.Mock(nevra='pkg-1.0.0-1')
|
||||
- ]
|
||||
+ mock_rpm = mock.Mock(version='1.0.0', release='1', epoch=0)
|
||||
+ mock_rpm.name = 'pkg'
|
||||
+ self.compose.variants['Server'].pkgset.rpms_by_arch['x86_64'] = [mock_rpm]
|
||||
white = mock.Mock()
|
||||
black = mock.Mock()
|
||||
prepopulate = mock.Mock()
|
||||
@@ -81,7 +81,7 @@ class TestWritePungiConfig(helpers.PungiTestCase):
|
||||
repos={'pungi-repo': self.topdir + '/work/x86_64/repo'},
|
||||
exclude_packages=['pkg3', 'pkg4.x86_64'],
|
||||
fulltree_excludes=fulltree,
|
||||
- package_whitelist=set(['pkg-1.0.0-1']))
|
||||
+ package_whitelist=set(['pkg-0:1.0.0-1']))
|
||||
|
||||
@mock.patch('pungi.phases.gather.methods.method_deps.PungiWrapper')
|
||||
def test_without_input(self, PungiWrapper):
|
||||
--
|
||||
2.13.6
|
||||
|
@ -1,6 +1,6 @@
|
||||
Name: pungi
|
||||
Version: 4.1.22
|
||||
Release: 7%{?dist}
|
||||
Release: 8%{?dist}
|
||||
Summary: Distribution compose tool
|
||||
|
||||
Group: Development/Tools
|
||||
@ -15,6 +15,7 @@ Patch4: 0005-Write-package-whitelist-for-each-variant.patch
|
||||
Patch5: 0006-gather-Honor-package-whitelist.patch
|
||||
Patch6: 0007-pkgset-Remove-check-for-unique-name.patch
|
||||
Patch7: 0008-pkgset-Merge-initial-package-set-without-checks.patch
|
||||
Patch8: 0001-gather-Fix-package-set-whitelist.patch
|
||||
BuildRequires: python3-nose
|
||||
BuildRequires: python3-mock
|
||||
BuildRequires: python2-devel
|
||||
@ -175,6 +176,9 @@ rm -rf %{buildroot}%{python2_sitelib}/%{name}_utils
|
||||
%{_bindir}/%{name}-wait-for-signed-ostree-handler
|
||||
|
||||
%changelog
|
||||
* Fri Mar 09 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.22-8
|
||||
- Fix package set whitelist
|
||||
|
||||
* Thu Mar 08 2018 Lubomír Sedlář <lsedlar@redhat.com> - 4.1.22-7
|
||||
- image-build: Accept tar.xz extension for docker images
|
||||
- Allow multiple versions of the same package in package set
|
||||
|
Loading…
Reference in New Issue
Block a user