The waiverdb-cli is trying to guess the product version based on the subject. If it is not possible to determinate it, it will just ask for it from the user. Issue link: https://pagure.io/waiverdb/issue/111
No need for data and the loop. Just use assert directly on the values.
data
assert
This look unrelated to the change.
I know... But I noticed it was not tested... Maybe I can do a different PR.
Hmm, did you accidentally revert some commit? (bddd08977e45b0940b6a6f16d3c7ae7d14cbb346)
rebased onto 6328d651ce20b06736e0e1fcfdb3cd7c16c2d4a2
@lholecek about your last comment: yeah, I think I did some mistake. It should be fine now.
rebased onto 6b2dff610a5cc421b1b7158c9bf4de5e3381571b
rebased onto c5496a645afab4478891ac64103b4d76b35dd628
It should be ok now
Hmm... but shouldn't it not make an HTTP request in this case? Why do we assert that requests.request was called?
"determinate" is not a word, you want "determine" :-)
Also it's always a good idea to tell the user exactly how to provide the missing value, in errors like this. I would suggest to keep it simple, something like this:
Specify product version using --product-version
Maybe we should have two separate functions for guessing the product version, one which takes a compose id and one which takes a dist tag (or Koji build target I guess)... I am worried that .startswith('f') might be too broad if that logic is applied to compose ids, which it looks like it will be here.
.startswith('f')
Also, I wonder if there is similar logic in rpkg/fedpkg/rhpkg which we could reuse somehow... I think it knows how to guess dist tags and build targets based on git branches which is similar.
rebased onto 660018db88d819b64b24e36a592b34271587123d
@dcallagh Thank you for your comments. I changed what you suggested. I think it should be fine now.
For what concerns the fact that we can probably find a similar logic in rpkg/fedpkg/rhpkg: I checked a little and I didn't find what I needed (probably lack of knowledge of those software by my side). Maybe we can talk about it in our meeting tomorrow (Wednesday).
Here, 'rhel-7' should be 'epel-7' instead.
rebased onto d93fb3b6682310ae679e4879821fe527bd684581
rebased onto 02bea20a6eb87b434e57237042c132a82be99e82
Corrected what Ralph said and it should be more readable now. If you don't like it let me know and I'll change it again.
rebased onto 0d5219f2bd1038dfada3024cd2d8d6f6e8dd9be2
rebased onto 35b69edb48b2f85bce8f647248727be60c5c2dc3
:+1:
+1 though this slows tests considerably (py.test-3 tests/test_cli.py::test_create_waiver_no_product_version takes 2s).
py.test-3 tests/test_cli.py::test_create_waiver_no_product_version
Guessing build target from git branch is easy (at least for rpm builds): you just slap -candidate and the end (unless it's master branch in which case you just return rawhide).
-candidate
master
rawhide
Dist tags are more fun. Fedpkg does this. Rhpkg is significantly more complicated. Look for load_rpmdefines method in rhpkg/__init__.py. Either way the code is not really reusable.
load_rpmdefines
rhpkg/__init__.py
Pull-Request has been merged by ralph
The waiverdb-cli is trying to guess the product version based on the
subject. If it is not possible to determinate it, it will just ask
for it from the user.
Issue link: https://pagure.io/waiverdb/issue/111