diff --git a/doc/configuration.rst b/doc/configuration.rst index ba6c7d67..ad583f76 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -536,9 +536,9 @@ Options changes the entire codebase doing dependency solving, so it can change the result in unpredictable ways. - Particularly the multilib testing is performed differently with much less - magic. Please refer to ``multilib`` option to see the differences. - + Particularly the multilib work is performed differently by using + ``python-multilib`` library. Please refer to ``multilib`` option to see the + differences. **multilib_methods** [deprecated] ([*str*]) -- use ``multilib`` instead to configure this per-variant @@ -555,13 +555,12 @@ Options Available methods are: * ``none`` -- no package matches this method * ``all`` -- all packages match this method - * ``runtime`` -- packages that provide something matching - ``*.so.[0-9]+.*`` will match. With ``yum`` backend installed files are - also looked at for a match with a hardcoded list of patterns. + * ``runtime`` -- packages that install some shared object file + (``*.so.*``) will match. * ``devel`` -- packages whose name ends with ``-devel`` or ``--static`` - suffix will be matched or packages that provide something with such - suffix. With ``yum`` backend this method also uses a hardcoded blacklist - and whitelist. + suffix will be matched. When ``dnf`` is used, this method automatically + enables ``runtime`` method as well. With ``yum`` backend this method + also uses a hardcoded blacklist and whitelist. * ``kernel`` -- packages providing ``kernel`` or ``kernel-devel`` match this method (only in ``yum`` backend) * ``yaboot`` -- only ``yaboot`` package on ``ppc`` arch matches this (only diff --git a/doc/contributing.rst b/doc/contributing.rst index 442a277b..69823362 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -6,8 +6,8 @@ Contributing to Pungi Set up development environment ============================== -In order to work on *Pungi*, you should install *Fedora 23*. These packages -will have to installed: +In order to work on *Pungi*, you should install recent version of *Fedora*. +These packages will have to installed: * createrepo * createrepo_c @@ -26,6 +26,7 @@ will have to installed: * python-kickstart * python-lockfile * python-lxml + * python2-multilib * python-productmd * repoview * syslinux @@ -49,7 +50,7 @@ packages above as they are used by calling an executable. :: $ for pkg in _selinux deltarpm _deltarpm krbV sqlitecachec _sqlitecache; do ln -vs "$(deactivate && python -c 'import os, '$pkg'; print '$pkg'.__file__')" "$(virtualenvwrapper_get_site_packages_dir)"; done $ PYCURL_SSL_LIBRARY=nss pip install pycurl --no-binary :all: $ pip install https://github.com/release-engineering/kobo/archive/0.5.2.tar.gz - $ pip install lxml pyopenssl mock sphinx setuptools nose nose-cov productmd jsonschema requests lockfile + $ pip install lxml pyopenssl mock sphinx setuptools nose nose-cov productmd jsonschema requests lockfile python-multilib Now you should be able to run all existing tests. diff --git a/pungi.spec b/pungi.spec index dc99de77..38497fd0 100644 --- a/pungi.spec +++ b/pungi.spec @@ -16,6 +16,7 @@ BuildRequires: gettext, git-core, cvs BuildRequires: python-jsonschema BuildRequires: python-enum34 BuildRequires: python2-dnf +BuildRequires: python2-multilib Requires: createrepo >= 0.4.11 Requires: yum => 3.4.3-28 @@ -42,6 +43,7 @@ Requires: python-jsonschema Requires: libguestfs-tools-c Requires: python-enum34 Requires: python2-dnf +Requires: python2-multilib BuildArch: noarch diff --git a/pungi/gather.py b/pungi/gather.py index daf9582a..20cc33d3 100644 --- a/pungi/gather.py +++ b/pungi/gather.py @@ -29,7 +29,7 @@ import ConfigParser from fnmatch import fnmatch import arch as arch_module -import multilib +import multilib_yum as multilib class ReentrantYumLock(object): diff --git a/pungi/multilib_dnf.py b/pungi/multilib_dnf.py index 0e30cde4..ce239f0a 100644 --- a/pungi/multilib_dnf.py +++ b/pungi/multilib_dnf.py @@ -13,11 +13,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, see . - -import re - - -RE_SONAME = re.compile(r"^.*\.so\.\d+.*$") +from multilib import multilib class Multilib(object): @@ -35,8 +31,15 @@ class Multilib(object): self.blacklist = blacklist self.whitelist = whitelist + self.all_methods = { + 'none': multilib.NoMultilibMethod(None), + 'all': multilib.AllMultilibMethod(None), + 'devel': multilib.DevelMultilibMethod(None), + 'runtime': multilib.RuntimeMultilibMethod(None), + } + for method in methods: - self.methods[method] = getattr(self, "method_%s" % method) + self.methods[method] = self.all_methods[method] @classmethod def from_globs(cls, sack, methods, blacklist=None, whitelist=None): @@ -45,40 +48,13 @@ class Multilib(object): _expand_list(sack, blacklist or []), _expand_list(sack, whitelist or [])) - def method_none(self, pkg): - return False - - def method_all(self, pkg): - return True - - def method_devel(self, pkg): - if pkg.name.endswith("-devel"): - return True - if pkg.name.endswith("-static"): - return True - for prov in pkg.provides: - # TODO: split reldep to name/flag/value - prov = str(prov).split(" ")[0] - if prov.endswith("-devel"): - return True - if prov.endswith("-static"): - return True - return False - - def method_runtime(self, pkg): - for prov in pkg.provides: - prov = str(prov) - if RE_SONAME.match(prov): - return True - return False - def is_multilib(self, pkg): if pkg.name in self.blacklist: return False if pkg.name in self.whitelist: return 'whitelist' - for method, func in self.methods.iteritems(): - if func(pkg): + for method, cls in self.methods.iteritems(): + if cls.select(pkg): return method return False diff --git a/pungi/multilib.py b/pungi/multilib_yum.py similarity index 100% rename from pungi/multilib.py rename to pungi/multilib_yum.py diff --git a/tests/test_gather.py b/tests/test_gather.py index 59069784..ebe0978d 100644 --- a/tests/test_gather.py +++ b/tests/test_gather.py @@ -1009,17 +1009,18 @@ class DepsolvingBase(object): "dummy-ipw3945-kmod-debuginfo-1.2.0-4.20.x86_64.rpm", ]) - def test_multilib_method_devel(self): + def test_multilib_method_devel_runtime(self): packages = [ "dummy-lvm2-devel", ] pkg_map = self.go(packages, None, greedy="none", fulltree=False, - multilib_methods=["devel"]) + multilib_methods=["devel", "runtime"]) 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-2.14-5.i686.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 @@ -1035,6 +1036,8 @@ class DepsolvingBase(object): 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-glibc-debuginfo-2.14-5.i686.rpm", + "dummy-glibc-debuginfo-common-2.14-5.i686.rpm", "dummy-lvm2-debuginfo-2.02.84-4.i686.rpm", "dummy-lvm2-debuginfo-2.02.84-4.x86_64.rpm", ]) @@ -1327,7 +1330,7 @@ class DepsolvingBase(object): packages = [ "dummy-atlas-devel", ] - pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel"], + pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel", "runtime"], fulltree=False, arch="x86_64") self.assertItemsEqual(pkg_map["rpm"], [ @@ -1345,7 +1348,7 @@ class DepsolvingBase(object): packages = [ "dummy-atlas-devel.+", ] - pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel"], + pkg_map = self.go(packages, None, greedy="build", multilib_methods=["devel", "runtime"], fulltree=False, arch="x86_64") self.assertItemsEqual(pkg_map["rpm"], [