hundreds-breakfast-49010
09/05/2019, 10:23 PMUrlToFetch
from a BinaryToolBase
?aloof-angle-91616
09/05/2019, 10:23 PM.get_external_url_generator()
method to get a url generator!aloof-angle-91616
09/05/2019, 10:24 PMbinary_util.py
if that returns Nonealoof-angle-91616
09/05/2019, 10:24 PMclass PantsHosted(BinaryToolUrlGenerator):
witty-crayon-22786
09/05/2019, 11:14 PMwitty-crayon-22786
09/05/2019, 11:15 PMwitty-crayon-22786
09/05/2019, 11:15 PMaloof-angle-91616
09/05/2019, 11:16 PMaloof-angle-91616
09/05/2019, 11:16 PMaloof-angle-91616
09/05/2019, 11:16 PMPantsHosted
class you mentioned works
[3:28 PM]
cosmicexplorer [3:28 PM]
you take the binary_request
(which BinaryToolBase
generates) and add the baseurls
which are a bootstrap option (--binaries-baseurls
)
[3:28 PM]
(see the __init__()
)
[3:28 PM]
then it just works
[3:29 PM]
Greg Shuflin [3:29 PM]
should _make_binary_request
be public?
[3:30 PM]
cosmicexplorer [3:30 PM]
it could be made public
[3:30 PM]
it's still an implementation detail imho
[3:30 PM]
well
[3:30 PM]
no
[3:30 PM]
Greg Shuflin [3:30 PM]
maybe ClocBinary
could have a method that returns a UrlToFetch
?
[3:30 PM]
cosmicexplorer [3:30 PM]
what i wanted to do was to actually make a rule from BinaryRequest -> Digest
[3:31 PM]
Greg Shuflin [3:31 PM]
where should that rule live?
[3:31 PM]
cosmicexplorer [3:31 PM]
i wouldn't put it on ClocBinary
[3:31 PM]
binary_tool.py
[3:31 PM]
we have all the info we need already in BinaryToolBase
and PantsHosted
(edited)
[3:31 PM]
Greg Shuflin [3:31 PM]
PantsHosted
relies on having a baseurl
[3:31 PM]
cosmicexplorer [3:31 PM]
yes
[3:32 PM]
Greg Shuflin [3:32 PM]
which BinaryUtil
provides
[3:32 PM]
cosmicexplorer [3:32 PM]
that's a bootstrap option
[3:32 PM]
--binaries-baseurls
[3:32 PM]
yes
[3:32 PM]
you can make an optionable_rule()
[3:32 PM]
if we can make _make_binary_request
public, then make a ruleset from BinaryRequest -> Digest
which tries all the urls provided for a given BinaryRequest
via invoking the url generator, i think that would work
[3:33 PM]
Greg Shuflin [3:33 PM]
and that ruleset would also rely on BinaryUtil
as an input
[3:33 PM]
@rule(Digest [BinaryRequest, BinaryUtil])
?
[3:36 PM]
cosmicexplorer [3:36 PM]
yes
[3:36 PM]
i think
[3:36 PM]
and then declaring an optionable_rule(BinaryUtil)
so that it can be consumed
[3:38 PM]
and with the rule you just described (@rule(Digest, [BinaryRequest, BinaryUtil]
), anyone who wants a binary tool can just say:```
@rule(Whatever, [ClocBinary])
def do_cloc(cloc_binary):
cloc_snapshot = yield Get(Digest, BinaryRequest, cloc_binary.make_binary_request())
# do whatever with it
def rules():
return [
do_cloc,
optionable_rule(ClocBinary),
]
```witty-crayon-22786
09/05/2019, 11:18 PM1)only for ExecuteProcessRequest... would need something similar for binaries.
witty-crayon-22786
09/05/2019, 11:18 PM2)mm, yep. just one digest then.
aloof-angle-91616
09/05/2019, 11:18 PM(BinaryRequest, BinaryUtil) -> Digest
we can avoid marrying a Subsystem
in general with a UrlToFetch
and we can continue to use the same classes we've been using, just using a different method than .select()
this timealoof-angle-91616
09/05/2019, 11:18 PMBinaryRequest
contains the platformaloof-angle-91616
09/05/2019, 11:19 PMaloof-angle-91616
09/05/2019, 11:19 PMwitty-crayon-22786
09/05/2019, 11:19 PMaloof-angle-91616
09/05/2019, 11:20 PMstill need to add a tree of digestswhat does this mean? making
.make_binary_request()
public in BinaryToolbase
(allowing the @rule
at the end of my above quoted conversation) gives us all the information we need to make a platform-specific binary request, without attaching any new information to any subsystemhundreds-breakfast-49010
09/05/2019, 11:22 PMExecuteProcessRequest
hundreds-breakfast-49010
09/05/2019, 11:22 PMDigest
we can do whatever we want with it, whether it's use it in ExecuteProcessRequest
or something else, right?aloof-angle-91616
09/05/2019, 11:22 PMaloof-angle-91616
09/05/2019, 11:23 PMExecuteProcessRequest
is not relevant now, i brought it up because i wasn't sure why the platform-specificity was seen as a blockerhundreds-breakfast-49010
09/05/2019, 11:23 PMwitty-crayon-22786
09/05/2019, 11:23 PM--version
is an option for these tools is that people want to change the versionaloof-angle-91616
09/05/2019, 11:23 PMwitty-crayon-22786
09/05/2019, 11:23 PMaloof-angle-91616
09/05/2019, 11:23 PMwitty-crayon-22786
09/05/2019, 11:23 PMaloof-angle-91616
09/05/2019, 11:24 PMBinaryRequest
objectwitty-crayon-22786
09/05/2019, 11:24 PMdict_option
rather than a tree, but.aloof-angle-91616
09/05/2019, 11:24 PMaloof-angle-91616
09/05/2019, 11:24 PMhundreds-breakfast-49010
09/05/2019, 11:24 PMBinaryRequest
object be different (and invalidate any caching)?witty-crayon-22786
09/05/2019, 11:24 PMaloof-angle-91616
09/05/2019, 11:24 PMwitty-crayon-22786
09/05/2019, 11:24 PMaloof-angle-91616
09/05/2019, 11:25 PMaloof-angle-91616
09/05/2019, 11:26 PMwitty-crayon-22786
09/05/2019, 11:26 PMaloof-angle-91616
09/05/2019, 11:26 PMwitty-crayon-22786
09/05/2019, 11:27 PMaloof-angle-91616
09/05/2019, 11:27 PMaloof-angle-91616
09/05/2019, 11:27 PMoptionable_rule()
instances?witty-crayon-22786
09/05/2019, 11:28 PM./pants --cloc-binary-version=0.10.0-mycustom-version cloc
, it will break, because any hardcoded digest will mismatchwitty-crayon-22786
09/05/2019, 11:28 PMwitty-crayon-22786
09/05/2019, 11:28 PMaloof-angle-91616
09/05/2019, 11:28 PMaloof-angle-91616
09/05/2019, 11:28 PMaloof-angle-91616
09/05/2019, 11:28 PMaloof-angle-91616
09/05/2019, 11:29 PMUrlToFetch
aloof-angle-91616
09/05/2019, 11:29 PMBinaryToolBase
aloof-angle-91616
09/05/2019, 11:29 PMhundreds-breakfast-49010
09/05/2019, 11:30 PMaloof-angle-91616
09/05/2019, 11:30 PMUrlToFetch
, we also provide an expected digestaloof-angle-91616
09/05/2019, 11:30 PMhundreds-breakfast-49010
09/05/2019, 11:30 PMaloof-angle-91616
09/05/2019, 11:31 PMhundreds-breakfast-49010
09/05/2019, 11:31 PMaloof-angle-91616
09/05/2019, 11:31 PMaloof-angle-91616
09/05/2019, 11:31 PMaloof-angle-91616
09/05/2019, 11:31 PMhundreds-breakfast-49010
09/05/2019, 11:32 PMaloof-angle-91616
09/05/2019, 11:32 PMhundreds-breakfast-49010
09/05/2019, 11:32 PMaloof-angle-91616
09/05/2019, 11:32 PMhundreds-breakfast-49010
09/05/2019, 11:32 PM.select()
on an instance of ClocBinary
hundreds-breakfast-49010
09/05/2019, 11:32 PMaloof-angle-91616
09/05/2019, 11:32 PMhundreds-breakfast-49010
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMcloc
isn't platform-dependenthundreds-breakfast-49010
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMhundreds-breakfast-49010
09/05/2019, 11:33 PMaloof-angle-91616
09/05/2019, 11:33 PMbinary_util.py
hundreds-breakfast-49010
09/05/2019, 11:34 PMaloof-angle-91616
09/05/2019, 11:34 PMaloof-angle-91616
09/05/2019, 11:34 PMhundreds-breakfast-49010
09/05/2019, 11:34 PMselect()
method tehrealoof-angle-91616
09/05/2019, 11:34 PMBinaryRequest -> Digest
rule would be the right thinghundreds-breakfast-49010
09/05/2019, 11:34 PMaloof-angle-91616
09/05/2019, 11:34 PMhundreds-breakfast-49010
09/05/2019, 11:35 PMUrlToDownload -> Snapshot
aloof-angle-91616
09/05/2019, 11:35 PMhundreds-breakfast-49010
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:35 PMhundreds-breakfast-49010
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:35 PMhundreds-breakfast-49010
09/05/2019, 11:35 PMhundreds-breakfast-49010
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:35 PMaloof-angle-91616
09/05/2019, 11:36 PMaloof-angle-91616
09/05/2019, 11:36 PMhundreds-breakfast-49010
09/05/2019, 11:36 PMaloof-angle-91616
09/05/2019, 11:37 PMhundreds-breakfast-49010
09/05/2019, 11:37 PMhundreds-breakfast-49010
09/05/2019, 11:37 PMaloof-angle-91616
09/05/2019, 11:37 PMUrlToFetch
(or UrlToDownload
?) and see whether the error message reports the correct hashhundreds-breakfast-49010
09/05/2019, 11:37 PMaloof-angle-91616
09/05/2019, 11:37 PMaloof-angle-91616
09/05/2019, 11:37 PMBinaryToolBase
subclasses tooaloof-angle-91616
09/05/2019, 11:38 PMaloof-angle-91616
09/05/2019, 11:38 PMversion -> digest
dict_option
(stu was mentioning this earlier)aloof-angle-91616
09/05/2019, 11:38 PMaloof-angle-91616
09/05/2019, 11:39 PMaloof-angle-91616
09/05/2019, 11:39 PMaloof-angle-91616
09/05/2019, 11:39 PMaloof-angle-91616
09/05/2019, 11:39 PMdict_option
because of multiple platforms!aloof-angle-91616
09/05/2019, 11:40 PM{'linux': ('1.0.0', 'asdfasdfsadf'),
'darwin': ('1.0.0', 'asdfasdfdf')}
hundreds-breakfast-49010
09/05/2019, 11:42 PMhundreds-breakfast-49010
09/05/2019, 11:42 PMdict_option
you're talking about would fit inaloof-angle-91616
09/05/2019, 11:44 PM--version
option which is registered on BinaryToolBase
into an option named something like --version-digests
which would have the value like the dict i messaged just abovealoof-angle-91616
09/05/2019, 11:45 PMaloof-angle-91616
09/05/2019, 11:45 PMhundreds-breakfast-49010
09/05/2019, 11:50 PMversion
method on BinaryToolBase
?hundreds-breakfast-49010
09/05/2019, 11:50 PMaloof-angle-91616
09/05/2019, 11:50 PMregister_options()
method, actuallyhundreds-breakfast-49010
09/05/2019, 11:50 PMaloof-angle-91616
09/05/2019, 11:51 PMhundreds-breakfast-49010
09/05/2019, 11:51 PMselect
is doing with italoof-angle-91616
09/05/2019, 11:51 PMhundreds-breakfast-49010
09/05/2019, 11:54 PMaloof-angle-91616
09/05/2019, 11:54 PMaloof-angle-91616
09/05/2019, 11:54 PMhundreds-breakfast-49010
09/05/2019, 11:59 PMaloof-angle-91616
09/05/2019, 11:59 PMaloof-angle-91616
09/06/2019, 12:00 AMsrc/python/pants/option/optionable.py
might have the description of the correct keyword argumentsaloof-angle-91616
09/06/2019, 12:01 AMregister_options()
with the removal_version
kwarg should be what you want to do