diff --git a/bin/pungi b/bin/pungi index 255c63d1..d1100265 100755 --- a/bin/pungi +++ b/bin/pungi @@ -12,11 +12,19 @@ # along with this program; if not, see . import os +import selinux +import sys + +here = sys.path[0] +if here != '/usr/bin': + # Git checkout + sys.path.insert(1, os.path.dirname(here)) + from pungi import get_full_version import pungi.gather import pungi.config import pungi.ks -import selinux + def main(): diff --git a/tests/data/dummy-comps.xml b/tests/data/dummy-comps.xml index 179635e7..18544aa5 100644 --- a/tests/data/dummy-comps.xml +++ b/tests/data/dummy-comps.xml @@ -159,5 +159,6 @@ + diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/4fbc657d01000f79cec7b74ada066dfa66fc745a2745cb2f1e5b36e103078637-filelists.sqlite.bz2 b/tests/fixtures/repos/repo-krb5-lookaside/repodata/4fbc657d01000f79cec7b74ada066dfa66fc745a2745cb2f1e5b36e103078637-filelists.sqlite.bz2 new file mode 100644 index 00000000..6e160eb5 Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/4fbc657d01000f79cec7b74ada066dfa66fc745a2745cb2f1e5b36e103078637-filelists.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/aeb3a17a03cc002051da0120cc3095d105fc74bb764a4354cf199c917c074698-primary.sqlite.bz2 b/tests/fixtures/repos/repo-krb5-lookaside/repodata/aeb3a17a03cc002051da0120cc3095d105fc74bb764a4354cf199c917c074698-primary.sqlite.bz2 new file mode 100644 index 00000000..acc11b7e Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/aeb3a17a03cc002051da0120cc3095d105fc74bb764a4354cf199c917c074698-primary.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/b9dcd75dda89076e1fdbc4a194d97ce3efc6dcd5715191fbd459d569e83596fc-other.xml.gz b/tests/fixtures/repos/repo-krb5-lookaside/repodata/b9dcd75dda89076e1fdbc4a194d97ce3efc6dcd5715191fbd459d569e83596fc-other.xml.gz new file mode 100644 index 00000000..5b025e44 Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/b9dcd75dda89076e1fdbc4a194d97ce3efc6dcd5715191fbd459d569e83596fc-other.xml.gz differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/d10e4fa40128e91767cbe4f9fa8d647da70b24e252ea5690248c4c4dbeb8c55b-filelists.xml.gz b/tests/fixtures/repos/repo-krb5-lookaside/repodata/d10e4fa40128e91767cbe4f9fa8d647da70b24e252ea5690248c4c4dbeb8c55b-filelists.xml.gz new file mode 100644 index 00000000..da776abc Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/d10e4fa40128e91767cbe4f9fa8d647da70b24e252ea5690248c4c4dbeb8c55b-filelists.xml.gz differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/e2007d0883d3c7e7b1409b578d6134b55e42a81a2b8568483f6a177dca33a5ab-primary.xml.gz b/tests/fixtures/repos/repo-krb5-lookaside/repodata/e2007d0883d3c7e7b1409b578d6134b55e42a81a2b8568483f6a177dca33a5ab-primary.xml.gz new file mode 100644 index 00000000..41f5ec01 Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/e2007d0883d3c7e7b1409b578d6134b55e42a81a2b8568483f6a177dca33a5ab-primary.xml.gz differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/feada0072a73fd3d224f4ddfb0447c5cfaafa8caab7105920d60244000e17446-other.sqlite.bz2 b/tests/fixtures/repos/repo-krb5-lookaside/repodata/feada0072a73fd3d224f4ddfb0447c5cfaafa8caab7105920d60244000e17446-other.sqlite.bz2 new file mode 100644 index 00000000..300f397c Binary files /dev/null and b/tests/fixtures/repos/repo-krb5-lookaside/repodata/feada0072a73fd3d224f4ddfb0447c5cfaafa8caab7105920d60244000e17446-other.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo-krb5-lookaside/repodata/repomd.xml b/tests/fixtures/repos/repo-krb5-lookaside/repodata/repomd.xml new file mode 100644 index 00000000..0b458937 --- /dev/null +++ b/tests/fixtures/repos/repo-krb5-lookaside/repodata/repomd.xml @@ -0,0 +1,55 @@ + + + 1473660739 + + e2007d0883d3c7e7b1409b578d6134b55e42a81a2b8568483f6a177dca33a5ab + 46587058c56b96e825286b8554a5b86283520d83ec58a104614d5844bcfd3cdb + + 1473660739 + 2801 + 33779 + + + d10e4fa40128e91767cbe4f9fa8d647da70b24e252ea5690248c4c4dbeb8c55b + 9f4376455b1ea41d6e006959067acde4605a9b5de50e01f1b651bf7d8dfda033 + + 1473660739 + 1632 + 5515 + + + b9dcd75dda89076e1fdbc4a194d97ce3efc6dcd5715191fbd459d569e83596fc + 1879f419d0383daf019f80a86a7222f5350984c77f12eced1c2b4a5e01c2d9a1 + + 1473660739 + 1709 + 9014 + + + aeb3a17a03cc002051da0120cc3095d105fc74bb764a4354cf199c917c074698 + 4cc6ddfb9385c77a10e97dac90f09d5a44b0acf600800a3926fd5e28992b4a19 + + 1473660739 + 6090 + 118784 + 10 + + + 4fbc657d01000f79cec7b74ada066dfa66fc745a2745cb2f1e5b36e103078637 + 06c7919d67cd29cacd4976a0fcd7f42a03f2787b3fdc8947899ef1742a8803bf + + 1473660739 + 2598 + 28672 + 10 + + + feada0072a73fd3d224f4ddfb0447c5cfaafa8caab7105920d60244000e17446 + f7e63aca97e99e2553e113ad85943fbfd1e10aaff7f2a449046de2adc6bc376d + + 1473660739 + 3055 + 24576 + 10 + + diff --git a/tests/fixtures/repos/repo/repodata/05ecf05b96e9d055dc9e3df028b1af2cf6661af7bb082278d96eebe4bf0b9012-filelists.xml.gz b/tests/fixtures/repos/repo/repodata/05ecf05b96e9d055dc9e3df028b1af2cf6661af7bb082278d96eebe4bf0b9012-filelists.xml.gz new file mode 100644 index 00000000..29800d97 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/05ecf05b96e9d055dc9e3df028b1af2cf6661af7bb082278d96eebe4bf0b9012-filelists.xml.gz differ diff --git a/tests/fixtures/repos/repo/repodata/129bcb220b766abd0d38b33f919af26b017c6ae086cf087ca00d183d97d57a06-other.sqlite.bz2 b/tests/fixtures/repos/repo/repodata/129bcb220b766abd0d38b33f919af26b017c6ae086cf087ca00d183d97d57a06-other.sqlite.bz2 new file mode 100644 index 00000000..0f5a3789 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/129bcb220b766abd0d38b33f919af26b017c6ae086cf087ca00d183d97d57a06-other.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo/repodata/2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35-dummy-comps.xml.gz b/tests/fixtures/repos/repo/repodata/2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35-dummy-comps.xml.gz new file mode 100644 index 00000000..c03e51f9 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35-dummy-comps.xml.gz differ diff --git a/tests/fixtures/repos/repo/repodata/443dade43e632f2bbb768b1768cb090175429b5e70823525c3a3f4d45b7984ed-primary.xml.gz b/tests/fixtures/repos/repo/repodata/443dade43e632f2bbb768b1768cb090175429b5e70823525c3a3f4d45b7984ed-primary.xml.gz new file mode 100644 index 00000000..64d5e9d9 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/443dade43e632f2bbb768b1768cb090175429b5e70823525c3a3f4d45b7984ed-primary.xml.gz differ diff --git a/tests/fixtures/repos/repo/repodata/74a554f4a2c7392d9ef0cf6a07652d7a198a104a202584e71f57bc247a32f41b-other.xml.gz b/tests/fixtures/repos/repo/repodata/74a554f4a2c7392d9ef0cf6a07652d7a198a104a202584e71f57bc247a32f41b-other.xml.gz new file mode 100644 index 00000000..0565771f Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/74a554f4a2c7392d9ef0cf6a07652d7a198a104a202584e71f57bc247a32f41b-other.xml.gz differ diff --git a/tests/fixtures/repos/repo/repodata/9249118941570779bf043a7a393f0308f891ac1d7fdd2dfe006d3caf69d26a6f-primary.sqlite.bz2 b/tests/fixtures/repos/repo/repodata/9249118941570779bf043a7a393f0308f891ac1d7fdd2dfe006d3caf69d26a6f-primary.sqlite.bz2 new file mode 100644 index 00000000..aafae7a6 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/9249118941570779bf043a7a393f0308f891ac1d7fdd2dfe006d3caf69d26a6f-primary.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo/repodata/a5891b48313e9cd503e94e48c93a08b5160ce04f4fde2d1e32f21ef69f550141-filelists.sqlite.bz2 b/tests/fixtures/repos/repo/repodata/a5891b48313e9cd503e94e48c93a08b5160ce04f4fde2d1e32f21ef69f550141-filelists.sqlite.bz2 new file mode 100644 index 00000000..6005bcc1 Binary files /dev/null and b/tests/fixtures/repos/repo/repodata/a5891b48313e9cd503e94e48c93a08b5160ce04f4fde2d1e32f21ef69f550141-filelists.sqlite.bz2 differ diff --git a/tests/fixtures/repos/repo/repodata/cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077-dummy-comps.xml b/tests/fixtures/repos/repo/repodata/cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077-dummy-comps.xml new file mode 100644 index 00000000..18544aa5 --- /dev/null +++ b/tests/fixtures/repos/repo/repodata/cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077-dummy-comps.xml @@ -0,0 +1,164 @@ + + + + + + + + core + Core + Smallest possible installation + true + false + + dummy-bash + + + + + standard + Standard + Common set of utilities that extend the minimal installation. + false + true + + dummy-lvm2 + + + + + text-internet + Text-based Internet + This group includes text-based email, Web, and chat clients. These applications do not require the X Window System. + false + true + + dummy-elinks + dummy-tftp + + + + + firefox + Firefox Web Browser + The Firefox web browser + false + false + + Dummy-firefox + dummy-icedtea-web + + + + + skype + Skype + Free internet telephony + false + true + + dummy-skype + + + + + resilient-storage + Resilient Storage + Clustered storage, including the GFS2 filesystem. + false + true + + dummy-gfs2-utils + dummy-lvm2-cluster + dummy-pacemaker + dummy-resource-agents + + + + + gluster + Gluster + GlusterFS support packages + false + true + + dummy-glusterfs-resource-agents + + + + + basic-desktop + Desktop + Basic Desktop packages + true + true + + dummy-imsettings-gnome + + + + + + + minimal + Minimal install + Basic functionality. + 99 + + core + + + + + + + desktop + Desktop + Desktop. + 10 + + core + standard + basic-desktop + + + + + + + empty + Empty + Should not appear in the repos. + 10 + + does-not-exist + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/fixtures/repos/repo/repodata/repomd.xml b/tests/fixtures/repos/repo/repodata/repomd.xml new file mode 100644 index 00000000..43ef3093 --- /dev/null +++ b/tests/fixtures/repos/repo/repodata/repomd.xml @@ -0,0 +1,69 @@ + + + 1478525452 + + 443dade43e632f2bbb768b1768cb090175429b5e70823525c3a3f4d45b7984ed + e60486cc17a922a5cfa3b0eeb6b02176d046bb81d4477806ccf76e49f2f619dd + + 1478525452 + 32219 + 442634 + + + 05ecf05b96e9d055dc9e3df028b1af2cf6661af7bb082278d96eebe4bf0b9012 + 2df95e0dc72d04e62064d15d3b95d3aac7c4f1733ebb67c16beab89345808ceb + + 1478525452 + 19701 + 73844 + + + 74a554f4a2c7392d9ef0cf6a07652d7a198a104a202584e71f57bc247a32f41b + 56bb0c634647446b741246930d55542b6ca50084008678ab441d5f4960d1eaea + + 1478525452 + 19712 + 117697 + + + 9249118941570779bf043a7a393f0308f891ac1d7fdd2dfe006d3caf69d26a6f + c0ecdec1aeac2c4e1f32f97c04c703a438e139f4d9d9631a95e3fca5fec61e5c + + 1478525452 + 57571 + 368640 + 10 + + + a5891b48313e9cd503e94e48c93a08b5160ce04f4fde2d1e32f21ef69f550141 + b8398ea076836772a553717e9abfcd6fec1cb7d69ad32c09094b4abf1345aa88 + + 1478525452 + 25706 + 94208 + 10 + + + 129bcb220b766abd0d38b33f919af26b017c6ae086cf087ca00d183d97d57a06 + 41a274ac1928cbd1b9126972b154826842af8781a6037fade0ca1bc57443d5d2 + + 1478525452 + 29618 + 122880 + 10 + + + cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077 + + 1478525452 + 5178 + + + 2f8cc4b5cf852eca9838393db012ad4e494ccea437ffbbbf95e110a388e15f35 + cd2e022a3f1163bed5dd38328a2c0bd7a8db1589a9e67b25c6341941914e1077 + + 1478525452 + 1244 + 5178 + + diff --git a/tests/test_pungi.py b/tests/test_pungi.py new file mode 100644 index 00000000..29fa6cbb --- /dev/null +++ b/tests/test_pungi.py @@ -0,0 +1,1363 @@ +# -*- coding: utf-8 -*- + +try: + import unittest2 as unittest +except ImportError: + import unittest + + +import os +import tempfile +import shutil +import sys + +from kobo.shortcuts import run + +HERE = os.path.dirname(__file__) +BINDIR = (os.path.join(HERE, '..', 'bin')) +sys.path.insert(0, os.path.join(HERE, '..')) +os.environ['PATH'] = '%s:%s' % (BINDIR, os.environ['PATH']) + +from pungi.wrappers.pungi import PungiWrapper + + +def convert_pkg_map(data): + """ + Go through the mapping, extract only paths and convert them to just + basenames. + """ + result = {} + for pkg_type in data: + result[pkg_type] = sorted(set([os.path.basename(pkg['path']) + for pkg in data[pkg_type]])) + return result + + +class TestPungi(unittest.TestCase): + + 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") + self.p = PungiWrapper() + + 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. + """ + repos = {"repo": repo or self.repo} + if lookaside: + repos['lookaside'] = lookaside + self.p.write_kickstart(self.ks, repos, groups, packages, prepopulate=prepopulate, + multilib_whitelist=multilib_whitelist) + kwargs.setdefault('full_archlist', True) + kwargs.setdefault('cache_dir', self.tmp_dir) + cmd = self.p.get_pungi_cmd(self.ks, self.tmp_dir, "DP", **kwargs) + run(cmd, logfile=self.out, stdout=True) + with open(self.out, "r") as f: + pkg_map = self.p.get_packages(f.read()) + return convert_pkg_map(pkg_map) + + def test_kernel(self): + packages = [ + "dummy-kernel", + ] + pkg_map = self.go(packages, None, greedy="none") + + 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", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-kernel-3.1.0-1.src.rpm" + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_kernel_fulltree(self): + packages = [ + "dummy-kernel", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + 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", # Important + "dummy-kernel-headers-3.1.0-1.x86_64.rpm", + "dummy-kernel-doc-3.1.0-1.noarch.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", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + 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", # Important + "dummy-kernel-headers-3.1.0-1.x86_64.rpm", + "dummy-kernel-doc-3.1.0-1.noarch.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-kernel-3.1.0-1.src.rpm" + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_bash_noarch_pulls_64bit(self): + packages = [ + "dummy-glibc.+", + "dummy-bash-doc", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="ppc64") + + self.assertNotIn("dummy-bash-4.2.37-6.ppc.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.ppc64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", # Important + "dummy-filesystem-4.2.37-6.ppc64.rpm", + "dummy-glibc-2.14-5.ppc.rpm", + "dummy-glibc-2.14-5.ppc64.rpm", + "dummy-glibc-common-2.14-5.ppc64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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.ppc64.rpm", + "dummy-glibc-debuginfo-2.14-5.ppc.rpm", + "dummy-glibc-debuginfo-2.14-5.ppc64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.ppc.rpm", + "dummy-glibc-debuginfo-common-2.14-5.ppc64.rpm", + ]) + + def test_foo32_doc_fulltree(self): + packages = [ + "dummy-foo32-doc", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-foo32-1-1.i686.rpm", # Important + "dummy-foo32-doc-1-1.noarch.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-foo32-1-1.src.rpm" + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_bash(self): + packages = [ + "dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="none") + + 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"]) + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "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-bash-4.2.37-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.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ]) + + def test_bash_s390x(self): + packages = [ + "dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="none", arch="s390x") + + self.assertNotIn("dummy-bash-4.2.37-5.s390.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-4.2.37-5.s390x.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-4.2.37-6.s390.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.s390x.rpm", # Important + "dummy-filesystem-4.2.37-6.s390x.rpm", + "dummy-glibc-2.14-5.s390x.rpm", + "dummy-glibc-common-2.14-5.s390x.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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.s390x.rpm", + "dummy-glibc-debuginfo-2.14-5.s390x.rpm", + "dummy-glibc-debuginfo-common-2.14-5.s390x.rpm", + ]) + + def test_bash_greedy(self): + # we want only the latest package version + packages = [ + "dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="all") + + 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"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "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", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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-bash-debuginfo-4.2.37-6.x86_64.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_older(self): + packages = [ + "dummy-bash-4.2.37-5", + ] + pkg_map = self.go(packages, None, greedy="none") + + self.assertNotIn("dummy-bash-4.2.37-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-5.x86_64.rpm", # Important + "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-bash-4.2.37-5.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-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + ]) + + def test_system_release(self): + packages = [ + "dummy-filesystem", + "system-release", + ] + pkg_map = self.go(packages, None, greedy="none") + + self.assertNotIn("dummy-release-client-workstation-1.0.0-1.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-client-workstation-1.0.0-1.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-client-1.0.0-1.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-client-1.0.0-1.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-server-1.0.0-1.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-server-1.0.0-1.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-release-notes-1.2-1.noarch.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-filesystem-4.2.37-6.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-filesystem-4.2.37-6.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_system_release_greedy(self): + packages = [ + "system-release", + ] + pkg_map = self.go(packages, None, greedy="all") + + self.assertNotIn("dummy-release-notes-1.2-1.noarch.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-release-client-1.0.0-1.i686.rpm", # Important + "dummy-release-client-1.0.0-1.x86_64.rpm", # Important + "dummy-release-client-workstation-1.0.0-1.i686.rpm", # Important + "dummy-release-client-workstation-1.0.0-1.x86_64.rpm", # Important + "dummy-release-server-1.0.0-1.i686.rpm", # Important + "dummy-release-server-1.0.0-1.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-release-client-1.0.0-1.src.rpm", + "dummy-release-client-workstation-1.0.0-1.src.rpm", + "dummy-release-server-1.0.0-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_smtpdaemon(self): + packages = [ + "dummy-vacation", + ] + pkg_map = self.go(packages, None, greedy="none") + + self.assertNotIn("dummy-postfix-2.9.2-2.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-sendmail-8.14.5-12.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-sendmail-8.14.5-12.x86_64.rpm", pkg_map["rpm"]) + + 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", + "dummy-postfix-2.9.2-2.x86_64.rpm", # Important + "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-vacation-1.2.7.1-1.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", + "dummy-postfix-debuginfo-2.9.2-2.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ]) + + def test_smtpdaemon_sendmail(self): + packages = [ + "dummy-vacation", + "dummy-sendmail", + ] + pkg_map = self.go(packages, None, greedy="none") + + self.assertNotIn("dummy-postfix-2.9.2-2.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-postfix-2.9.2-2.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-sendmail-8.14.5-12.i686.rpm", pkg_map["rpm"]) + + 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", + "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important + "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-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.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-sendmail-debuginfo-8.14.5-12.x86_64.rpm", + "dummy-vacation-debuginfo-1.2.7.1-1.x86_64.rpm", + ]) + + def test_smtpdaemon_greedy(self): + packages = [ + "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", # Important + "dummy-postfix-2.9.2-2.x86_64.rpm", # Important + "dummy-sendmail-8.14.5-12.i686.rpm", # Important + "dummy-sendmail-8.14.5-12.x86_64.rpm", # Important + "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", + ] + pkg_map = self.go(packages, None, greedy="none") + + self.assertNotIn("Dummy-firefox-16.0.1-1.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.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-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ]) + + def test_firefox_selfhosting(self): + packages = [ + "Dummy-firefox", + ] + pkg_map = self.go(packages, None, greedy="none", selfhosting=True) + + self.assertNotIn("Dummy-firefox-16.0.1-2.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-bash-4.2.37-6.src.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-krb5-1.10-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", # Important + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", # Important + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ]) + + def test_firefox_selfhosting_with_krb5_lookaside(self): + packages = [ + "Dummy-firefox", + ] + pkg_map = self.go(packages, None, lookaside=self.lookaside, + greedy="none", selfhosting=True, + lookaside_repos=["lookaside"]) + + 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"]) + self.assertNotIn("dummy-krb5-debuginfo-1.10-5.x86_64.rpm", pkg_map["debuginfo"]) + self.assertNotIn("dummy-krb5-1.10-5.src.rpm", pkg_map["srpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-bash-4.2.37-6.src.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ]) + + def test_firefox_fulltree(self): + packages = [ + "Dummy-firefox", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertNotIn("Dummy-firefox-16.0.1-2.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.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-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ]) + + def test_firefox_selfhosting_fulltree(self): + packages = [ + "Dummy-firefox", + ] + pkg_map = self.go(packages, None, greedy="none", selfhosting=True, fulltree=True) + + self.assertNotIn("Dummy-firefox-16.0.1-2.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-bash-4.2.37-6.x86_64.rpm", + "dummy-bash-doc-4.2.37-6.noarch.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "Dummy-firefox-16.0.1-1.x86_64.rpm", # Important + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important + "dummy-nscd-2.14-5.x86_64.rpm", + "Dummy-xulrunner-16.0.1-1.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-bash-4.2.37-6.src.rpm", + "dummy-basesystem-10.0-6.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "Dummy-firefox-16.0.1-1.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-krb5-1.10-5.src.rpm", + "Dummy-xulrunner-16.0.1-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + "Dummy-firefox-debuginfo-16.0.1-1.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + "Dummy-xulrunner-debuginfo-16.0.1-1.x86_64.rpm", + ]) + + def test_krb5_fulltree(self): + packages = [ + "dummy-krb5", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertNotIn("dummy-krb5-devel-1.10-5.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-krb5-workstation-1.10-5.i686.rpm", pkg_map["rpm"]) + + 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", + "dummy-krb5-1.10-5.x86_64.rpm", + "dummy-krb5-devel-1.10-5.x86_64.rpm", # Important + "dummy-krb5-libs-1.10-5.x86_64.rpm", + "dummy-krb5-workstation-1.10-5.x86_64.rpm", # Important + "dummy-nscd-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", + "dummy-krb5-1.10-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", + "dummy-krb5-debuginfo-1.10-5.x86_64.rpm", + ]) + + @unittest.skip + def test_bash_multilib(self): + packages = [ + "dummy-bash.+", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + # 'dummy-bash' req already satisfied by bash.i686 + self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.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", + "dummy-nscd-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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", + ]) + + @unittest.skip + 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) + packages = [ + "dummy-bash.+", + "-dummy-bash-doc", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-doc-4.2.37-6.noarch.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "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", + "dummy-nscd-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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.+", + ] + pkg_map = self.go(packages, None, greedy="all", fulltree=True) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-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-nscd-2.14-5.i686.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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-bash-debuginfo-4.2.37-6.x86_64.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", + ]) + + # This test is broken. + @unittest.skip + def test_bash_multilib_nogreedy(self): + packages = [ + "dummy-bash.+", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.i686.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.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", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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_filter_greedy(self): + packages = [ + "dummy-bash", + "-dummy-bash.+", + ] + pkg_map = self.go(packages, None, greedy="all", fulltree=True) + + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-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-nscd-2.14-5.i686.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-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.x86_64.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_filter_greedy(self): + packages = [ + "dummy-filesystem", + "dummy-bash.+", + "-dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="all", fulltree=True) + + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-bash-4.2.37-6.x86_64.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-filesystem-4.2.37-6.i686.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-filesystem-4.2.37-6.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_ipw3945_kmod(self): + # every package name is different + packages = [ + "dummy-kmod-ipw3945", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=True) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-kmod-ipw3945-1.2.0-4.20.x86_64.rpm", # Important + "dummy-kmod-ipw3945-xen-1.2.0-4.20.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-ipw3945-kmod-1.2.0-4.20.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-ipw3945-kmod-debuginfo-1.2.0-4.20.x86_64.rpm", + ]) + + def test_multilib_method_devel(self): + packages = [ + "dummy-lvm2-devel", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, + multilib_methods=["devel"]) + + 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", + "dummy-lvm2-2.02.84-4.x86_64.rpm", + "dummy-lvm2-devel-2.02.84-4.i686.rpm", # Important + "dummy-lvm2-devel-2.02.84-4.x86_64.rpm", # Important + "dummy-lvm2-libs-2.02.84-4.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-lvm2-2.02.84-4.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", + "dummy-lvm2-debuginfo-2.02.84-4.i686.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", + ]) + + def test_selinux_policy_base(self): + packages = [ + "dummy-freeipa-server", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="ppc64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_selinux_policy_base_greedy_build(self): + packages = [ + "dummy-freeipa-server", + ] + pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="ppc64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", # Important + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm" + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_selinux_policy_base_existing_provides(self): + packages = [ + "dummy-selinux-policy-targeted", + "dummy-freeipa-server", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="ppc64") + + self.assertNotIn("dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-freeipa-server-2.2.0-1.ppc64.rpm", # Important + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-freeipa-2.2.0-1.src.rpm", + "dummy-selinux-policy-3.10.0-121.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_selinux_policy_doc_fulltree(self): + packages = [ + "dummy-selinux-policy-doc" + ] + pkg_map = self.go(packages, None, fulltree=True) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-selinux-policy-doc-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-minimal-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-mls-3.10.0-121.noarch.rpm", + "dummy-selinux-policy-targeted-3.10.0-121.noarch.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-selinux-policy-3.10.0-121.src.rpm" + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_AdobeReader_enu_nosrc(self): + packages = [ + "dummy-AdobeReader_enu", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-AdobeReader_enu-9.5.1-1.i486.rpm", # Important + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-AdobeReader_enu-9.5.1-1.nosrc.rpm", + "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_imsettings(self): + packages = [ + "dummy-imsettings", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64") + + self.assertNotIn("dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) + # prefers qt over gnome (shorter name) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-imsettings-1.2.9-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_imsettings_basic_desktop(self): + packages = [ + "dummy-imsettings", + ] + groups = [ + "basic-desktop" + ] + pkg_map = self.go(packages, groups, greedy="none", fulltree=False, arch="x86_64") + + self.assertNotIn("dummy-imsettings-qt-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) + # prefers gnome over qt (condrequires in @basic-desktop) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-imsettings-1.2.9-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_imsettings_basic_desktop_nodeps(self): + packages = [ + "dummy-imsettings", + ] + groups = [ + "basic-desktop" + ] + pkg_map = self.go(packages, groups, greedy="none", fulltree=False, nodeps=True, + arch="x86_64") + + self.assertNotIn("dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) + self.assertNotIn("dummy-imsettings-qt-1.2.9-1.x86_64.rpm", pkg_map["rpm"]) + # prefers gnome over qt (condrequires in @basic-desktop) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-imsettings-1.2.9-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_imsettings_basic_desktop_and_qt(self): + packages = [ + "dummy-imsettings", + "dummy-imsettings-qt", + ] + groups = [ + "basic-desktop" + ] + pkg_map = self.go(packages, groups, greedy="none", fulltree=False, arch="x86_64") + + # prefers gnome over qt (condrequires in @basic-desktop) + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-imsettings-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-gnome-1.2.9-1.x86_64.rpm", # Important + "dummy-imsettings-qt-1.2.9-1.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-imsettings-1.2.9-1.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_bash_nodeps(self): + packages = [ + "dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="none", nodeps=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"]) + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-bash-4.2.37-6.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + ]) + + def test_bash_fulltree_nodeps(self): + packages = [ + "dummy-bash", + ] + pkg_map = self.go(packages, None, greedy="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"]) + self.assertNotIn("dummy-bash-4.2.37-6.i686.rpm", pkg_map["rpm"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-bash-4.2.37-6.x86_64.rpm", # Important + "dummy-bash-doc-4.2.37-6.noarch.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-bash-4.2.37-6.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-bash-debuginfo-4.2.37-6.x86_64.rpm", + ]) + + def test_lookaside_empty(self): + # if the input repo and lookaside repo are the same, output must be empty + packages = [ + "*", + ] + pkg_map = self.go(packages, None, lookaside=self.repo, + greedy="none", nodeps=True, fulltree=True, + lookaside_repos=["lookaside"]) + + self.assertItemsEqual(pkg_map["rpm"], []) + self.assertItemsEqual(pkg_map["srpm"], []) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_exclude_wildcards(self): + packages = [ + "dummy-bash", + "-dummy-bas*", + "dummy-glibc", + ] + pkg_map = self.go(packages, None, lookaside=self.repo, + greedy="none", nodeps=True, fulltree=True) + + # neither dummy-bash or dummy-basesystem is pulled in + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-nscd-2.14-5.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "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_atlas_greedy_none(self): + packages = [ + "dummy-atlas-devel", + ] + pkg_map = self.go(packages, None, greedy="none", fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-atlas-3.8.4-7.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_atlas_greedy_build(self): + packages = [ + "dummy-atlas", + "dummy-atlas-devel", + ] + pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-atlas-3.8.4-7.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_atlas_greedy_build_multilib_devel(self): + packages = [ + "dummy-atlas-devel", + ] + pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel"], + fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-atlas-3.8.4-7.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_atlas_greedy_build_multilib_devel_32bit(self): + packages = [ + "dummy-atlas-devel.+", + ] + pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel"], + fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-atlas-3.8.4-7.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_atlas_greedy_all(self): + packages = [ + "dummy-atlas-devel", + ] + pkg_map = self.go(packages, None, greedy="all", fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-atlas-3.8.4-7.i686.rpm", + "dummy-atlas-3dnow-3.8.4-7.i686.rpm", + "dummy-atlas-devel-3.8.4-7.i686.rpm", + "dummy-atlas-sse-3.8.4-7.i686.rpm", + "dummy-atlas-sse2-3.8.4-7.i686.rpm", + "dummy-atlas-sse3-3.8.4-7.i686.rpm", + + "dummy-atlas-3.8.4-7.x86_64.rpm", + "dummy-atlas-devel-3.8.4-7.x86_64.rpm", + "dummy-atlas-sse3-3.8.4-7.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-atlas-3.8.4-7.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], []) + + def test_skype(self): + packages = [ + "dummy-skype", + ] + pkg_map = self.go(packages, None, greedy="build", fulltree=False, arch="x86_64") + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-skype-4.2.0.13-1.i586.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + ]) + # no SRPM for skype + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + ]) + self.assertItemsEqual(pkg_map["debuginfo"], [ + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-2.14-5.i686.rpm", + ]) + + def test_prepopulate(self): + packages = [ + "dummy-glibc", + ] + prepopulate = [ + "dummy-bash.i686", + "dummy-lvm2.x86_64", + ] + + pkg_map = self.go(packages, None, prepopulate=prepopulate) + + 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", + "dummy-lvm2-2.02.84-4.x86_64.rpm", + "dummy-lvm2-libs-2.02.84-4.x86_64.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-bash-4.2.37-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.src.rpm", + "dummy-lvm2-2.02.84-4.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-common-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-2.14-5.x86_64.rpm", + "dummy-glibc-debuginfo-common-2.14-5.x86_64.rpm", + "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", + ]) + + def test_langpacks(self): + packages = [ + "dummy-release-notes", + ] + pkg_map = self.go(packages, None) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-release-notes-1.2-1.noarch.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-1.2-1.src.rpm", + "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_multilib_whitelist(self): + # whitelist must work regardless if multilib_method is specified or not + packages = [ + "dummy-glibc", + ] + + pkg_map = self.go(packages, None, multilib_whitelist=["dummy-glibc"]) + + self.assertItemsEqual(pkg_map["rpm"], [ + "dummy-filesystem-4.2.37-6.x86_64.rpm", + "dummy-glibc-common-2.14-5.x86_64.rpm", + "dummy-glibc-2.14-5.i686.rpm", + "dummy-glibc-2.14-5.x86_64.rpm", + "dummy-basesystem-10.0-6.noarch.rpm", + ]) + self.assertItemsEqual(pkg_map["srpm"], [ + "dummy-basesystem-10.0-6.src.rpm", + "dummy-glibc-2.14-5.src.rpm", + "dummy-filesystem-4.2.37-6.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", + ]) + + +if __name__ == "__main__": + unittest.main()