From owner-freebsd-ports@FreeBSD.ORG Wed Apr 25 18:19:13 2007 Return-Path: X-Original-To: ports@freebsd.org Delivered-To: freebsd-ports@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DC7716A4CA for ; Wed, 25 Apr 2007 18:19:13 +0000 (UTC) (envelope-from vivek@khera.org) Received: from yertle.kcilink.com (yertle.kcilink.com [74.92.149.58]) by mx1.freebsd.org (Postfix) with ESMTP id A13BC13C4AD for ; Wed, 25 Apr 2007 18:19:12 +0000 (UTC) (envelope-from vivek@khera.org) Received: from [192.168.7.103] (host-103.int.kcilink.com [192.168.7.103]) by yertle.kcilink.com (Postfix) with ESMTP id D06EDB81E for ; Wed, 25 Apr 2007 13:55:23 -0400 (EDT) Mime-Version: 1.0 (Apple Message framework v752.2) In-Reply-To: <20070425132239.64ebbb14.wmoran@potentialtech.com> References: <20070425132239.64ebbb14.wmoran@potentialtech.com> Content-Type: multipart/signed; micalg=sha1; boundary=Apple-Mail-3--499456440; protocol="application/pkcs7-signature" Message-Id: <4FEBCC0A-FBF5-4A30-83D0-EFF0B60450CA@khera.org> From: Vivek Khera Date: Wed, 25 Apr 2007 13:55:22 -0400 To: ports@freebsd.org X-Mailer: Apple Mail (2.752.2) X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: Re: Making a local branch of the ports tree X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Apr 2007 18:19:13 -0000 --Apple-Mail-3--499456440 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On Apr 25, 2007, at 1:22 PM, Bill Moran wrote: > My thought is to make /usr/ports/private (or similar) and teach cvsup > not to blow it away. Then I just need to make sure that portupgrade > and other tools see it. > > Does anyone have a HOWTO or list of steps to get this going? I know > this has been discussed before but I can't find any reference to it > now. I use /usr/port/local and name all the ports "kci-XXX" for whatever port we have. mostly these are pseudo ports which pull in all the dependencies for our various server needs. (I'll probably post this to my website sometime...) Step 1: mkdir /usr/ports/local Step 2: create the following /usr/ports/Makefile.local -- cut here -- # local Makefile additions for top-level ports to add our local category. SUBDIR += local -- cut here -- So now the ports infrastructure knows about that directory. Step 3: Inside /usr/ports/local, create a Makefile something like this: --cut here-- COMMENT = KCI local ports SUBDIR += kci-base SUBDIR += kci-monitor SUBDIR += kci-searchserver .include --cut here-- Where every subdir of /usr/ports/local is listed here so as to inform the ports infrastructure of your local ports. You must list every port you want to be visible in your INDEX file which we will update below. Here is my example /usr/ports/local/kci-base/Makefile which installs the bare minimum essentials we need on every server: --cut here-- PORTNAME= kci-base PORTVERSION= 25 PORTREVISION= 0 CATEGORIES= local VALID_CATEGORIES=local MASTER_SITES= # empty DISTFILES= # none EXTRACT_ONLY= # empty MAINTAINER= khera@kcilink.com COMMENT= Base applications needed on all KCI servers RUN_DEPENDS= bash:${PORTSDIR}/shells/bash \ rsync:${PORTSDIR}/net/rsync \ jove:${PORTSDIR}/editors/jove \ nano:${PORTSDIR}/editors/nano \ gmake:${PORTSDIR}/devel/gmake \ portupgrade:${PORTSDIR}/ports-mgmt/portupgrade \ portaudit:${PORTSDIR}/ports-mgmt/portaudit # Don't let stupid programs ask for configuration. #BATCH= YES NO_WRKSUBDIR= YES NO_BUILD= YES .if make(package) DEPENDS_TARGET="package" .endif # .if make(package) # do nothing here, but can't use NO_INSTALL since it won't make the depends do-install: .include --cut here-- The KEY thing is to set the "VALID_CATEGORIES" to the name of the local base ports category, in my case "local". Other than that, it can be just like any other port normally part of the ports tree, and needs the necessary support files every port needs. I haven't been able to work out how to do this globally in the /usr/ports/ Makefile.local. If you do, please share. Now, the only step left is to get your local ports into the INDEX. Here is where we use some trickery... I observed that the make_index script from ports uses "make describe" output and cross-references stuff to generate INDEX. However, the INDEX file itself is nearly the same format... so if we feed "make describe" from our local subtree and concatenate it with the existing INDEX and ignore all warnings about make_index not finding port names (since they were already substituted in the INDEX file...) we generate the output we want. The following script, localportindex, does this: --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 480 2006-06-16 15:14:38Z khera $ # for FreeBSD 6.x PORTSBASE=/usr/ports PORTSDIRNAME=`cd $PORTSBASE ; /bin/pwd` # for fixingup NFS/symlink pathnames 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 | sed -e "s@$PORTSDIRNAME@$PORTSBASE@g"; 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-- Note that I use the fact all my ports start with "kci-" to pull them from the newly generated INDEX file and append that data to the actual INDEX file. This step takes just seconds as opposed to tens of minutes (or longer) to regenerate the INDEX from scratch. All of the above works 100% well with portsnap and cvsup. I don't recall having to teach either how to ignore the local subdir. If you use cvsup, be sure to use some means to have a virgin INDEX file before re-running the above index script, like using "make fetchindex". Here is my "srcupdate" script which updates the source + ports on my primary server. We manage our local ports via subversion, so I just ensure that the one in the live ports tree is up-to-date with any commits made by any developer. --cut here-- #!/bin/sh PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin cd /usr/src make update | tee /tmp/update (cd /usr/ports/local; svn update) portsnap fetch portsnap update portsnap -I update localportindex portsdb --update --cut here-- With all of this in place, portupgrade and friends can manage my local ports too. There is no distinction of what's part of ports and what's truly local. --Apple-Mail-3--499456440--