Searching ports with 'make search'

I try to understand how the command make -C /usr/ports search works. I think I understood mostly all but perhaps... not all. Well, main keywords and excluding counterparts are OK, so if I want to searching for port where name starts with mc I run the command:

make -C /usr/ports search name=^mc

the result display two ports: mc and mc-light, plus the list of 'moved' ports. Now I want exclude the 'moved' ports. In the file /usr/ports/Mk/bsd.port.subdir.mk there is the execution code for search command, I found the environment variable PORTSEARCH_MOVED, it should help me, so I execute the command before as:

make -C /usr/ports -DPORTSEARCH_MOVED=0 search name=^mc

but the result is the same as before: 'moved' ports are still present in the result.

Ok, now I want to search for the exact name for a port, the search keywords accept a regular expression. I guess this command should do what I want:

make -C /usr/ports search name='^mc$'

note the 'name' now is assigned the string '^mc$' terminating with a dollar character (end of string in regex), but it seems it's not accepted.

I have other questions about the search (and quicksearch) command about other special keywords (xdisplay and xkeylim. I, in part, understood dispaly and keylim) I will ask for them later, the two question in this post are about the PORTSEARCH_MOVED environment variable usage and the dollar character in strings. I misunderstood something? Thanks for your time.

P.S. Actually to search for an exact port name I use the command

find /usr/ports -depth +1 -depth -3 -name <port_name>
 
Now I want exclude the 'moved' ports.
You were on the right track. Use make -C /usr/ports search PORTSEARCH_MOVED=0 name=^mc
now I want to search for the exact name for a port
I would use something like e.g. make -C /usr/ports search name=^mc-[0-9].* because port names have a version suffix, which usually (always?) begins with a number.

As you already know the $ sign in regular expressions matches the end of a string. As a consequence your search of ^mc$ looks for exactly the string mc with nothing after it and nothing before it.
 
Ok, thank to you all for tips, in the while I understood the use of make search command, it's really powerful. I will try psearch port, also http://www.freshports.org is useful, sometimes I search there.
I'm training in sh scripting improving my port maintainer script, added the 'search' command that make use of all make search features, thank you again.
 
Back
Top