362ffeb Preserve modulemd field ordering in dumps/dumps_all

Authored and Committed by crobinso 6 years ago
    Preserve modulemd field ordering in dumps/dumps_all
    
    Right now, serializing a modulemd object to string with dumps()
    produces alphabetic ordering in the yaml document, which doesn't
    match expected modulemd conventions. For example, fedmod rpm2module
    will put document: and version: tags at the bottom of the output
    
    Internally modulemd already populates the dumped dict() in the
    appropriate order, but dict() doesn't preserve ordering, and yaml
    sorts the fields anyways.
    
    Instead, pass an OrderedDict to yaml, and add a custom representer
    to teach yaml how to handle it.
    
        
file modified
+20 -3