Bugfix update

- Fix generation of module component YAML
- Output NSVC information using decimal version

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
This commit is contained in:
Stephen Gallagher 2018-09-06 13:15:13 -04:00
parent b262479727
commit adb02d1ef8
No known key found for this signature in database
GPG Key ID: 7A25556236BAA3A3
3 changed files with 162 additions and 1 deletions

View File

@ -0,0 +1,116 @@
From b873aca640964389935d88a90a657abba89421e3 Mon Sep 17 00:00:00 2001
From: Stephen Gallagher <sgallagh@redhat.com>
Date: Thu, 6 Sep 2018 11:17:41 -0400
Subject: [PATCH 1/2] Properly write out the ref for module components
Fixes: https://github.com/fedora-modularity/libmodulemd/issues/85
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
---
modulemd/v1/modulemd-yaml-emitter-modulemd.c | 2 +-
modulemd/v1/tests/test-modulemd-python.py | 50 +++++++++++++++++++
modulemd/v1/tests/test-modulemd-translation.c | 2 +-
3 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/modulemd/v1/modulemd-yaml-emitter-modulemd.c b/modulemd/v1/modulemd-yaml-emitter-modulemd.c
index 87093813e28f5dd42ab014265874ce2148372c8a..7b0fbfafe1cdb4651f2f9b7147f9c082eb76ee2a 100644
--- a/modulemd/v1/modulemd-yaml-emitter-modulemd.c
+++ b/modulemd/v1/modulemd-yaml-emitter-modulemd.c
@@ -1353,11 +1353,11 @@ _emit_modulemd_module_components (yaml_emitter_t *emitter,
MMD_YAML_EMIT_STR_STR_DICT (
&event, name, value, YAML_PLAIN_SCALAR_STYLE);
}
/* Ref */
- value = modulemd_component_module_dup_repository (module_component);
+ value = modulemd_component_module_dup_ref (module_component);
if (value)
{
name = g_strdup ("ref");
MMD_YAML_EMIT_STR_STR_DICT (
&event, name, value, YAML_PLAIN_SCALAR_STYLE);
diff --git a/modulemd/v1/tests/test-modulemd-python.py b/modulemd/v1/tests/test-modulemd-python.py
index 07823213de9c7f16e16719efe0eccf155117cfa5..596665a6df2e367d0817c08b0bfc651cecd14e6a 100755
--- a/modulemd/v1/tests/test-modulemd-python.py
+++ b/modulemd/v1/tests/test-modulemd-python.py
@@ -214,10 +214,60 @@ class TestIssues(unittest.TestCase):
yaml_output = mmd_translation.dumps()
except GLib.GError as err:
# A proper exception is expected here
pass
+ def test_issue85(self):
+ """
+ Component module refs are lost when dumping to YAML
+ """
+ mmd = Modulemd.Module().new_from_string("""
+document: modulemd
+version: 1
+data:
+ summary: A test module in all its beautiful beauty.
+ description: This module demonstrates how to write simple modulemd files And can be used for testing the build and release pipeline.
+ license:
+ module: [ MIT ]
+ dependencies:
+ buildrequires:
+ platform: el8
+ requires:
+ platform: el8
+ references:
+ community: https://fedoraproject.org/wiki/Modularity
+ documentation: https://fedoraproject.org/wiki/Fedora_Packaging_Guidelines_for_Modules
+ tracker: https://taiga.fedorainfracloud.org/project/modularity
+ profiles:
+ default:
+ rpms:
+ - acl
+ api:
+ rpms:
+ - acl
+ components:
+ rpms:
+ acl:
+ rationale: needed
+ ref: rhel-8.0
+ modules:
+ testmodule:
+ ref: private-x
+ rationale: Testing module inclusion.
+ buildorder: 10
+""")
+ assert mmd.get_module_components(
+ )['testmodule'].peek_ref() == 'private-x'
+
+ mmd2 = Modulemd.Module.copy(mmd)
+ assert mmd2.get_module_components(
+ )['testmodule'].peek_ref() == 'private-x'
+
+ mmd3 = Modulemd.Module.new_from_string(mmd.dumps())
+ assert mmd3.get_module_components(
+ )['testmodule'].peek_ref() == 'private-x'
+
class TestIntent(unittest.TestCase):
def test_basic(self):
intent = Modulemd.Intent.new("intent_name")
diff --git a/modulemd/v1/tests/test-modulemd-translation.c b/modulemd/v1/tests/test-modulemd-translation.c
index a85ba5131db562aa9be3255fae3db13e9ee66508..dfa07f48d5ada811a5c82f14e7bcf52c7b258b94 100644
--- a/modulemd/v1/tests/test-modulemd-translation.c
+++ b/modulemd/v1/tests/test-modulemd-translation.c
@@ -350,11 +350,11 @@ modulemd_translation_test_index (TranslationFixture *fixture,
"demonstrates arches and multilib.\n arches: [i686, x86_64]\n "
" multilib: [x86_64]\n xyz:\n rationale: xyz is a bundled "
"dependency of xxx.\n buildorder: 10\n modules:\n "
"includedmodule:\n rationale: Included in the stack, just "
"because.\n repository: https://pagure.io/includedmodule.git\n "
- " ref: https://pagure.io/includedmodule.git\n buildorder: 100\n "
+ " ref: somecoolbranchname\n buildorder: 100\n "
"artifacts:\n rpms:\n - bar-0:1.23-1.module_deadbeef.x86_64\n - "
"bar-devel-0:1.23-1.module_deadbeef.x86_64\n - "
"bar-extras-0:1.23-1.module_deadbeef.x86_64\n - "
"baz-0:42-42.module_deadbeef.x86_64\n - "
"xxx-0:1-1.module_deadbeef.i686\n - xxx-0:1-1.module_deadbeef.x86_64\n "
--
2.19.0.rc0

View File

@ -0,0 +1,35 @@
From e69860136a11441a9f952ac97da1040a3219b4d6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
Date: Wed, 5 Sep 2018 12:20:36 +0200
Subject: [PATCH 2/2] Use decimal version in NSVC
Fixes: #82
---
modulemd/v1/modulemd-modulestream.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modulemd/v1/modulemd-modulestream.c b/modulemd/v1/modulemd-modulestream.c
index 1ee6e1cffc5cecd19439ca47afc4425e9808aaa4..58317c17564301f85984f7608356002afeb29921 100644
--- a/modulemd/v1/modulemd-modulestream.c
+++ b/modulemd/v1/modulemd-modulestream.c
@@ -1796,15 +1796,15 @@ modulemd_modulestream_get_nsvc (ModulemdModuleStream *self)
}
if (context)
{
nsvc = g_strdup_printf (
- "%s:%s:%" PRIx64 ":%s", name, stream, version, context);
+ "%s:%s:%" PRIu64 ":%s", name, stream, version, context);
}
else
{
- nsvc = g_strdup_printf ("%s:%s:%" PRIx64, name, stream, version);
+ nsvc = g_strdup_printf ("%s:%s:%" PRIu64, name, stream, version);
}
return nsvc;
}
--
2.19.0.rc0

View File

@ -6,7 +6,7 @@
Name: libmodulemd
Version: %{majorminorversion}%{?patchversion:.%{patchversion}}
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Module metadata manipulation library
License: MIT
@ -28,6 +28,12 @@ Obsoletes: python3-modulemd < 1.3.4
# Patches
# https://github.com/fedora-modularity/libmodulemd/issues/85
Patch0001: 0001-Properly-write-out-the-ref-for-module-components.patch
# https://github.com/fedora-modularity/libmodulemd/issues/82
Patch0002: 0002-Use-decimal-version-in-NSVC.patch
%description
C Library for manipulating module metadata files.
See https://github.com/fedora-modularity/libmodulemd/blob/master/README.md for
@ -92,6 +98,10 @@ export MMD_SKIP_VALGRIND=1
%{_datadir}/gtk-doc/html/modulemd-1.0/
%changelog
* Thu Sep 06 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.3-2
- Fix generation of module component YAML
- Output NSVC information using decimal version
* Tue Sep 04 2018 Stephen Gallagher <sgallagh@redhat.com> - 1.6.3-1
- Update to 1.6.3
- Drop upstreamed patch