opening it up with Common Lisp

Favorite weblogs

Lisp Related

Bill Clementson

Finding Lisp

Lemonodor

Lispmeister.com

Planet Lisp

Politics

Orcinus

Talking Points Memo

This Modern World

Working for Change

Other home

Polliblog

Recent Readings

Book review: Darwinia
Reviewed: Friday, August 11, 2006

Summer reading: Spin
Reviewed: Saturday, August 5, 2006

Runner
Reviewed: Tuesday, July 18, 2006

the Omnivoire's Delimma
Reviewed: Wednesday, July 12, 2006

the Golem's Eye
Reviewed: Wednesday, May 31, 2006





tinderbox
 width=

Darcs and ASDF-Install
Friday, December 16, 2005

I use Darcs for version control and ASDF / ASDF-Install for Lisp system definitions. Since I have a bunch of packages I maintain, I've been working to automate things as much as I can. I figured I'd document what I do in the hopes that people can help me improve the process or copy it or whatever <smile>. I run under OS X and my Unix skills are mediocre so YMMV. To keep my ASDF systems up to date, I use two shell scripts. The first is make-all-asdf-systems

#!/bin/sh
make-1-asdf-package "asdf-system-connections" "asdf-system-connections"
make-1-asdf-package "asdf-install-tester"     "asdf-install-tester"
# and so on..

As you can see, it just calls make-1-asdf-system for each of the systems I worry about.

#!/bin/sh
### to do
# More error checking

### Command arguments
# Argument #1 is the source
# Argument #2 is optional. If not supplied, the basename of the target is
#  used as the project root on common-lisp.net. If supplied, it is used
#  as the 'root' on common-lisp.net in cl-containers...

tempDir="$HOME/temporary"

if [ -z "$1" ]; then 
	echo "Must specify source"
	exit 1
else
	if [ -z `basename $1` ]; then
		source="$1"
	else
		source=`basename $1`
	fi
	if [ `dirname $1` = "." ]; then
		sourceDir="$HOME/darcs"
	else
		sourceDir=`dirname $1`
	fi
fi

if [ -z "$2" ]; then
	target=$source
	tarPath="gking@common-lisp.net:/project/$target/public_html"
else
	target=$2
	tarPath="gking@common-lisp.net:/project/cl-containers/public_html/$target"
fi

PASSWORD=`cat ~/.ssh/goomber`
SOFTWARE="${source}_latest"
#SOFTWARE="$source_$VERSION"
echo "Making $SOFTWARE"

pushd . > /dev/null
cd $tempDir

# Cleanup existing stuff (this script leaves some of it behind just in case...)
if [ -f $source ]; then
	rm -r $source
fi
if [ -f $SOFTWARE.tar.gz ]; then
	rm $SOFTWARE.tar.gz
fi
if [ -f $SOFTWARE.tar.gz.asc ]; then
	rm $SOFTWARE.tar.gz.asc
fi

# make new one
darcs get $sourceDir/$source
rm -r $source/_darcs
if [ -f $source/version ]; then
	VERSION=`cat $source/version`
	echo $VERSION
fi
tar -cf $SOFTWARE.tar $source
gzip $SOFTWARE.tar
echo $PASSWORD | gpg --batch --passphrase-fd 0 -b -a $SOFTWARE.tar.gz
rm -r $tempDir/$source


rsync \
	--archive \
	--rsh=ssh \
	--compress \
	-v \
	$SOFTWARE.tar.* \
	$tarPath
popd

That's more like it!

Most of my systems are in ~/darcs but I working with a few that are elsewhere. The first bit of the script differentiates these two cases and fills in source and sourceDir. The next bit worries about whether the project had it's own place to live on common-lisp.net or if it lives under cl-containers (for lack of a better place). This lets me fill in target and tarPath.

So that I can automate this, I store my password in ~/.ssh/goomber and suck that in with cat. I'm planning on doing some fine and replace Perl magic to keep versions up to date but I don't do that yet. Once all the shell variables are set, we do a bit of cleanup and then it's time to get to work.

Working consists of a Darcs get to grab the latest code, removing the Darcs information (stored in _darcs), tarring it up, and rsync'ing it to common-lisp.net. The trickiest part for me was figuring out how to get gpg to work with manual intervention. I also use SSH-Agent so that I don't need to log into common-lisp.net when I rsync.

So there it is. Nothing too fancy but it serves my needs so far.


|

Home | About | Quotes | Recent | Archives

Copyright -- Gary Warren King, 2004 - 2006