Deprecating port list

James Berry jberry at macports.org
Fri Mar 13 08:31:02 PDT 2009


Hi Ryan,

On Mar 13, 2009, at 1:42 AM, Ryan Schmidt wrote:

> I have not used "port list" or "port echo" very often.
>
> Now that I'm looking at them, I'm confused about echo's behavior.

I'll try to answer this; the reasons for this are a little subtle. As  
the author of this stuff, at least I understand the motivations  
involved.

The ports that may be specified on the command line may be general  
("apache"), or more specific ("apache at 1.1"), or more specific yet  
(addition of variant specs). So the list of ports we build up includes  
those various degrees of information.

port tries to be careful not to assume more than it knows. If you just  
say "port echo zlib", it just knows that you've specified zlib, but  
not anything else about it.

pseudo-ports, at least in some cases, expand to much more specific  
information. "port echo installed", for instance, knows exactly which  
version of apache is installed, and so will expand the pseudo-port to  
that more specific instance of the apache port. You're thankful for  
this behavior when you say something like "port uninstall inactive",  
and rely on the inactive pseudo-port to expand to a specific port and  
version of the inactive port. Depending on the particular pseudo-port,  
the version information may relate to the latest version of the port,  
or a version that is installed.

port is also careful, when doing set operations on ports, to do the  
right thing in promoting or coalescing this information. If I remember  
right, for instance, "apache and apache at 1.1" will resolve to  
"apache at 1.1", but "apache at 2.0 and apache at 1.1" will resolve to the null  
set. Etc.

That background laid, I'll try to get to the answer. "port echo"  
really does just tell you all the information this it has about the  
port specifications you've given. In the case of "port apache" (or  
"port zlib"), it doesn't know anything else. Where you specified more,  
or where a pseudo-port supplied more specific information, it has more  
knowledge, and will report it.

Remember that port echo, itself, doesn't query any database of ports:  
it just echos what you gave it (including expansions thereof). The  
pseudo-ports, on the other hand, do hit the database, and so may have  
supplied more information from there.

Hope that helps.

James



> I have zlib installed:
>
> $ port installed zlib
> The following ports are currently installed:
>  zlib @1.2.3_2+universal (active)
>
> "port list zlib" shows the name, version and category:
>
> $ port list zlib
> zlib                           @1.2.3          archivers/zlib
>
> "port echo zlib" shows the name only:
>
> $ port echo zlib
> zlib
>
> But "port echo installed" shows the name and version, revision and  
> variants:
>
> $ port echo installed | grep ^zlib
> zlib                           @1.2.3_2+universal
>
> Why does "echo" behave differently depending on whether zlib was  
> specified implicitly via the "installed" pseudo-port, or explicitly  
> on the command line?
>
> I guess what's happening is that "installed" is expanding to not  
> only the names of the installed ports but also their version,  
> revision and variants, which I can even fake:
>
> $ port echo zlib @1.0_0+foo+bar
> zlib                           @1.0_0+bar+foo
>
>
> _______________________________________________
> macports-dev mailing list
> macports-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macports-dev



More information about the macports-dev mailing list