On Wed, Jul 16, 2008 at 01:22:53PM -0500, Will Fiveash wrote:
> On Wed, Jul 16, 2008 at 01:02:46PM -0500, Will Fiveash wrote:
> > On Wed, Jul 16, 2008 at 10:56:46AM -0700, Stephen Lau wrote:
> > > Will Fiveash wrote:
> > >> On Tue, Jul 15, 2008 at 06:17:00PM -0400, Richard Lowe wrote:
> > >>   
> > > reparent is provided by Cadmium.  Do you have the cdm extension loaded?
> > 
> > I don't think so.  It would be good to also explain to ON peeps that
> > admin a build system what needs to be done to install Cadmium.
> 
> What I mean is that a reminder about hgsetup should be in the
> announcements like the recent one.
> 
> So here is my script to create a ON build snapshot in a new zfs
> filesystem:
> 
> #!/bin/ksh -p
> 
> base=/pool/willf/hg/i386
> parent='ssh://onnv.sfbay.sun.com//export/gate-hg'
> 
> if [[ $# -ne 1 || "$1" == @('-?'|'--help') ]]
> then
>     output=; rc=0
>     [[ $# -ne 1 ]] && {output='-u2'; rc=1}
>     print $output "Usage: ${0##*/} <ON build level (example: onnv_94)>"
>     exit $rc
> fi
> 
> trap "echo 'A command failed, aborting.'; exit 1" ERR
> 
> zfs create ${base#/}/$1
> cd $base/$1
> hg init
> hg pull -u -r $1 $parent
> hg reparent $parent
> hg init usr/closed
> cd usr/closed
> hg pull -u -r $1 $parent/usr/closed
> hg reparent $parent/usr/closed

Okay, I realize this could be done better:

#!/bin/ksh -p

base=/pool/willf/hg/i386
#parent='ssh://onnv.sfbay.sun.com//export/gate-hg'
# Use local copy of gate, faster, assuming it's current.
parent='/pool/willf/hg/i386/gate-hg'

if [[ $# -ne 1 || "$1" == @('-?'|'--help') ]]
then
    output=; rc=0
    [[ $# -ne 1 ]] && {output='-u2'; rc=1}
    print $output "Usage: ${0##*/} <ON build level (example: onnv_94)>"
    exit $rc
fi

if ! grep '^[   ]*hgext\.cdm=' $HOME/.hgrc >/dev/null
then
    print -u2 "Error: hgsetup must be run. aborting."
    exit 1
fi

trap "echo 'A command failed, aborting.'; exit 1" ERR

zfs create ${base#/}/$1
cd $base/$1
hg init
hg reparent $parent
mkdir usr
hg pull -u -r $1 &
hg init usr/closed
cd usr/closed
hg reparent $parent/usr/closed
hg pull -u -r $1 &
wait
zfs snapshot ${base#/}/$...@$(date '+%Y-%m-%d')
-- 
Will Fiveash
Sun Microsystems Inc.
http://opensolaris.org/os/project/kerberos/

Reply via email to