PORTSEARCH


Missions
* Allow searching for ports that install some file, like find /usr/ports -name pkg-plist |xargs grep pattern
* Be as fast as possible
* Do everything that can be done with make search in the ports directory and with /usr/ports/Tools/scripts/portsearch so it is possible to use one tool for all kinds of searching

Current features
* Allows searching for ports by name, key (name, comment or dependencies), path, info (comment), maintainer, category, fetch, extract, patch, build and run dependencies, www site and packing list file
* Stores the packing lists of all ports in its own database, allowing fast search and report
* Incremental updates of its database in addition to database creation from scratch. While database creation is relatively slow operation (as slow as make index or even slower) portsearch supports incremental database updating, generating only the packing lists of the ports that have changed since the last database creation/update. This speeds up creating an up to date database to a reasonable amount of time, once an old database is present.

Pre-history
Once upon a time I got tired of typing commands that wrapped on the screen for searching a port that installs a given file and waiting thousands of seconds for the operation to complete. This appeared to be a common task, so I did something like cat /usr/ports/*/*/pkg-plist > /tmp/plist-all, but this had some major flaws like missing the PLIST_(FILES|DIRS) variables in Makefiles and not expanding %%FOOBAR%% variables. So I wrote simple 50-70 lines sh script that used generate-plist target which worked ok for a while, but as it got complex with incremental updates and other extensions it also got slow. Then I decied to use the big gun and wrote it in C. That's how portsearch appeared.

Flaws
Some ports generate their plists after being installed, making it impossible to record the plist without fetching the source tarballs, compiling and installing the software. Currently for these ports empty or flawed plists are recorded. One way to fix this problem is to retrieve the plists for these ports from the precompiled packages available at ftp.freebsd.org but the whole packages need to be fetched, causing (large) amount of unefficient network traffic.

About the name
I choose portsearch for obvious reasons. It does not interfere with any existing software, particularly /usr/ports/Tools/scripts/portsearch as the tool installs in /usr/local/bin/ and /usr/ports/Tools/scripts/ is not in the PATH by default. On 23 Dec 2005 I emailed the author of scripts/portsearch Mark Ovens <marko@> and asked him if he has something against a tool with the same name to exist in /usr/local/bin/. I got no answer since then.

Download
Current version is 1.3.5, released on 26 Mar 2021.
FreeBSD Port is also available.
Portsearch source code is on GitHub: https://github.com/vasild/portsearch.

Author
Vasil Dimov <gro.DSBeerF@dv>