pungi: Handle missing SRPM

Source packages can be excluded while binary packages should still go
into the compose. This patch makes it so that the mapping from binary
packages to source packages contains None in such case. The code is
already capable of handling that. A warning will be emitted for each
binary package without source.

This also allows us to remove some code from `createSourceHashes` that
is now unused.

A test for excluding source package is added as well.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2016-12-05 09:18:25 +01:00
parent 83428a06bf
commit 56147f2e4d
2 changed files with 37 additions and 21 deletions

View file

@ -741,6 +741,36 @@ class TestPungi(unittest.TestCase):
"dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm",
])
def test_bash_multilib_exclude_source(self):
packages = [
"dummy-bash.+",
"-dummy-bash.src",
]
pkg_map = self.go(packages, None, greedy="none")
self.assertNotIn("dummy-bash-4.2.37-6.src.rpm", pkg_map["srpm"])
self.assertItemsEqual(pkg_map["rpm"], [
"dummy-basesystem-10.0-6.noarch.rpm",
"dummy-bash-4.2.37-6.i686.rpm",
"dummy-filesystem-4.2.37-6.x86_64.rpm",
"dummy-glibc-2.14-5.i686.rpm",
"dummy-glibc-2.14-5.x86_64.rpm",
"dummy-glibc-common-2.14-5.x86_64.rpm",
])
self.assertItemsEqual(pkg_map["srpm"], [
"dummy-basesystem-10.0-6.src.rpm",
"dummy-filesystem-4.2.37-6.src.rpm",
"dummy-glibc-2.14-5.src.rpm",
])
self.assertItemsEqual(pkg_map["debuginfo"], [
"dummy-bash-debuginfo-4.2.37-6.i686.rpm",
"dummy-glibc-debuginfo-2.14-5.i686.rpm",
"dummy-glibc-debuginfo-2.14-5.x86_64.rpm",
"dummy-glibc-debuginfo-common-2.14-5.i686.rpm",
"dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm",
])
def test_bash_multilib_greedy(self):
packages = [
"dummy-bash.+",