Refactor depsolving tests
This adds a new test for Requires(pre) and (post). The general structure of the test now makes it easy to use the same test scenarios for different backend. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
e00776a413
commit
ad23efd323
42
tests/data/specs/dummy-perl.spec
Normal file
42
tests/data/specs/dummy-perl.spec
Normal file
@ -0,0 +1,42 @@
|
||||
Name: dummy-perl
|
||||
Version: 1.0.0
|
||||
Release: 1
|
||||
License: LGPLv2
|
||||
Summary: A dummy perl package
|
||||
Requires(pre): dummy-perl-macros
|
||||
Requires(post): dummy-perl-utils
|
||||
|
||||
%description
|
||||
A dummy perl package. This packages demonstrates a Requires(pre) and
|
||||
Requires(post) dependencies.
|
||||
|
||||
%package macros
|
||||
Summary: A dummy perl-macros package
|
||||
|
||||
%description macros
|
||||
A dummy perl-macros package
|
||||
|
||||
%package utils
|
||||
Summary: A dummy perl-utils package
|
||||
|
||||
%description utils
|
||||
A dummy perl-utils package
|
||||
|
||||
|
||||
%build
|
||||
echo OK
|
||||
|
||||
|
||||
%install
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
mkdir $RPM_BUILD_ROOT
|
||||
|
||||
|
||||
%files
|
||||
%files macros
|
||||
%files utils
|
||||
|
||||
|
||||
%changelog
|
||||
* Mon Jan 23 2017 Lubomír Sedlář <lsedlar@redhat.com> - 1.0.0-1
|
||||
- First release
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
74
tests/fixtures/repos/repo/repodata/repomd.xml
vendored
74
tests/fixtures/repos/repo/repodata/repomd.xml
vendored
@ -1,68 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<repomd xmlns="http://linux.duke.edu/metadata/repo" xmlns:rpm="http://linux.duke.edu/metadata/rpm">
|
||||
<revision>1478526049</revision>
|
||||
<revision>1485161230</revision>
|
||||
<data type="primary">
|
||||
<checksum type="sha256">94431f15fa198cae4d31bf81c9714060e413c909b95d19ff0f9e00750b373b77</checksum>
|
||||
<open-checksum type="sha256">6f364ce3b49fbed06d4d4cc001680b14f4a7c43b9e105a82a3e77c9b3af95389</open-checksum>
|
||||
<location href="repodata/94431f15fa198cae4d31bf81c9714060e413c909b95d19ff0f9e00750b373b77-primary.xml.gz"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>32414</size>
|
||||
<open-size>445535</open-size>
|
||||
<checksum type="sha256">533b28e88605f4f7885c9960e4853880ea1aef04520789b32f4b57aeb753256b</checksum>
|
||||
<open-checksum type="sha256">ffa22f7a92f2fa74630991aca101d92199a4b94ed2ba603e3ea1b387a9566787</open-checksum>
|
||||
<location href="repodata/533b28e88605f4f7885c9960e4853880ea1aef04520789b32f4b57aeb753256b-primary.xml.gz"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>34095</size>
|
||||
<open-size>466292</open-size>
|
||||
</data>
|
||||
<data type="filelists">
|
||||
<checksum type="sha256">4305042fb21c392795638a1c79ec4a83d00b9dbef8cd79b06a4c4f1cd2c47235</checksum>
|
||||
<open-checksum type="sha256">7c5c4df0b7d944e5d9cff8d8297d132f111e782710d6a1d99b33389f664e52b0</open-checksum>
|
||||
<location href="repodata/4305042fb21c392795638a1c79ec4a83d00b9dbef8cd79b06a4c4f1cd2c47235-filelists.xml.gz"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>19949</size>
|
||||
<open-size>74441</open-size>
|
||||
<checksum type="sha256">4c995ec134786879990c65dbb2e7e775ff4b532430b2c16906601403d42ffd9e</checksum>
|
||||
<open-checksum type="sha256">8e4c5a5bc1feb12efda69e702f7b10484feca644a252e47380c45468e5607893</open-checksum>
|
||||
<location href="repodata/4c995ec134786879990c65dbb2e7e775ff4b532430b2c16906601403d42ffd9e-filelists.xml.gz"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>20860</size>
|
||||
<open-size>77731</open-size>
|
||||
</data>
|
||||
<data type="other">
|
||||
<checksum type="sha256">76ebb27d2d8e584aee9ade778d0f4908a9675e15bcb61e12dc687b6a98c9a20c</checksum>
|
||||
<open-checksum type="sha256">5aa769f272cdb4cdccc13f9e1dfa74f6b2551dd25589b8fed9872c72c1bb3fcb</open-checksum>
|
||||
<location href="repodata/76ebb27d2d8e584aee9ade778d0f4908a9675e15bcb61e12dc687b6a98c9a20c-other.xml.gz"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>19950</size>
|
||||
<open-size>118659</open-size>
|
||||
<checksum type="sha256">feafc4d56b8fb78d13f439739f9d29b9be03a916c22e6685c62f0cd675895c93</checksum>
|
||||
<open-checksum type="sha256">f4d2786206236d1dcab923430b63be2b74efe8945b219c5633a2d12d2cd42714</open-checksum>
|
||||
<location href="repodata/feafc4d56b8fb78d13f439739f9d29b9be03a916c22e6685c62f0cd675895c93-other.xml.gz"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>20924</size>
|
||||
<open-size>124502</open-size>
|
||||
</data>
|
||||
<data type="primary_db">
|
||||
<checksum type="sha256">0dff37e23a0af5dc33002460679b56b3b6af6ec9a36981c8377b44223724e549</checksum>
|
||||
<open-checksum type="sha256">4e7b4ec0f5d7814815f340866726e08c3fcfd14d0ff3d72bac92b6d416e8a0a3</open-checksum>
|
||||
<location href="repodata/0dff37e23a0af5dc33002460679b56b3b6af6ec9a36981c8377b44223724e549-primary.sqlite.bz2"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>57779</size>
|
||||
<open-size>368640</open-size>
|
||||
<checksum type="sha256">d08dfb319143d0105b89413a47a0b2c8e593177f1c7975371c8205830022d53f</checksum>
|
||||
<open-checksum type="sha256">7d7e06557c5e72c26da77d083535ff58eaae5b3b39a9b71290e77c4ad8f061ef</open-checksum>
|
||||
<location href="repodata/d08dfb319143d0105b89413a47a0b2c8e593177f1c7975371c8205830022d53f-primary.sqlite.bz2"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>60355</size>
|
||||
<open-size>385024</open-size>
|
||||
<database_version>10</database_version>
|
||||
</data>
|
||||
<data type="filelists_db">
|
||||
<checksum type="sha256">fa89c463e1653f2544468cec48512d57501b9a72c129b9faed2f353cf2e82a3b</checksum>
|
||||
<open-checksum type="sha256">ae73ede0c0fedc9925a1075c4d777d80613011e29066f93675a67c2d64003d4c</open-checksum>
|
||||
<location href="repodata/fa89c463e1653f2544468cec48512d57501b9a72c129b9faed2f353cf2e82a3b-filelists.sqlite.bz2"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>25770</size>
|
||||
<checksum type="sha256">ad397a2c81b435e542abd99d03cee9a7a656e2bd4f0f5709b809a3b1e63a25f9</checksum>
|
||||
<open-checksum type="sha256">4ce4ef65edc7d09f2b04e693b25c8165ad367b2a58b1e339d1c3ed29726fbd80</open-checksum>
|
||||
<location href="repodata/ad397a2c81b435e542abd99d03cee9a7a656e2bd4f0f5709b809a3b1e63a25f9-filelists.sqlite.bz2"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>26824</size>
|
||||
<open-size>94208</open-size>
|
||||
<database_version>10</database_version>
|
||||
</data>
|
||||
<data type="other_db">
|
||||
<checksum type="sha256">fc348dcd0e073c1ff457bd72617a1ef8274a2b9b74a82167e299af57525223e7</checksum>
|
||||
<open-checksum type="sha256">a7163e921e14be31ac532c3130c558eb3a12b282fc7b7c08dbf8d50c19f85dc0</open-checksum>
|
||||
<location href="repodata/fc348dcd0e073c1ff457bd72617a1ef8274a2b9b74a82167e299af57525223e7-other.sqlite.bz2"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<size>29797</size>
|
||||
<checksum type="sha256">ea44f7f31f7c5e34380b842fc69cef78bb47c711fbfdb22bd27b3e8dde88e0cf</checksum>
|
||||
<open-checksum type="sha256">ce923cd27d43422f7e22e728e7e652af8a36772211f35f0868f01acef926391c</open-checksum>
|
||||
<location href="repodata/ea44f7f31f7c5e34380b842fc69cef78bb47c711fbfdb22bd27b3e8dde88e0cf-other.sqlite.bz2"/>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>31113</size>
|
||||
<open-size>122880</open-size>
|
||||
<database_version>10</database_version>
|
||||
</data>
|
||||
<data type="group">
|
||||
<checksum type="sha256">cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077</checksum>
|
||||
<location href="repodata/cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077-dummy-comps.xml"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>5178</size>
|
||||
</data>
|
||||
<data type="group_gz">
|
||||
<checksum type="sha256">2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35</checksum>
|
||||
<open-checksum type="sha256">cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077</open-checksum>
|
||||
<location href="repodata/2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35-dummy-comps.xml.gz"/>
|
||||
<timestamp>1478526049</timestamp>
|
||||
<timestamp>1485161230</timestamp>
|
||||
<size>1244</size>
|
||||
<open-size>5178</open-size>
|
||||
</data>
|
||||
|
@ -32,49 +32,17 @@ def convert_pkg_map(data):
|
||||
return result
|
||||
|
||||
|
||||
class TestPungi(unittest.TestCase):
|
||||
class DepsolvingBase(object):
|
||||
|
||||
def setUp(self):
|
||||
self.tmp_dir = tempfile.mkdtemp(prefix="test_compose_")
|
||||
self.repo = os.path.join(os.path.dirname(__file__), "fixtures/repos/repo")
|
||||
self.lookaside = os.path.join(os.path.dirname(__file__),
|
||||
"fixtures/repos/repo-krb5-lookaside")
|
||||
self.ks = os.path.join(self.tmp_dir, "ks")
|
||||
self.out = os.path.join(self.tmp_dir, "out")
|
||||
logger = logging.getLogger('Pungi')
|
||||
if not logger.handlers:
|
||||
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
console.setFormatter(formatter)
|
||||
console.setLevel(logging.INFO)
|
||||
logger.addHandler(console)
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.tmp_dir)
|
||||
|
||||
def go(self, packages, groups, repo=None, lookaside=None, prepopulate=None,
|
||||
multilib_whitelist=None, **kwargs):
|
||||
"""
|
||||
Write a kickstart with given packages and groups, then run the
|
||||
depsolving and parse the output.
|
||||
"""
|
||||
p = PungiWrapper()
|
||||
repos = {"repo": repo or self.repo}
|
||||
if lookaside:
|
||||
repos['lookaside'] = lookaside
|
||||
p.write_kickstart(self.ks, repos, groups, packages, prepopulate=prepopulate,
|
||||
multilib_whitelist=multilib_whitelist)
|
||||
kwargs.setdefault('cache_dir', self.tmp_dir)
|
||||
# Unless the test specifies an arch, we need to default to x86_64.
|
||||
# Otherwise the arch of current machine will be used, which will cause
|
||||
# failure most of the time.
|
||||
kwargs.setdefault('arch', 'x86_64')
|
||||
|
||||
p.run_pungi(self.ks, self.tmp_dir, 'DP', **kwargs)
|
||||
with open(self.out, "r") as f:
|
||||
pkg_map = p.get_packages(f.read())
|
||||
return convert_pkg_map(pkg_map)
|
||||
|
||||
def test_kernel(self):
|
||||
packages = [
|
||||
"dummy-kernel",
|
||||
@ -109,6 +77,23 @@ class TestPungi(unittest.TestCase):
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [])
|
||||
|
||||
def test_kernel_fulltree_excludes(self):
|
||||
packages = [
|
||||
"dummy-kernel",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="none", fulltree=True,
|
||||
fulltree_excludes=['dummy-kernel'])
|
||||
|
||||
self.assertNotIn("dummy-kernel-3.1.0-1.i686.rpm", pkg_map["rpm"])
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-kernel-3.1.0-1.x86_64.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["srpm"], [
|
||||
"dummy-kernel-3.1.0-1.src.rpm"
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [])
|
||||
|
||||
def test_kernel_doc_fulltree(self):
|
||||
packages = [
|
||||
"dummy-kernel-doc",
|
||||
@ -408,7 +393,7 @@ class TestPungi(unittest.TestCase):
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_smtpdaemon_greedy(self):
|
||||
def test_smtpdaemon_greedy_all(self):
|
||||
packages = [
|
||||
"dummy-vacation",
|
||||
]
|
||||
@ -450,6 +435,95 @@ class TestPungi(unittest.TestCase):
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_smtpdaemon_greedy_all_explicit_postfix(self):
|
||||
# Postfix provides smtpdaemon, but we still want sendmail in because we
|
||||
# are greedy.
|
||||
packages = [
|
||||
"dummy-postfix",
|
||||
"dummy-vacation",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="all")
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-basesystem-10.0-6.noarch.rpm",
|
||||
"dummy-filesystem-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.i686.rpm",
|
||||
"dummy-glibc-common-2.14-5.x86_64.rpm",
|
||||
"dummy-postfix-2.9.2-2.i686.rpm",
|
||||
"dummy-postfix-2.9.2-2.x86_64.rpm",
|
||||
"dummy-sendmail-8.14.5-12.i686.rpm",
|
||||
"dummy-sendmail-8.14.5-12.x86_64.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.i686.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.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",
|
||||
"dummy-postfix-2.9.2-2.src.rpm",
|
||||
"dummy-sendmail-8.14.5-12.src.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.src.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [
|
||||
"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",
|
||||
"dummy-postfix-debuginfo-2.9.2-2.i686.rpm",
|
||||
"dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm",
|
||||
"dummy-sendmail-debuginfo-8.14.5-12.i686.rpm",
|
||||
"dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm",
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm",
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_smtpdaemon_greedy_all_explicit_sendmail(self):
|
||||
# Same as above, but the other way around.
|
||||
packages = [
|
||||
"dummy-sendmail",
|
||||
"dummy-vacation",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="all")
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-basesystem-10.0-6.noarch.rpm",
|
||||
"dummy-filesystem-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.i686.rpm",
|
||||
"dummy-glibc-common-2.14-5.x86_64.rpm",
|
||||
"dummy-postfix-2.9.2-2.i686.rpm",
|
||||
"dummy-postfix-2.9.2-2.x86_64.rpm",
|
||||
"dummy-sendmail-8.14.5-12.i686.rpm",
|
||||
"dummy-sendmail-8.14.5-12.x86_64.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.i686.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.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",
|
||||
"dummy-postfix-2.9.2-2.src.rpm",
|
||||
"dummy-sendmail-8.14.5-12.src.rpm",
|
||||
"dummy-vacation-1.2.7.1-1.src.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [
|
||||
"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",
|
||||
"dummy-postfix-debuginfo-2.9.2-2.i686.rpm",
|
||||
"dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm",
|
||||
"dummy-sendmail-debuginfo-8.14.5-12.i686.rpm",
|
||||
"dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm",
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.i686.rpm",
|
||||
"dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_firefox(self):
|
||||
packages = [
|
||||
"Dummy-firefox",
|
||||
@ -529,9 +603,7 @@ class TestPungi(unittest.TestCase):
|
||||
packages = [
|
||||
"Dummy-firefox",
|
||||
]
|
||||
pkg_map = self.go(packages, None, lookaside=self.lookaside,
|
||||
greedy="none", selfhosting=True,
|
||||
lookaside_repos=["lookaside"])
|
||||
pkg_map = self.go(packages, None, lookaside=self.lookaside, selfhosting=True)
|
||||
|
||||
self.assertNotIn("Dummy-firefox-16.0.1-2.i686.rpm", pkg_map["rpm"])
|
||||
self.assertNotIn("dummy-krb5-1.10-5.x86_64.rpm", pkg_map["rpm"])
|
||||
@ -706,6 +778,28 @@ class TestPungi(unittest.TestCase):
|
||||
"dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_wildcard_with_multilib_blacklist(self):
|
||||
packages = [
|
||||
"dummy-glibc*",
|
||||
]
|
||||
pkg_map = self.go(packages, None, multilib_blacklist=['dummy-glibc*'])
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-basesystem-10.0-6.noarch.rpm",
|
||||
"dummy-filesystem-4.2.37-6.x86_64.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-glibc-debuginfo-2.14-5.x86_64.rpm",
|
||||
"dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm",
|
||||
])
|
||||
|
||||
def test_bash_multilib_exclude(self):
|
||||
# test if excluding a package really works
|
||||
# NOTE: dummy-bash-doc would pull x86_64 bash in (we want noarch pulling 64bit deps in composes)
|
||||
@ -1017,7 +1111,7 @@ class TestPungi(unittest.TestCase):
|
||||
packages = [
|
||||
"dummy-AdobeReader_enu",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64")
|
||||
pkg_map = self.go(packages, None)
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-AdobeReader_enu-9.5.1-1.i486.rpm", # Important
|
||||
@ -1143,7 +1237,7 @@ class TestPungi(unittest.TestCase):
|
||||
packages = [
|
||||
"dummy-bash",
|
||||
]
|
||||
pkg_map = self.go(packages, None, greedy="none", nodeps=True, fulltree=True)
|
||||
pkg_map = self.go(packages, None, nodeps=True, fulltree=True)
|
||||
|
||||
self.assertNotIn("dummy-bash-4.2.37-5.i686.rpm", pkg_map["rpm"])
|
||||
self.assertNotIn("dummy-bash-4.2.37-5.x86_64.rpm", pkg_map["rpm"])
|
||||
@ -1166,8 +1260,7 @@ class TestPungi(unittest.TestCase):
|
||||
"*",
|
||||
]
|
||||
pkg_map = self.go(packages, None, lookaside=self.repo,
|
||||
greedy="none", nodeps=True, fulltree=True,
|
||||
lookaside_repos=["lookaside"])
|
||||
nodeps=True, fulltree=True)
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [])
|
||||
self.assertItemsEqual(pkg_map["srpm"], [])
|
||||
@ -1179,7 +1272,7 @@ class TestPungi(unittest.TestCase):
|
||||
"-dummy-bas*",
|
||||
"dummy-glibc",
|
||||
]
|
||||
pkg_map = self.go(packages, None, lookaside=self.repo,
|
||||
pkg_map = self.go(packages, None,
|
||||
greedy="none", nodeps=True, fulltree=True)
|
||||
|
||||
# neither dummy-bash or dummy-basesystem is pulled in
|
||||
@ -1410,6 +1503,101 @@ class TestPungi(unittest.TestCase):
|
||||
"dummy-mingw32-qt5-qtbase-debuginfo-5.6.0-1.noarch.rpm",
|
||||
])
|
||||
|
||||
def test_input_by_wildcard(self):
|
||||
packages = [
|
||||
"dummy-release-notes-*",
|
||||
# Yum matches globs against NVR, DNF against names; let's exclude
|
||||
# the extra package to unify the behaviour.
|
||||
"-dummy-release-notes",
|
||||
]
|
||||
pkg_map = self.go(packages, None)
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-release-notes-cs-CZ-1.2-1.noarch.rpm",
|
||||
"dummy-release-notes-en-US-1.2-1.noarch.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["srpm"], [
|
||||
"dummy-release-notes-cs-CZ-1.2-1.src.rpm",
|
||||
"dummy-release-notes-en-US-1.2-1.src.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [])
|
||||
|
||||
def test_requires_pre_post(self):
|
||||
packages = [
|
||||
"dummy-perl"
|
||||
]
|
||||
pkg_map = self.go(packages, None)
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-perl-1.0.0-1.x86_64.rpm",
|
||||
"dummy-perl-macros-1.0.0-1.x86_64.rpm", # Requires(pre)
|
||||
"dummy-perl-utils-1.0.0-1.x86_64.rpm", # Requires(post)
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["srpm"], [
|
||||
"dummy-perl-1.0.0-1.src.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [])
|
||||
|
||||
def test_multilib_exclude_pattern_does_not_match_noarch(self):
|
||||
packages = [
|
||||
'dummy-release-notes-en-US',
|
||||
'-dummy-release-notes-en*.+',
|
||||
]
|
||||
|
||||
pkg_map = self.go(packages, None)
|
||||
|
||||
self.assertItemsEqual(pkg_map["rpm"], [
|
||||
"dummy-release-notes-en-US-1.2-1.noarch.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["srpm"], [
|
||||
"dummy-release-notes-en-US-1.2-1.src.rpm",
|
||||
])
|
||||
self.assertItemsEqual(pkg_map["debuginfo"], [
|
||||
])
|
||||
|
||||
|
||||
class PungiYumDepsolvingTestCase(DepsolvingBase, unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
super(PungiYumDepsolvingTestCase, self).setUp()
|
||||
self.ks = os.path.join(self.tmp_dir, "ks")
|
||||
self.out = os.path.join(self.tmp_dir, "out")
|
||||
|
||||
logger = logging.getLogger('Pungi')
|
||||
if not logger.handlers:
|
||||
formatter = logging.Formatter('%(name)s:%(levelname)s: %(message)s')
|
||||
console = logging.StreamHandler(sys.stdout)
|
||||
console.setFormatter(formatter)
|
||||
console.setLevel(logging.INFO)
|
||||
logger.addHandler(console)
|
||||
|
||||
def go(self, packages, groups, lookaside=None, prepopulate=None,
|
||||
fulltree_excludes=None, multilib_blacklist=None,
|
||||
multilib_whitelist=None, **kwargs):
|
||||
"""
|
||||
Write a kickstart with given packages and groups, then run the
|
||||
depsolving and parse the output.
|
||||
"""
|
||||
p = PungiWrapper()
|
||||
repos = {"repo": self.repo}
|
||||
if lookaside:
|
||||
repos['lookaside'] = lookaside
|
||||
kwargs['lookaside_repos'] = ['lookaside']
|
||||
p.write_kickstart(self.ks, repos, groups, packages, prepopulate=prepopulate,
|
||||
multilib_whitelist=multilib_whitelist,
|
||||
multilib_blacklist=multilib_blacklist,
|
||||
fulltree_excludes=fulltree_excludes)
|
||||
kwargs.setdefault('cache_dir', self.tmp_dir)
|
||||
# Unless the test specifies an arch, we need to default to x86_64.
|
||||
# Otherwise the arch of current machine will be used, which will cause
|
||||
# failure most of the time.
|
||||
kwargs.setdefault('arch', 'x86_64')
|
||||
|
||||
p.run_pungi(self.ks, self.tmp_dir, 'DP', **kwargs)
|
||||
with open(self.out, "r") as f:
|
||||
pkg_map = p.get_packages(f.read())
|
||||
return convert_pkg_map(pkg_map)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user