#!/usr/bin/python3from ruamel.yaml import round_trip_load, round_trip_dumpimport sysfor filename in sys.argv[1:]: print(filename) with open(filename) as f: content = round_trip_load(f) with open(filename, 'w') as f: round_trip_dump(content, f)
Acceptance Criteria
New command is available
Edited
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
This is actually done already when running bst track
Is it ? That would seem to me to be a bug, we use ruamel.yaml round tripping explicitly to ensure that we do not change any whitespace or ordering or anything besides the thing we intend to change.
I think the feature request is a good one, but if we're accidentally doing this at bst track time, that seems problematic to me; even if the format does not adhere to some yet-to-be-defined standard; bst track should not introduce diffs which are unrelated to the changes it makes.
Is it ? That would seem to me to be a bug, we use ruamel.yaml round tripping explicitly to ensure that we do not change any whitespace or ordering or anything besides the thing we intend to change.
It is! Yeah I think it should not happen when you run bst --track, but that is #470 (closed)
Update on this: As pointed out at #470 (comment 97599171), bst track still changes the indentation of the bst files, so I guess we can use that to implement this?
I think we all agree that this would be a useful feature.
I am a bit concerned about the implementation in !955, and think we need a more hands on approach to ordering of the output.
For instance, I think we can all agree that the first thing which should appear in a .bst file is the kind: attribute.
The jhbuild2bst script we used when converting jhbuild modulesets (which happens to be python2 based), shows an example of how to construct a yaml dumper with ruamel.yaml and dictate the output order of keys.
Something like this should be employed to allow control on what the default order is supposed to be. Further than this, it can be desirable to also allow plugins to contribute to informing BuildStream on what the ordering should be, since plugins also play a big part in defining the format itself.