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

Support for merging metadata trees #51

Open
psss opened this issue Oct 31, 2018 · 1 comment
Open

Support for merging metadata trees #51

psss opened this issue Oct 31, 2018 · 1 comment
Labels
enhancement New feature or request

Comments

@psss
Copy link
Collaborator

psss commented Oct 31, 2018

It would be useful to be able to merge multiple structures into a single metadata tree. An example use case can be merging custom configuration with default settings. As a quick hack we can do something like this:

tree = fmf.Tree("default")
tree.grow("custom")

For such cases it would be probably better to have possibility to initialize empty tree and then grow it multiple times:

tree = fmf.Tree()
tree.grow("default")
tree.grow("custom")

We could also add support for multiple trees directly in the constructor (which seems like a little bit more clean solution):

tree = fmf.Tree(['default', 'custom'])

However there are a few things which need to be solved: There are attributes which kind of expect a single tree only: root, version, original_data. Also, repeated call of grow() results in inherit() being applied multiple times which might cause problems.

@psss psss added the enhancement New feature or request label Oct 31, 2018
@jkrysl
Copy link
Contributor

jkrysl commented Oct 31, 2018

My use case is basically single tree consisting of 2 parts:

1st part:
/tests/component/* [insert lots of .fmf files over different levels in here with no public data]
2nd part:
/tests/component.fmf (private data required by some of the tests, replacing some default values)
/tests/component/* [insert tests that cannot be made public]

At the moment all this data in in single repo, but we are moving to separate them into 2 repos, lets call them 'upstream' and 'downstream', where downstream repo has only private data. The goal is to have no duplication between the repo and have as much as possible in the 'upstream'.

If solution to this issue can solve this with FMF instead of just copying the files over from 'downstream' to 'upstream' locally, that would be preferable as it is much cleaner solution.

Note:
I suppose the attributes root, version and original_data would be identical for both of the trees, so merging them should happen seamlessly to single tree. If this is not true, the merge should probably happen to different tree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants