Tests added.
Details
- Reviewers
kparal tflink jskladan - Maniphest Tasks
- T492: support downloading a file from current package's dist-git
- Commits
- rLTRNb9c3644b5131: Add distgit directive
Diff Detail
- Repository
- rLTRN libtaskotron
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Thanks for the patch. There are some minor documentation issues. My main concern is about the automatic branch switching. I'm not sure how to do that reliably without asking an external service (koji) for more information. Or we could support just master (or a different branch per maintainer's choice), but that's somewhat limited.
libtaskotron/directives/distgit_directive.py | ||
---|---|---|
13 | Not everyone might be familiar with Fedora distgit. I would clarify it:
| |
17 | It would be nice to support both N(E)VR and N (package name). Because if I write a generic check that runs for every package, I'll probably use NEVR (that would be the item from a koji_build event). If I write a task that is specific for pidgin and runs only on new pidgin builds, or runs daily or something, I might want to hardcode pidgin as the package name - either for better readability, or because item will be used for something else. | |
21 | This seems to have been written with just a single file in mind, and then later extended to a list of files, but documentation was not adjusted. Can it also download a directory? Not clear. | |
22 | list of str? | |
25 | This seems to have been written with just a single file in mind, and then later extended to a list of files, but documentation was not adjusted. It should also explain what the default behavior is when the localpath parameter is not given. | |
26 | list of str? | |
34–35 | These two should be the same error, TaskotronValueError. It's an invalid input, in both cases. | |
53 | workdir is not defined in the parameters documentation. | |
75–79 | I see now why you want to know release of the build, because you automatically switch branches. But that is not documented at all. Please document it, thanks. When only a package name is used, master should be used (and/or offer a parameter to override that). Unfortunately, I'm afraid the current implementation will not work. It will break with:
How to fix it? Hmm, not sure. The only reliable way seems to be to query koji and find out which tag this package has been built against (or is pushed in, not sure which one is better way). Which is unfortunate, can't be done offline. But I have no better idea, at the moment :-/ | |
80 | A note: If we want to support directory downloads, we will probably need to go from http to git protocol. | |
87 | This is a bit misleading, there is no "download" action, because this directive has no action parameter. A slight rephrasing will fix this :) | |
89–91 | This is a bit more complicated, because python_utils.iterable() checks that the object is iterable, but also not a string. I would simply say:
The documentation says clearly what is supported (list of str). | |
98–99 | Ditto as for path. |
A few notes added, but in general it looks good. Please adjust the documentation and the unit test before committing, though, thanks.
libtaskotron/directives/distgit_directive.py | ||
---|---|---|
13 | I had a typo in there, s/directory/repository :-) | |
17 | Please document that package disttag determines the git branch used for file download. | |
21 | The example should probably be:['xchat.spec'] | |
25 | Example probably ['specs/xchat.spec'] | |
libtaskotron/rpm_utils.py | ||
102 | If you want to make it simpler, you can call this simply dist_tag(). | |
108 | It would be great if you could include an example, because it's not immediately clear if the returned string contains the leading dot or not (the rpm macro contains it). | |
testing/test_rpm_utils.py | ||
129–133 | Could you add a test which throws an exception on an unsupported dist tag? E.g. el7 :-) |
Not everyone might be familiar with Fedora distgit. I would clarify it: