category for local ports

Vivek Khera vivek at khera.org
Thu Jun 8 21:29:27 UTC 2006


On Jun 8, 2006, at 8:45 AM, Rong-En Fan wrote:

>>> Also, is there no way to just add the dependencies from the local  
>>> ports
>>> into the INDEX file?  It takes about 25 minutes on my NFS server to
>>> update that file from scratch.  I'd love to be able to just  
>>> append my
>>> local ports' entries onto it.
>>
>> Setting of EXTRA_CATEGORIES in pkgtools.conf does not help?
>
> IIRC, portupgrade or portsdb ignores it. I can try it with the latest
> portupgrade later.

Basically I've settled on this approach, which has worked out  
extremely well for the last couple of days at least :-)

All local ports are in /usr/ports/local/kci-FOO for port named kci- 
FOO.  I prefix all my local ports with 'kci-' to make things easy to  
identify.  In /usr/ports/local is a Makefile with SUBDIR+=kci-FOO for  
each port just like any other category Makefile.

In pkgtools.conf I add 'local' to EXTRA_CATEGORIES.  This seems to be  
not used, but doesn't hurt.

Then, to build the INDEX file I came up with a really great hack....  
it goes like this:

portsnap fetch
portsnap update
portsnap -I update
localportindex
portsdb --update


where localportsindex is the following script.  it takes advantage of  
the fact that Tools/make_index reads the basically same format as the  
INDEX file itself but will complain about not finding the port  
pathnames for the ports it has already processed.  We just ignore the  
warnings it emits (bad style, yes... but it works for me) and only  
pull the lines we just created, ie, our local ports.  This takes just  
a few seconds rather than 25 to 40 minutes, and is robust in that the  
data is correct 100% relative to the other entries in the index file.

--cut here--
#!/bin/sh

# hack to append our local ports to the /usr/ports/INDEX-6 file to  
let the
# portupgrade and portinstall utilities see them.

# Run this after normal update of INDEX file, such as portsnap or  
fetchindex

# $Id: localportindex 463 2006-06-07 16:27:35Z khera $

# for FreeBSD 6.x
PORTSBASE=/usr/ports
INDEX=${PORTSBASE}/INDEX-6
LOCAL=${PORTSBASE}/local

tmpfile=`/usr/bin/mktemp -t index` || exit 1

# make_index script complains a ton about using the INDEX file rather  
than the
# raw "describe" output so we just toss the errors.  this is probably  
a bad
# thing to do, but nobody will die because of it...
(cd $LOCAL; make describe; cat ${INDEX}) | perl ${PORTSBASE}/Tools/ 
make_index 2> /dev/null | grep ^kci > $tmpfile

echo "Local ports appended to $INDEX file:"
cat $tmpfile

cat $tmpfile >> ${INDEX}
rm -f $tmpfile
--cut here--



More information about the freebsd-ports mailing list