In order to manage FreeBSD ports I have used portupgrade for some time. It provides neat facilites such as the command portinstall and portupgrade, I am sure that the use of these commands is pretty straight forward. The standard way to install a port is the following.
> cd /usr/ports/category/portname
> make install clean
Instead portupgrade allows you to do.
> portinstall portname
Or
> portinstall category/portname
One problem with portupgrade is that it's written in Ruby. One might argue that this is not really a problem, but when you have a fresh FreeBSD install you don't want to drag in Ruby as your first package. This takes time and you would rather focus on something else.
Luckily there is an alternative that I quite recently stumbled upon. portmaster supports pretty much the same set of operations but is written in shell script. It's quick to install and you are ready to go in a jiffy. It also handles fetching and port configuration first and then starts building and installing.
> portmaster category/portname
The only problem is that it enforces the use of category/portname as arguments. This is most likely to avoid conflicts since the portname might conflict with other portnames. To resolve this portupgrade presents all "likely" matches and asks you to choose from them, portmaster just dismisses your arguments as invalid. I have considered adding this functionality in some way. Perhaps printing "likely" matches and/or conflicts and then terminating would be a good option?
So, now we have a tool to handle port installation with ease. Then we need a way to search for ports when we don't know the actual name or category. There are of course several such tools but out of the box ports supplies the following way.
> cd /usr/ports
> make search name=searchstring
Or if you want to search in dependencies etc. you can always use key instead of name. But this usually give you far too many hits to browse through. But the output even from name is usually a bit too much, listing dependencies, web addresses and maintainers. For example.
> cd /usr/ports
> make search name=hugs98
Port: hugs98-200609_2
Path: /usr/ports/lang/hugs
Info: An interpreter for the functional programming language Haskell 98
Maint: haskell@FreeBSD.org
B-deps: bash-3.2.39_1 bison-2.3_4,1 damageproto-1.1.0_2 fixesproto-4.0 gettext-0.17_1 gmake-3.81_3 inputproto-1.4.2.1 kbproto-1.0.3 libGL-7.0.3 libGLU-7.0.3 libICE-1.0.4_1,1 libSM-1.0.3_1,1 libX11-1.1.3_1,1 libXau-1.0.3_2 libXdamage-1.1.1 libXdmcp-1.0.2_1 libXext-1.0.3,1 libXfixes-4.0.3_1 libXi-1.1.3,1 libXmu-1.0.3,1 libXt-1.0.5_1 libXxf86vm-1.0.1 libdrm-2.3.1 libglut-7.0.3 libiconv-1.11_1 m4-1.4.11,1 pkg-config-0.23_1 xextproto-7.0.2 xf86vidmodeproto-2.2.2 xproto-7.0.10_1
R-deps: damageproto-1.1.0_2 fixesproto-4.0 inputproto-1.4.2.1 kbproto-1.0.3 libGL-7.0.3 libGLU-7.0.3 libICE-1.0.4_1,1 libSM-1.0.3_1,1 libX11-1.1.3_1,1 libXau-1.0.3_2 libXdamage-1.1.1 libXdmcp-1.0.2_1 libXext-1.0.3,1 libXfixes-4.0.3_1 libXi-1.1.3,1 libXmu-1.0.3,1 libXt-1.0.5_1 libXxf86vm-1.0.1 libdrm-2.3.1 libglut-7.0.3 pkg-config-0.23_1 xextproto-7.0.2 xf86vidmodeproto-2.2.2 xproto-7.0.10_1
WWW: http://www.haskell.org/hugs/
Usually I remedy this using grep, but perhaps I could do better with some scripting? I quickly hacked together an alias to add to my cshrc that would allow to simply type.
> portssearch searchstring
For example.
> portssearch hugs
Port: hugs98-200609_2
Path: /usr/ports/lang/hugs
Info: An interpreter for the functional programming language Haskell 98
Port: ohugs-0.5_5
Path: /usr/ports/lang/ohugs
Info: Interpreter for Haskell with object-oriented features
All this with just two lines, an extra line to work around some difficulties with escaping strings.
set AWKSTR='{ if ( $0 ~ /^Info:/ ) { print $0; print ""; } else { print $0; } }'
alias portssearch "make -C /usr/ports search name=\!:1 | grep -E '^(Port|Path|In
fo):' | awk '$AWKSTR'"
The only problem I have encountered so far is when a port lacks a comment in it's Makefile and Info: is left out you end up with some ugly output. Like this.
Port: japanese/diclookup-emacs20
Port: japanese/navi2ch-emacs20
Port: textproc/dictum-emacs22
But it's usually a non-issue. For now, I am happy with portmaster and my little portssearch alias.
For more information on portmaster see http://dougbarton.us/portmaster.html
Showing posts with label ports. Show all posts
Showing posts with label ports. Show all posts
Sunday, 4 January 2009
Monday, 30 April 2007
Ports maintainer
Some time ago cjg and I decided to try porting some software. Since we both code some Python now and had some interest in coding audio we took upon ourselves to port two modules for Python that involved audio. cjg was done within an hour, I was not. He is a far better FreeBSD user than me (and coder for that matter) and after a few hours of sweat and blood I managed to succeed in my porting aswell. This of course took a lot of help from cjg, so I claim that he deserves atleast >= 50% of the credits for "my" port aswell. Of course, I forgot to blog about it but porting software can be a lot of fun and is great training for ones patience. Perhaps this is one step closer to becoming more involved in my O/S, who knows. Atleast I hope so.
Link to "my" port.
Link to "my" port.
Sunday, 31 December 2006
Installing Python Snack module under FreeBSD
Apparently Snack (http://www.speech.kth.se/snack/) in ports doesn't want to play with Python and I am eager to play and don't want to look into it. So if you have no patience ;) just install the Python module manually.
Get Snack using ports
# portinstall snack
Fetch the source code
# fetch http://www.speech.kth.se/snack/dist/snack2.2.10.tar.gz
Untar it
# tar xvf snack2.2.10.tar.gz
Copy the file that we are interested in to the Python module directory
# cp snack2.2.10/python/tkSnack.py /usr/local/lib/python2.4/site-packages/
Clean up the thrash (keep in mind that there is some useful example code in the demos directory)
# rm snack2.2.10.tar.gz && rm -rf snack2.2.10/
And then start playing with Snack.
EDIT 05/01/07:
(Added it as a text-file aswell. http://www.d.kth.se/~ninjin/texts/cs/snackfreebsd.txt)
Get Snack using ports
# portinstall snack
Fetch the source code
# fetch http://www.speech.kth.se/snack/dist/snack2.2.10.tar.gz
Untar it
# tar xvf snack2.2.10.tar.gz
Copy the file that we are interested in to the Python module directory
# cp snack2.2.10/python/tkSnack.py /usr/local/lib/python2.4/site-packages/
Clean up the thrash (keep in mind that there is some useful example code in the demos directory)
# rm snack2.2.10.tar.gz && rm -rf snack2.2.10/
And then start playing with Snack.
EDIT 05/01/07:
(Added it as a text-file aswell. http://www.d.kth.se/~ninjin/texts/cs/snackfreebsd.txt)
Subscribe to:
Posts (Atom)