#58 Preserve field ordering in dumps/dumps_all
Merged by ralph. Opened by crobinso.
crobinso/modulemd dump-ordered  into  master

Download 58.patch

I noticed that 'fedmod rpm2module' and mbs-build modules.yaml output has alphabetic field ordering, which doesn't match modulemd file conventions. This PR fixes it, by formating the data internally into an OrderedDict, and teaching yaml how to handle it. Public API is unchanged, but maybe _dumpd_ordered could be public, or dumpd grow an ordered= argument or something. Suggestions welcome or just fix it as you see fit

Looks good to me.

@sgallagh, does your team still look after this lib?

Does this change have any relation to the modulemd C implementation you worked on?

@ralph No, the libmodulemd implementation has a fixed output format that matches the spec.yaml exactly.

@sgallagh - can you advise? Is libmodulemd in a place where we should start porting tools to it (like fedmod rpm2module and mbs-build)?

Or, should we accept this patch and cut a new python-modulemd release?

@ralph: For now, accept this patch. Our libmodulemd is planned to gain a Python wrapper such that it will be a drop-in replacement for python-modulemd, but it's on the back-burner at the moment.

I suppose you could opt to plug into the GObject Introspection Python interface provided by libmodulemd if you wanted, but I am not prepared to suggest that's a requirement at this stage.

Pull-Request has been merged by ralph

Thanks @crobinso, @sgallagh. This should be available in v1.3.3.

Metadata