Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module component refs are lost when dumping the object to a string #85

Closed
mprahl opened this issue Sep 6, 2018 · 1 comment
Closed
Milestone

Comments

@mprahl
Copy link
Contributor

mprahl commented Sep 6, 2018

If I have a module component that has a ref specified, the ref is lost when I dump the module to a string.

Here is the reproducer in Python:

>>> import gi
>>> gi.require_version('Modulemd', '1.0')
>>> from gi.repository import Modulemd
>>> 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'].get_ref() == 'private-x'
>>> mmd2 = Modulemd.Module().new_from_string(mmd.dumps())
>>> assert mmd2.get_module_components()['testmodule'].get_ref() == 'private-x'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AssertionError
sgallagher added a commit to sgallagher/libmodulemd that referenced this issue Sep 6, 2018
Fixes: fedora-modularity#85

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
@sgallagher
Copy link
Collaborator

Turns out there was a copy-paste error in the YAML output and I was writing the repository value to the ref. Oops. PR is out.

@sgallagher sgallagher added this to the 1.6.4 milestone Sep 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants