Esempio n. 1
0
def old_libmodulemd():
    """
    Reading YAML string via `Modulemd.ModuleStream.read_string` and dumping it
    again encapsulates its value in double-quotes, and it messes up with some of
    our tests (since the older version does exactly the opposite). Let's just
    skip those few test on EPEL8 until it receives an update.
    See also `080e2bb`
    """
    return LooseVersion(Modulemd.get_version()) < LooseVersion("2.11.1")
Esempio n. 2
0
def _modulemd_read_packager_string(mod_yaml, name=None, stream=None):
    """
    For the time being we happen to be in a transition state when
    `Modulemd.ModuleStream.read_string` is deprecated and throws warnings on
    Fedora but we still use old libmodulemd (2.9.4) on RHEL8, which doesn't
    provide its replacement in the form of `Modulemd.read_packager_string`.
    """
    if StrictVersion(Modulemd.get_version()) < StrictVersion("2.11"):
        mod_stream = Modulemd.ModuleStreamV2.new(name, stream)
        mod_stream = mod_stream.read_string(mod_yaml, True, name, stream)
        return mod_stream

    return Modulemd.read_packager_string(mod_yaml, name, stream)
Esempio n. 3
0
def _modulestream_upgrade_ext(mod_stream, version):
    """
    For the time being we happen to be in a transition state when
    `Modulemd.ModuleStream.upgrade` is deprecated and throws warnings on
    Fedora but we still use old libmodulemd (2.9.4) on RHEL8, which doesn't
    provide its replacement in the form of `Modulemd.ModuleStream.upgrade_ext`.
    """
    if StrictVersion(Modulemd.get_version()) < StrictVersion("2.10"):
        return mod_stream.upgrade(version)

    mod_upgraded = mod_stream.upgrade_ext(version)
    return mod_upgraded.get_stream_by_NSVCA(mod_stream.get_stream_name(),
                                            mod_stream.get_version(),
                                            mod_stream.get_context(),
                                            mod_stream.get_arch())
Esempio n. 4
0
 def test_version(self):
     # Make sure that we are linking against the correct version
     assert os.getenv('MODULEMD_VERSION') == Modulemd.get_version()
Esempio n. 5
0
 def test_version(self):
     # Make sure that we are linking against the correct version
     expected_version = os.getenv('MODULEMD_VERSION')
     assert expected_version is None or expected_version == Modulemd.get_version(
     )