Friday Mar 18, 2011

And before I forget it \*again\* ...

One of the things I'm currently responsible for (as onnv gatekeeper), is maintenance of our gatehooks. From time to time I need to make changes and test them in a sandbox, and I keep my sandbox pretty small. hg update takes a while when you have to run it over all of ON :-)

Anyway, with the most recent round of changes (to support running the hooks with Mercurial built against python 2.6), I just spent the best part of a day beating my head against two things. Firstly, I'd forgotten that my sandbox was configured to exec mercurial with the


option. This has the effect with python2.6 and Mercurial 1.3.1 of making any process exit, even a successful one (exit(0)) die with a traceback:

$ $HG push ssh://onhg@localhost//scratch/gate/trees/minirepo-131_26
pushing to ssh://onhg@localhost//scratch/gate/trees/minirepo-131_26
searching for changes
Are you sure you wish to push? [y/N]: y
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: caching changes for gatehooks...
remote: ...changes cached
remote: Sanity checking your push...
remote: ...Sanity checks passed
remote: pushing to /scratch/gate/trees/minirepo-131_26-clone
remote: searching for changes
remote: adding changesets
remote: adding manifests
remote: adding file changes
remote: added 1 changesets with 1 changes to 1 files
remote: Traceback (most recent call last):
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 43, in _runcatch
remote: return _dispatch(ui, args)
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 449, in _dispatch
remote: return runcommand(lui, repo, cmd, fullargs, ui, options, d)
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 317, in runcommand
remote: ret = _runcommand(ui, options, cmd, d)
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 501, in _runcommand
remote: return checkargs()
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 454, in checkargs
remote: return cmdfunc()
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 448, in
remote: d = lambda: util.checksignature(func)(ui, \*args, \*\*cmdoptions)
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 402, in check
remote: return func(\*args, \*\*kwargs)
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 2752, in serve
remote: s.serve_forever()
remote: File "/opt/local/mercurial/1.3.1/lib/python2.6/site-packages/mercurial/", line 46, in serve_forever
remote: sys.exit(0)
remote: SystemExit: 0

The second one was equally frustrating: our hooks have a Test parameter, which you set to True or False in your gate's hgrc. Setting it to True means that the hook does not do any actual work. Guess which value I'd left it set to in my minirepo?

Tuesday Aug 05, 2008

It's time for some dancing

At the third stroke, the time will be 11pm US/Pacific......

From 11pm US/Pacific the NV gate is not accepting any more putbacks and is not under the control of teamware.

Time to start dancing (on the grave of teamware {cue evil cackle}).

I'm really looking forward to the new way of working - with Mercurial and the collection of associated utilities which people like Rich, Dave, Bill and MJN have been working on for ages to smooth the transition. Of course, that collection is called "Cadmium" - it's layered on top of Mercurial. (See the Periodic Table). It took me ages to get it.

Friday Jul 11, 2008

Another (large) step along the road

Just saw this in my mailbox from mjnelson:

Author: mjnelson
Repository: /hg/onnv/onnv-gate
Latest revision: 935563142864dcc57ff3b20395393f5f0323921f
Total changesets: 1
Log message:
6538468 add Mercurial support to ON developer tools
6658967 /etc/publickey entries get removed on upgrade
Portions of 6538468 contributed by Rich Lowe.
Portions of 6538468 contributed by Mike Gerdts.
[extensive list of files changed removed]

Along with a copy (or 6!) of the associated flag day message:

Flag day: ON Developer Tools upgraded to support Mercurial

There's more associated doco to come, of course, but from now on if you're building OpenSolaris (ok, the ON consolidation) from the source then you should really get up to speed on how your workspace management tools behave.

This is all in preparation for the close of build 96: from the open of build 97 the ON gate will be managed with Mercurial.... as a precursor to the eventual move of the gate outside Sun's network and opening up the contribution process yet more.

So we're getting there, bit by bit by bit.

Tuesday Jul 08, 2008

Better late than never - a ZFS bringover-like util

So... it's a little late, but better late than never. Now that I've got my u40m2 re-configured and redone my local source code repositories (not hg repos... yet), I figured it was time to make the other part of what I've mentioned to customers a reality.

The first part is this: bringing over the source from $GATE, wx init, cd $SRC, /usr/bin/make setup on both UltraSPARC and x64 buildboxen, and then zfs snapshot followed by two zfs clone ops so that I get to build on UltraSPARC and x64 buildboxen in the same workspace at the same time.

Yes, this is a really ugly workaround for Should be able to build for sparc and x86 in a single workspace, and while I'm the RE for that bug, it's probably not going to be fixed for a while.

So here's the afore-mentioned "other part": a kinda-sorta replacement for bringover, using ZFS snapshots and clones. Both Bill and DarrenM have mentioned something of this in the past, and you know what - the script I just hacked together is about 3 lines of content, 1 line of #! magic and 16 lines of arg checking.

Herewith is the script. No warranties, guarantees or anything. Use at your own risk. It works for me, but your mileage may vary. Suggestions and improvements cheerfully accepted.
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or
# See the License for the specific language governing permissions
# and limitations under the License.
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
# Version number? if this needs a rev.... there's something 
# really, really wrong

# we use the following process to snapshot, clone
# and mount an up to date image of $GATE ::
# zfs snapshot sink/$GATE@$wsname  {$GATE is onnv-gate|on10-feature-patch|on10-patch}
# zfs clone sink/$GATE@wsname sink/src/$wsname  ## ignore "failed to mount"
# zfs set mountpoint=/scratch/src/build/{rfes|bugs}/$wsname sink/src/$wsname

# arg1 is "b" or "r" - bug or rfe
# arg2 is $GATE - onnv-gate, on10-feature-patch, on10-patch
# arg3 is wsname

# first, some sanity checking of the args

if [ "$1" != "b" -a "$1" != "r" ]; then
   echo "Is this a bug (b) or an rfe (r) ?"
   exit 1;

if [ "$2" != "onnv-gate" -a "$2" != "on10-feature-patch" -a "$2" != "on10-patch" ]; then
    echo "unknown / invalid gate specified ($2). Please choose one of "
    echo "onnv-gate, on10-feature-patch or on10-patch."
    exit 2;


if [ "$1" = "b" ]; then


# ASSUMPTION1: our $GATE is a dataset under pool "sink"
# ASSUMPTION2: we have another dataset called "sink/src"
# ASSUMPTION3: our user has delegated admin privileges, and can mount
#              a cloned snapshot under /scratch/src/.....

zfs snapshot sink/$GATE@$WSNAME
zfs clone sink/$GATE@$WSNAME sink/src/$WSNAME >> /dev/null 2>&1
zfs set mountpoint=/scratch/src/build/$BR/$WSNAME sink/src/$WSNAME
exit 0

Note the ASSUMPTIONx lines - they're specific to my workstation, you will almost definitely want to change them to suit your system.

I work at Oracle in the Solaris group. The opinions expressed here are entirely my own, and neither Oracle nor any other party necessarily agrees with them.


« June 2016