> On Dec 26, 2022, at 8:43 AM, Joshua Root <j...@macports.org> wrote:
> 
> https://github.com/macports/macports-infrastructure/blob/master/jobs/port_binary_distributable.tcl
>  
> <https://github.com/macports/macports-infrastructure/blob/master/jobs/port_binary_distributable.tcl>
> List which ports are and aren't considered distributable: 
> <https://gist.github.com/jmroot/f84c329919356bfb1ed2d8425f3cfebb 
> <https://gist.github.com/jmroot/f84c329919356bfb1ed2d8425f3cfebb>>


For those it seems one also needs 
https://github.com/macports/macports-infrastructure/blob/master/jobs/distributable_lib.tcl
 
<https://github.com/macports/macports-infrastructure/blob/master/jobs/distributable_lib.tcl>
 in the current directory.

A plausible test case with the first of those (ffmpeg +nonfree) gave the 
expected result: return code 1, i.e. non-redistributable; and without the 
+nonfree variant, also gave the expected result of return code 0 
(redistributable). That nicely shows that the results reflect the effects of 
dependency differences based on variant.

Does the behavior of those take into account configuration like a modified 
variants.conf (so the result aligns with what variants would be used if one did 
a port install)? I’’m not remotely familiar with the behavior of the various 
MacPorts tcl routines called, and barely familiar with tcl.

But generally this does seem to answer the OP’s questions nicely, even if not 
as part of the “port” command itself; although both of the scripts that obtain 
the information for all ports are quite slow; and while I personally hadn’t 
been concerned with discovering that information, it could sometimes be useful 
so I also appreciate the info and scripts!

For speed, perhaps for finding out which ports were prebuilt, a server-side 
script could simply look for all the binary archives and filter it for a given 
macOS (Darwin) version much more quickly; then a single http(s) request could 
retrieve that information; depending on how large the all versions vs single 
version result might be, one could let the filtering happen on the client side 
if that wouldn’t generate too much network traffic. Even faster would be if the 
list of binary archives was cached, although that might not be worth the 
bother. Likewise if redistributable status for default (assuming vanilla 
variants.conf) variants was cached. There are a few things like redistributable 
status and maybe install date (I recall someone asking about whether that could 
be determined) that would be interesting as extra fields in the registry, 
although that clearly implies a new MacPorts version AND some migration issues 
(and some information only being available for ports installed or updated after 
the update and migration).

I suspect that redistributable status may (if one wants to redistribute 
binaries) be more widely useful than knowing the availability of pre-built 
binaries, given that the latter will likely not include everything permissible, 
and may change anytime a port or something it depends on changes.

Reply via email to