-
Notifications
You must be signed in to change notification settings - Fork 28
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
Define metadata tree root #26
Comments
A more concrete example is my [jats-demo][jd] test suite (with the structure very similar to the example above). The thing is, that I want to implement a test runner, that is aware of fmf, so before it launches the test, it populates environment with some of the meta-data (eg. test deps, version, id). User of my tool is supposed to clone the test suite and run a test, which could look like this:
and jattool will get all the data, etc. But what if user will do this:
or
OK, so what I need to do is make sure that when jattool internally calls fmf, it makes sure it does so only from the top dir. Fair enough. Anyway, I wonder if this shouldn't rather be fmf's responsibility? |
A possible solution would be to introduce a root directory called eg. Behavior of fmf would then be somewhat similar to git:
|
For my use case this change would mean I have to rewrite quite big part of my infrastructure as I would have to change the tree to have .fmf directory in root of my tests. I really do not that... What I am doing is having this 'root' directory specified in my tests and building FMF tree from this directory. This ensures I always have the complete tree. Than I have parameter to restrict running tests only to sum subdirectory, but this already is out of FMF. Also for debugging reasons I'm calling FMF from different subdirectories to see where I am getting the data from. This would not be possible with your change. |
Having to specify the meta-data location in my tests seems to kinda beat the point of having fmf; at least it would not be very independent. I mean, every time I move the suite or move a test within the suite (eg. to sub-dir) or move the whole suite, I'd have to update test or I'd get incorrect data (which might or might not present itself immediately). About the debugging: that use case could be fixed by introducing envvar that would override the root: this is also what git already does. Oh and also I think there was another PR/issue that addressed this. |
I like the idea with envvar for debugging. Given that mostly mimicking what git does seems reasonable including the .fmf directory, which we can use to store some fmf configurations in the future - configurations like attribute specifications that is being discussed. |
Thanks for the idea, Alois. I see the use case. And the git-like approach with the The I can imagine we change the default behaviour of the Would that cover your use case? Note that you always get all objects and that directory structure does not have to map 1:1 to the metadata tree structure and that you can also directly use python API for implementing you custom scenarios. |
But what is the "current directory structure"? My idea (git-like) was that in case no arguments (or envvar overrides) were given, fmf would look for:
I guess that problem with looking for main.fmf upwards is that you might have scenarios like this:
ie. you do make use of main.fmf and inheritance, you just don't have an obvious "root main.fmf". Now if you call fmf from bar/ or foo/, you get a different set of items, but once you add "root main.fmf", the behavior changes. Another case could be when you have a set of independent projects:
At this point, what if somebody accidentally created main.fmf in the storage dir (or anywhere upper in the hierarchy)? .fmf dir IMO solves both of those cases, plus allows for individual leaves to have the same identity (ie. relpath from root vs. from $PWD)---which is my original point. I guess the greater principle is, that if you want to have inheritance and integrity, the scope should be specified more explicitly and in a way that it's safely within the control of the project. |
@jkrysl ...
Yep, I think first candidate could be some format version file, ie. a version encapsulating version of whole fmf specification -- similar to debian/compat. Including "something" would avoid the inconvenience caused by the fact that git does not store empty dirs. (And IMHO the thing about versions is that if you have good versioning strategy it's never too soon to start versioning.) |
I've created separate issue with very similar concept #29 where existence od But as mentioned by @AloisMahdal in 2 comments back using explicit From that PoV I'm little bit against this idea with special Otherwise, from concept of these metadata how it is defined and done by |
@jscotka I think the issue with .fmf dir approach you mentioned can be worked around by choosing the right way to look for this directory if we do not like it. If fmf looks top-down (starts at '/'), importing submodules means the .fmf directory of the submodule gets ignored and the whole tree becomes a branch of the 'parent' tree. |
I like this idea with
Command
Actual result
Expected resultsimilar like another little bit ugly command:
So both commands with root + name creates same path, but second one give you cleaner way what means root element. It also will helps and leads to same behavior like using |
About the "first main.fmf", it boils down to identifying which one is the first, as each strategy has its own problems; I think I've shown them above. I put on my designer hat and tried to think this through: Can't really put my finger on it, but my intuition tells me that using the same element (main.fmf) to both insert data with cascade inheritance and delimit scope of that cascading is something that can't be done. About the subdirectory, I think the intuitive solution would be: just treat it as if it was completely different tree. For example:
there's actually no conflict:
(A) seems to me as the safest and most intuitive one. Looking into subdirs (C) might look useful but it's not worth the extra complexity (if user is interested in collecting data from more project, it's trivial to do it explicitly by (Note that if the version file was included, this could work pretty smoothly even if blue and red are based on different version of the fmf specification itself: /usr/bin/fmf would just have to decide if it supports it.) |
Thanks for the nice example, Alois. I agree with your choice (A). This nicely limits the scope to a single metadata tree. We can always combine multiple trees using additional tooling (like find). It seems to me that directory discovery should be out-of-scope for fmf (do one thing and do it well). So far I'm not convinced that we need to nest metadata trees. But if there is a clear use case we can definitely support ignoring nested tree (well-defined by the Regarding the implemention I would suggest to modify the Command line tool can keep current behaviour: Either it receives desired path(s) as argument or defaults to the current working directory. In both cases discovery of the The We should probably also have an easy way to create the config. Something similar to |
@jscotka, regarding your example: For now I would suggest to prevent tree nesting and rather handle metadata trees individually. That is to have a |
@psss I'm fine with this solution. you have dir structure like
and in config you redefine fist summary
|
Nice. Regarding .fmf/config; I'm not against it, but OTOH,
Regarding the CLI, IMHO fmf binary does not necesarily have to have this init function; at least not for now. I do agree with @jscotka that meta-command style might be better (I imagine |
I see your point with the plain text
I've created a new issue #32 to add support for subcommands. |
This is probably more of a design issue, so I understand if there is some resistance, but I think I can jusify it.
It seems that fmf does not have concept of whole item tree but rather tends to just discover items in all subdirectories. This is nice and simple, but creates the problem that items don't really have "identity" and meta-data actually depends on where I ask.
For example, I have repository like this:
In the top main.fmf, I have
and in the foo/main.fmf
Now I get different results about foo depending on where I ask:
If I have inheritancy, doesn't it imply that I already treat my items as tree? If so, shouldn't they always be resolved as part of the same tree?
Or, from another angle: why can't I "ask" for complete set of meta-data when I'm in the directory of a in leaf item?
The text was updated successfully, but these errors were encountered: