Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/modulemd-tools.git#3a92ffc0d368d0d4aee1649cfeb6aa593e171053
This commit is contained in:
DistroBaker 2021-01-22 14:57:01 +00:00
parent 5abdfc5a62
commit 98d6f4608f
5 changed files with 367 additions and 0 deletions

6
.gitignore vendored
View File

@ -0,0 +1,6 @@
/dir2module-0.1.tar.gz
/modulemd-tools-0.1.tar.gz
/modulemd-tools-0.3.tar.gz
/modulemd-tools-0.4.tar.gz
/modulemd-tools-0.5.tar.gz
/modulemd-tools-0.6.tar.gz

View File

@ -0,0 +1,130 @@
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

@ -0,0 +1,70 @@
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

160
modulemd-tools.spec Normal file
View File

@ -0,0 +1,160 @@
Name: modulemd-tools
Version: 0.6
Release: 2%{?dist}
Summary: Collection of tools for parsing and generating modulemd YAML files
License: MIT
BuildArch: noarch
URL: https://github.com/rpm-software-management/modulemd-tools
Source0: https://github.com/rpm-software-management/modulemd-tools/archive/%{version}/%{name}-%{version}.tar.gz
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
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:
repo2module - Takes a YUM repository on its input and creates modules.yaml
containing YAML module definitions generated for each package.
dir2module - Generates a module YAML definition based on essential module
information provided via command-line parameters. The packages provided by
the module are found in a specified directory or a text file containing
their list.
createrepo_mod - A small wrapper around createrepo_c and modifyrepo_c to provide
an easy tool for generating module repositories.
modulemd-merge - Merge several modules.yaml files into one. This is useful for
example if you have several yum repositories and want to merge them into one.
modulemd-generate-macros - Generate module-build-macros SRPM package, which is
a central piece for building modules. It should be present in the buildroot
before any other module packages are submitted to be built.
%prep
%autosetup -p1
%build
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
%install
cd repo2module
%py3_install
cd ..
cp dir2module/dir2module.py %{buildroot}%{_bindir}/dir2module
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 \
%{buildroot}%{_bindir}/modulemd-generate-macros
cp -r modulemd_tools/modulemd_tools %{buildroot}%{python3_sitelib}/modulemd_tools
install -d %{buildroot}%{_mandir}/man1
cp man/*.1 %{buildroot}%{_mandir}/man1/
%check
%{python3} repo2module/setup.py test
cd modulemd_tools
%{python3} -m unittest
%files
%doc README.md
%license LICENSE
%{python3_sitelib}/repo2module
%{python3_sitelib}/repo2module-*.egg-info/
%{_bindir}/repo2module
%{_bindir}/dir2module
%{_bindir}/createrepo_mod
%{_bindir}/modulemd-merge
%{_bindir}/modulemd-generate-macros
%{python3_sitelib}/modulemd_tools
%{_mandir}/man1/repo2module.1*
%{_mandir}/man1/dir2module.1*
%{_mandir}/man1/createrepo_mod.1*
%{_mandir}/man1/modulemd-merge.1*
%{_mandir}/man1/modulemd-generate-macros.1.*
%changelog
* Fri Jan 22 2021 Stephen Gallagher <sgallagh@redhat.com> 0.6-2
- Fix build against libmodulemd-2.12
* Sun Nov 22 2020 Jakub Kadlcik <frostyx@email.cz> 0.6-1
- Generate manpages for all tools in this repository
- modulemd-generate-macros: add a tool for generating module-build-macros
- modulemd_tools: add the first pieces of a python library (for internal usage only)
* Thu Nov 05 2020 Jakub Kadlcik <frostyx@email.cz> 0.5-1
- Release for epel8 as well (frostyx@email.cz)
- Require createrepo_c for the createrepo_mod package (frostyx@email.cz)
- modulemd-merge: improve README.md file (frostyx@email.cz)
- repo2module: improve README.md file (frostyx@email.cz)
- dir2module: improve README.md file (frostyx@email.cz)
- Improve README.md file (frostyx@email.cz)
- createrepo_mod: improve README.md file (frostyx@email.cz)
- Loosen the python3-libmodulemd dependency to just libmodulemd
(frostyx@email.cz)
- createrepo_mod: use just createrepo_c if it has built-in module support
(frostyx@email.cz)
- Explicitly depend on python3-setuptools (frostyx@email.cz)
- createrepo_mod: dump modules.yaml into the correct directory
(frostyx@email.cz)
* Mon Aug 10 2020 Jakub Kadlcik <frostyx@email.cz> 0.4-1
- createrepo_mod: support also non-module repositories (frostyx@email.cz)
* Wed Jul 29 2020 Jakub Kadlcik <frostyx@email.cz> 0.3-1
- Add createrepo_mod and modulemd-merge scripts
* Sun Jul 26 2020 Jakub Kadlčík <jkadlcik@redhat.com> - 0.2-1
- Add createrepo_mod tool
- Add modulemd-merge tool
- Drop Source1, it is not needed anymore
* Tue Jun 09 2020 Jakub Kadlčík <jkadlcik@redhat.com> - 0.1-1
- Initial package

1
sources Normal file
View File

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