View Full Version : New port searching tool
artificer
December 5th, 2008, 15:30
I was looking for a command-line tool that searches within the ports tree and presents the results in a colorful and informative way.
I wasn't satisfied with the current programs in the ports tree, so, I made this little script in python which does exactly that:
eXquisite Port Seeker (http://www.crucible.gr:5555)
tarball (http://www.crucible.gr:5555/xps-0.1.tar.gz)
I won't try to bloat it with features, as there are already sophisticated tools for playing with ports and packages such as portupgrade. It is only meant for searching ports.
The code is not of the best quality, but it works for me. Maybe someone will find it useful.
Any comments are welcome.
SirDice
December 5th, 2008, 17:17
I mainly use http://www.freshports.org ;)
Or in the ports dir:
make search name=portname
Or if I don't know the port's name:
make search key=somesearchkey
anomie
December 5th, 2008, 17:58
Nice work.
artificer
December 5th, 2008, 18:03
I mainly use http://www.freshports.org ;)
Or in the ports dir:
make search name=portname
Or if I don't know the port's name:
make search key=somesearchkey
Of course, both ways are handy. It's just that I usually use the command line, and make search seems a bit limited to me.
anomie
December 5th, 2008, 18:09
FYI, it doesn't seem to be in the ports tree yet. Perhaps after the freeze is over. I'm looking forward to trying it out. (I see you've made the tarball available for download too.)
artificer
December 5th, 2008, 18:17
FYI, it doesn't seem to be in the ports tree yet. Perhaps after the freeze is over. I'm looking forward to trying it out. (I see you've made the tarball available for download too.)
Yes, it will probably take a while until it gets in the tree.
It's just a single executable however (and a man page), so it doesn't need any installation at all. Just unpack and run.
tingo
December 6th, 2008, 23:42
Even with all the options available now, I still use my old script hacked together many years ago:
root@kg-vm# ls -l /usr/local/bin/port
-rwxr-xr-x 1 root wheel 474 Oct 14 2006 /usr/local/bin/port
root@kg-vm# cat /usr/local/bin/port
#!/bin/sh
# @(#)port 1.0 10-nov-2001 T. Ingolfsen / KG4, Norway
#
# Just a quick hack to get any easier way to search for ports
#
NAME=`basename ${0}`
PORTNAME="${1}"
PORTSDIR="/usr/ports"
if [ "$1" = "" ]; then
echo " ${NAME} - find a given port in /usr/ports"
echo " Use with '${NAME} xxx', where xxx is the name of the port."
else
if [ ! -d ${PORTSDIR} ]; then
echo " ERROR: ${PORTSDIR} doesn't exist!"
exit 0
fi
cd ${PORTSDIR}
make search name=${PORTNAME}
fi
As you can see, I haven't even bothered to correct my spelling error in the comment :-)
Citsakots
December 7th, 2008, 02:57
An other way to search for ports when you have a browser with working internet is to use the page below.
http://www.freebsd.org/ports/
DutchDaemon
December 7th, 2008, 03:01
I just use psearch ...
kamikaze
December 8th, 2008, 10:51
Actually make search is quite powerful. You can specify explicitly by which criteria you want to search.
bsddaemon
December 8th, 2008, 11:55
I just use my script, based on whereis and locate. It is able to list all matching ports & categories, let you choose which one to install and remind you to update portsnap as well:
http://asternix.org/data/img/pinstall.png
The script wasnt well written, though, since it was long time ago when I was still new to scripting, but I will post the script if anyone interested.
lme@
December 8th, 2008, 16:39
I usually use make quicksearch when I am looking for a port and I have a portstree installed with an INDEX file.
When I want to know to which port/package a specific file belongs to, I query porgle (http://www.secnetix.de/tools/porgle/) which is very fast and useful.
With tcsh, the INDEX and /var/db/pkg file you can have some fun with the ports management tools:
complete portupgrade 'c/--/(help all afterinstall= backup-packages beforebuild= clean cleanup \
distclean force fetch-only ignore-moved interactive keep-going results-file= \
log-file= make-args= make-env= noexecute new origin= omit-check package \
use-packages use-packages-only noconfig recursive upward-recursive sudo \
sudo-command= uninstall-shlibs verbose noclean nocleanup exclude= yes)/' \
'c/-/(h a A b B c C D f F i k l L m M n N o O p P q r R s S u v w W x y)/' \
'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete portversion 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_deinstall 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_info 'c/-/(a b v p q Q c d D f g i I j k K r R m L s o G W O x X e E l t V P)/' \
'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_delete 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%"`@'
complete portmaster 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete portsnap 'c/-/(I d f k p s)/' \
'n/-d/d/' \
'n/-p/d/' \
'n/*/(fetch extract update)/'
complete pkg_add 'n@-r@`awk -F\| \{sub\(/-\[0-9\]\.\*\/\,\"\"\,\$1\)\;print\ \$1\} /usr/ports/INDEX | sort -u`@'
When you insert the lines to your .tcshrc, you have a completion from /var/db/pkg for portupgrade, portversion, pkg_deinstall, pkg_info, pkg_delete and portmaster as well as a completion from INDEX for 'pkg_add -r'.
But I am getting off-topic here. To the OT: Nice new tool which will for sure find its way to the ports tree! Don't forget to send a PR for it. :)
nORKy
December 8th, 2008, 16:47
I usually use make quicksearch when I am looking for a port and I have a portstree installed with an INDEX file.
When I want to know to which port/package a specific file belongs to, I query porgle (http://www.secnetix.de/tools/porgle/) which is very fast and useful.
With tcsh, the INDEX and /var/db/pkg file you can have some fun with the ports management tools:
complete portupgrade 'c/--/(help all afterinstall= backup-packages beforebuild= clean cleanup \
distclean force fetch-only ignore-moved interactive keep-going results-file= \
log-file= make-args= make-env= noexecute new origin= omit-check package \
use-packages use-packages-only noconfig recursive upward-recursive sudo \
sudo-command= uninstall-shlibs verbose noclean nocleanup exclude= yes)/' \
'c/-/(h a A b B c C D f F i k l L m M n N o O p P q r R s S u v w W x y)/' \
'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete portversion 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_deinstall 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_info 'c/-/(a b v p q Q c d D f g i I j k K r R m L s o G W O x X e E l t V P)/' \
'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete pkg_delete 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%"`@'
complete portmaster 'n@*@`\ls -1 /var/db/pkg | sed "s%/var/db/pkg/%%;s%^\(.*\)-[0-9].*%\1%"`@'
complete portsnap 'c/-/(I d f k p s)/' \
'n/-d/d/' \
'n/-p/d/' \
'n/*/(fetch extract update)/'
complete pkg_add 'n@-r@`awk -F\| \{sub\(/-\[0-9\]\.\*\/\,\"\"\,\$1\)\;print\ \$1\} /usr/ports/INDEX | sort -u`@'
When you insert the lines to your .tcshrc, you have a completion from /var/db/pkg for portupgrade, portversion, pkg_deinstall, pkg_info, pkg_delete and portmaster as well as a completion from INDEX for 'pkg_add -r'.
But I am getting off-topic here. To the OT: Nice new tool which will for sure find its way to the ports tree! Don't forget to send a PR for it. :)
Do you have this fun for zsh ??
lme@
December 8th, 2008, 17:23
Do you have this fun for zsh ??
Nay, but it should be possible to port this to zsh.
artificer
December 8th, 2008, 17:58
Nice new tool which will for sure find its way to the ports tree! Don't forget to send a PR for it. :)
I'm glad it's useful to others as well :)
It's already in the tree, thanks to miwi@'s fast response.
lme@
December 8th, 2008, 22:27
Yeah, miwi@ is a ports machine. :)
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.