Add distgit directive
ClosedPublic

Authored by mkrizek on Jun 10 2015, 8:56 AM.

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.
mkrizek retitled this revision from to Add distgit directive.Jun 10 2015, 8:56 AM
mkrizek updated this object.
mkrizek edited the test plan for this revision. (Show Details)
mkrizek added reviewers: tflink, kparal, jskladan.
kparal requested changes to this revision.Jun 10 2015, 11:49 AM

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:

Download files from Fedora package repository (usually called 'distgit') hosted at http://pkgs.fedoraproject.org/ . Any files hosted at that directory can be downloaded for a chosen package.

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:

  • epel builds
  • builds with 1.fc22.1 release (which is allowed)
  • builds with no fcXX in release (which is allowed, try rpm -q fedora-release)
  • .fc21 builds in Fedora 22, because there hasn't been any mass rebuild for F22, so fc21 packages are completely fine and ubiquitous in F22

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:

"Incorrect value type of the 'path' parameter: %s" % type(input_data['path']))

The documentation says clearly what is supported (list of str).

98–99

Ditto as for path.

This revision now requires changes to proceed.Jun 10 2015, 11:49 AM
mkrizek updated this revision to Diff 1097.Jul 3 2015, 1:36 PM
  • Address issues mentioned in the review
mkrizek updated this revision to Diff 1100.Jul 7 2015, 7:44 AM
  • Add test for rpm_utils.get_dist_tag
tflink accepted this revision.Jul 8 2015, 4:25 AM
kparal accepted this revision.Jul 8 2015, 8:23 AM

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 :-)

This revision is now accepted and ready to land.Jul 8 2015, 8:23 AM
This revision was automatically updated to reflect the committed changes.