Update modulemd-tools to 0.7-1

This commit is contained in:
Jakub Kadlcik 2021-02-09 23:21:58 +01:00
parent b13ac2d2bb
commit 7d990cc3d2
5 changed files with 30 additions and 228 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
/modulemd-tools-0.4.tar.gz
/modulemd-tools-0.5.tar.gz
/modulemd-tools-0.6.tar.gz
/modulemd-tools-0.7.tar.gz

View File

@ -1,130 +0,0 @@
From 07847343ebab93d6a5b5f5311ed50f8525d43594 Mon Sep 17 00:00:00 2001
From: Jakub Kadlcik <frostyx@email.cz>
Date: Wed, 13 Jan 2021 01:37:35 +0100
Subject: [PATCH 1/2] modulemd_tools: quote stream fields in test suite
Somewhere between `python3-libmodulemd-2.11.1` and `python3-libmodulemd-2.9.3`
the `Modulemd.ModuleStream.read_string` or `Modulemd.ModuleStream.upgrade`
output changed and is now quoted, which breaks our tests:
- stream: "devel"
? - -
+ stream: devel
I can see those functions are deprecated now, so we will migrate to something
newer soon. This is just a temporary fix.
---
modulemd_tools/tests/test_yaml.py | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/modulemd_tools/tests/test_yaml.py b/modulemd_tools/tests/test_yaml.py
index 551b97d876d2e439a70492f5dec65622b8258880..ed5520cc86ded2e67994aa79ef8eeace9e7432ae 100644
--- a/modulemd_tools/tests/test_yaml.py
+++ b/modulemd_tools/tests/test_yaml.py
@@ -380,11 +380,11 @@ class TestYaml(unittest.TestCase):
yaml1 = """---
document: modulemd
version: 2
data:
name: foo
- stream: devel
+ stream: "devel"
version: 123
context: f32
summary: Summary and stuff
description: >-
This module has been generated using dir2module tool
@@ -413,11 +413,11 @@ data:
yaml2_invalid = """
---
document: modulemd
version: 2
data:
- stream: devel
+ stream: "devel"
version: 123
context: f32
summary: Summary and stuff
description: >-
This module has been generated using dir2module tool
@@ -444,11 +444,11 @@ yaml3_no_deps = """
---
document: modulemd
version: 2
data:
name: foo
- stream: devel
+ stream: "devel"
version: 123
context: f32
summary: Summary and stuff
description: >-
This module has been generated using dir2module tool
@@ -514,11 +514,11 @@ yaml5_multiple_streams = """
---
document: modulemd
version: 2
data:
name: foo
- stream: master
+ stream: "master"
version: 1
summary: A test module in all its beautiful beauty
description: >-
Some description
license:
@@ -528,11 +528,11 @@ data:
---
document: modulemd
version: 2
data:
name: foo
- stream: stable
+ stream: "stable"
version: 123
context: f32
summary: Summary and stuff
description: >-
This module has been generated using dir2module tool
@@ -548,11 +548,11 @@ yaml5_multiple_modules = """
---
document: modulemd
version: 2
data:
name: foo
- stream: master
+ stream: "master"
version: 1
summary: A test module in all its beautiful beauty
description: >-
Some description
license:
@@ -562,11 +562,11 @@ data:
---
document: modulemd
version: 2
data:
name: bar
- stream: stable
+ stream: "stable"
version: 123
context: f32
summary: Summary and stuff
description: >-
This module has been generated using dir2module tool
@@ -582,11 +582,11 @@ yaml6_multiple_pairs_of_deps = """
---
document: modulemd
version: 2
data:
name: foo
- stream: master
+ stream: "master"
version: 1
summary: A test module in all its beautiful beauty
description: >-
Some description
license:
--
2.29.2

View File

@ -1,70 +0,0 @@
From b6557cd10bdae6a839c56ef455020e82eb0e5988 Mon Sep 17 00:00:00 2001
From: Jakub Kadlcik <frostyx@email.cz>
Date: Wed, 13 Jan 2021 15:06:16 +0100
Subject: [PATCH 2/2] modulemd_tools: temporarily skip some tests on EPEL8
---
modulemd_tools/tests/test_yaml.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/modulemd_tools/tests/test_yaml.py b/modulemd_tools/tests/test_yaml.py
index ed5520cc86ded2e67994aa79ef8eeace9e7432ae..b079f65304cadb229fc475d8314f2c6233a7137a 100644
--- a/modulemd_tools/tests/test_yaml.py
+++ b/modulemd_tools/tests/test_yaml.py
@@ -1,13 +1,29 @@
import os
import unittest
from unittest import mock
from parameterized import parameterized
import yaml
+from distutils.version import LooseVersion
from modulemd_tools.yaml import (is_valid, validate, create, update, dump,
upgrade, _yaml2stream, _stream2yaml)
+import gi
+gi.require_version("Modulemd", "2.0")
+from gi.repository import Modulemd
+
+
+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")
+
class TestYaml(unittest.TestCase):
def test_is_valid(self):
self.assertTrue(is_valid(yaml1))
@@ -298,10 +314,11 @@ class TestYaml(unittest.TestCase):
self.assertEqual(mod_stream.get_mdversion(), 2)
self.assertEqual(mod_stream.get_module_name(), "")
self.assertEqual(mod_stream.get_summary(),
"A test module in all its beautiful beauty")
+ @unittest.skipIf(old_libmodulemd(), "Old modulemd drops stream value quotes")
def test_upgrade_to_same_version(self):
result = upgrade(yaml1, 2)
self.assertEqual(result, yaml1)
def test_upgrade_cannot_downgrade(self):
@@ -364,10 +381,11 @@ class TestYaml(unittest.TestCase):
with self.assertRaises(ValueError) as context:
_yaml2stream(yaml5_multiple_modules)
self.assertIn("YAML contained more than a single subdocument",
str(context.exception))
+ @unittest.skipIf(old_libmodulemd(), "Old modulemd drops stream value quotes")
def test_stream2yaml(self):
mod_stream = _yaml2stream(yaml1)
self.assertEqual(_stream2yaml(mod_stream), yaml1)
mod_stream.set_summary(None)
--
2.29.2

View File

@ -1,6 +1,6 @@
Name: modulemd-tools
Version: 0.6
Release: 3%{?dist}
Version: 0.7
Release: 1%{?dist}
Summary: Collection of tools for parsing and generating modulemd YAML files
License: MIT
BuildArch: noarch
@ -12,34 +12,25 @@ BuildRequires: createrepo_c
BuildRequires: argparse-manpage
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-gobject-base
BuildRequires: python3-libmodulemd >= 2.9.3
BuildRequires: python3-click
%if ! 0%{?rhel}
BuildRequires: python3-click-man
%endif
BuildRequires: python3-dnf
BuildRequires: python3-hawkey
BuildRequires: python3-createrepo_c
BuildRequires: python3-pyyaml
BuildRequires: python3-parameterized
BuildRequires: python3-pytest
Requires: libmodulemd >= 2
Requires: createrepo_c
Requires: python3-click
Requires: python3-dnf
Requires: python3-hawkey
Requires: python3-createrepo_c
Requires: python3-pyyaml
Requires: python3-gobject-base
Requires: python3-libmodulemd >= 2.9.3
# Upstream patches to fix compilation against libmodulemd 2.12
Patch0001: 0001-modulemd_tools-quote-stream-fields-in-test-suite.patch
Patch0002: 0002-modulemd_tools-temporarily-skip-some-tests-on-EPEL8.patch
%description
Tools provided by this package:
@ -63,7 +54,7 @@ modulemd-generate-macros - Generate module-build-macros SRPM package, which is
%prep
%autosetup -p1
%setup -q
%build
@ -71,11 +62,11 @@ cd repo2module
%py3_build
cd ..
# There is a missing python3-click-man package for EPEL8 and therefore we cannot
# generate the manpages on the fly. They are temporarily commited into git repo.
# Once RHBZ 1900423 gets resolved, just uncomment the following line. Please see
# https://bugzilla.redhat.com/show_bug.cgi?id=1900423
# PYTHONPATH=./modulemd_tools ./man/generate-manpages.sh
cd dir2module
%py3_build
cd ..
PYTHONPATH=./modulemd_tools ./man/generate-manpages.sh
%install
@ -83,7 +74,10 @@ cd repo2module
%py3_install
cd ..
cp dir2module/dir2module.py %{buildroot}%{_bindir}/dir2module
cd dir2module
%py3_install
cd ..
cp createrepo_mod/createrepo_mod.py %{buildroot}%{_bindir}/createrepo_mod
cp modulemd-merge/modulemd-merge.py %{buildroot}%{_bindir}/modulemd-merge
cp modulemd-generate-macros/modulemd-generate-macros.py \
@ -96,9 +90,13 @@ cp man/*.1 %{buildroot}%{_mandir}/man1/
%check
%{python3} repo2module/setup.py test
cd modulemd_tools
%{python3} -m unittest
cd repo2module
%{python3} -m pytest
cd ..
cd dir2module
%{python3} -m pytest
cd ..
%files
@ -106,6 +104,8 @@ cd modulemd_tools
%license LICENSE
%{python3_sitelib}/repo2module
%{python3_sitelib}/repo2module-*.egg-info/
%{python3_sitelib}/dir2module
%{python3_sitelib}/dir2module-*.egg-info/
%{_bindir}/repo2module
%{_bindir}/dir2module
%{_bindir}/createrepo_mod
@ -121,11 +121,12 @@ cd modulemd_tools
%changelog
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Fri Jan 22 2021 Stephen Gallagher <sgallagh@redhat.com> 0.6-2
- Fix build against libmodulemd-2.12
* Tue Feb 09 2021 Jakub Kadlcik <frostyx@email.cz> 0.7-1
- Generate manpages on the fly
- Automated test builds incl. Docker/Travis
- Fix PEP8 in all tools
- modulemd_tools: temporarily skip some tests on EPEL8 or Fedora
- Drop libmodulemd dependency in favor of python3-libmodulemd
* Sun Nov 22 2020 Jakub Kadlcik <frostyx@email.cz> 0.6-1
- Generate manpages for all tools in this repository

View File

@ -1 +1 @@
SHA512 (modulemd-tools-0.6.tar.gz) = 260c817fff9e58591f72b8ea700abe0b6462e2e5e0ae4e08db4dc4861a00f77100fae9f50f1a375bea29fab75d6298a874ae503526442617f4e00d7e90d368d4
SHA512 (modulemd-tools-0.7.tar.gz) = ef0de75c87d36d4222be72ce99d64e43dd0de65a1a4ddeed9d901546612ac483c8724f18fb1e737a8c6d3d145531ea7ecd6703479c69bd0de1b6135701a19201