should depends_lib really mean depends_lib-append ??

Ryan Schmidt ryandesign at macports.org
Wed Jul 5 03:51:10 UTC 2017


On Jul 4, 2017, at 19:53, Ken Cunningham wrote:

> This feels like something that has likely been discussed before ....
> 
> Now that PortGroups have important depend_lib-append, etc, in them, we don't want Portfiles to reset these by accidentally using depends_lib and trashing them, and yet this is easily done:
> 
> See <https://trac.macports.org/ticket/54422>
> 
> 
> I would think that almost always, what the Portfile author intends is depends_lib-appends.
> 
> Should we just make depends_lib mean depends_lib-append (and similar for depends_build and depends_run) ?

This would be similar to how currently "default_variants +foo" means "default_variants-append +foo", though it was suggested that this unusual "feature" should be "fixed" by making default_variants behave like other options.

I'm not sure if it's a good idea.

It would generally be a good idea for portfile authors to write "depends_lib-append" in most cases.

I would bet that most or all instances where a port has one set of dependencies and then overwrites them later is either a bug or could be written more straightforwardly. For example, if a port has a dependency and a subport does not, the port shouldn't declare the dependency globally and then clear it in the subport; it should instead only declare the dependency in an "if {${subport} eq ${name}}" block.

> If someone really wants to reset all the depends (almost never wanted, I bet) we could have specific 
> 
> depends_lib reset
> 
> command that would never be used.


Yes we would need a syntax for that, because there is at least one situation where we want to be able to clear all dependencies: when a port will not actually be installed, for example because it is not compatible with the user's macOS version or has been replaced (e.g. the obsolete-1.0 portgroup).

I don't like special-casing the word "reset" in this way. Maybe there's an existing Tcl command or syntax that could be used, like unset.



More information about the macports-dev mailing list