Index: /trunk/psconfig/psbuild
===================================================================
--- /trunk/psconfig/psbuild	(revision 12135)
+++ /trunk/psconfig/psbuild	(revision 12136)
@@ -1,205 +1,266 @@
-#!/bin/csh
-
-set args=""
-set clean=0
-set rebuild=0
-set update=0
-set optimize=0
-set version=""
-set start=""
-set stop=""
-while ($#argv)
- switch ($1)
-  case -version:
-   shift
-   set version=$1;
-   breaksw;
-  case -clean:
-   set clean=1;
-   breaksw;
-  case -rebuild:
-   set rebuild=1;
-   set clean=1;
-   breaksw;
-  case -update:
-   set update=1;
-   breaksw;
-  case -optimize:
-   set optimize=1;
-   breaksw;
-  case -only:
-   shift
-   set start=$1;
-   set stop=$1;
-   breaksw;
-  case -start:
-   shift
-   set start=$1;
-   breaksw;
-  case -stop:
-   shift
-   set stop=$1;
-   breaksw;
-  default:
-   set args=($args $1);
-   breaksw;
- endsw
- shift
-end
-
-if ($#args != 1) goto usage
-if ("$args" == "") goto usage
-
-set group   = $args[1]
-set tagsets = tagsets/$group
-
-if (! -e $tagsets) then
-  echo "target $group not found in tagsets"
-  exit 2
-endif
-
-# set the version based on psconfig or -version (if set)
-if ("$version" != "") then
-  source psconfig.sh $version
-else
-  if (! $?PSVERSION) then
-    source psconfig.sh default
-  else
-    source psconfig.sh $PSVERSION
-  endif
-endif
-
-set psopts = ""
-if ($optimize) set psopts = "$psopts --enable-optimize"
-
-foreach target (`cat $tagsets | grep -v \#`)
- set name = `echo $target | tr ':' ' '`
-
- set dir = $name[1]
- set tag = $name[2]
-
- set mode = "NORMAL"
- set branch = 0
-
- if ($#name >= 3) then
-   set branch = $name[3]
- endif
- if ($#name >= 4) then
-   set mode = $name[4]
- endif
-
- if ("$start" != "") then
-   if ("$start" != "$dir") then
-     echo "skipping $dir"
-     continue
-   endif
-   set start = ""
- endif
-
- if ("$mode" == "SKIP") then
-    echo "skipping $dir"
-    continue 
- endif
-
- set current = `pwd`
- cd ../$dir
+#!/usr/bin/env perl
+
+$tagsets = "tagsets";
+
+$version = "";
+$clean = 0;
+$rebuild = 0;
+$optimize = 0;
+$start = "";
+$stop = "";
+$verbose = 0;
+
+@tARGV = ();
+for (; @ARGV > 0; ) {
+    if ($ARGV[0] eq "-version") {
+	$version = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-verbose") {
+	$verbose = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-clean") {
+	$clean = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-rebuild") {
+	$rebuild = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-optimize") {
+	$optimize = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-only") {
+	$start = $ARGV[1];
+	$stop = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-start") {
+	$start = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-stop") {
+	$stop = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-list") {
+	&list_distributions ();
+    }
+    if ($ARGV[0] eq "-h")     { &usage (); }
+    if ($ARGV[0] eq "-help")  { &usage (); }
+    if ($ARGV[0] eq "--help") { &usage (); }
+    @tARGV = (@tARGV, $ARGV[0]);
+    shift;
+}
+@ARGV = @tARGV;
+
+if ( @ARGV != 1) { &usage (); }
+
+$distribution = $ARGV[0];
+&load_distfile ();
+
+&build_distribution ();
+exit 0;
+
+sub build_distribution {
+    
+    # use psconfig.sh to set needed build aliases
+
+    # set the psconfig version:
+    if ("$version" eq "") {
+	$version = $ENV{'PSVERSION'};
+    }
+    if ("$version" eq "") {
+	$version = "default";
+    }
+
+    $psconfigure = `csh psconfig.sh --psconfigure $version`;
+    $psautogen   = `csh psconfig.sh --psautogen $version`;
+    $psperlbuild = `csh psconfig.sh --psperlbuild $version`;
+
+    print "psconfigure: $psconfigure\n";
+    print "psautogen:   $psautogen\n";
+    print "psperlbuild: $psperlbuild\n";
+
+    # set build environment variables
+    ps_setenv ("PATH", 		  "--path");
+    ps_setenv ("ARCH", 		  "--arch");
+    ps_setenv ("LD_LIBRARY_PATH", "--ld_library_path");
+    ps_setenv ("PKG_CONFIG_PATH", "--pkg_config_path");
+    ps_setenv ("ACLOCAL_FLAGS",   "--aclocal_flags");
+    ps_setenv ("PERL5LIB",        "--perl5lib");
+
+    print STDERR "ENV: $ENV{'PATH'}\n";
+
+    $psopts = "";
+    if ($optimize) { $psopts = "$psopts --enable-optimize"; }
+
+    $homedir = `pwd`; chomp $homedir;
+
+    for ($i = 0; $i < @cvsname; $i++) {
+	if (($start ne "") && ($start ne $cvsname[$i])) { next; }
+	$start = "";
+
+	($do_tag, $do_build, $do_package, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+	if ($do_build eq "N") { next; }
+
+	$workdir = "../$cvsname[$i]";
+	print "workdir: $workdir\n";
+	chdir $workdir;
+	
+	# XXX need to grab current value for cleanup
+	print "\n ** psbuild: $cvsname[$i] ** \n";
+	print "\033]0; ** psbuild: $cvsname[$i] ** \007";
+
+	# how do we build this component?
+	# - autogen.sh : configure : make : make install
+	# - configure : make : make install
+	# - make : make install
+	# - perl Build.PL : ./Build : ./Build install
  
- echo ""
- echo "***** building $name ($target) *****"
- pwd
-
- if ($update) then
-  switch ($tag)
-   case HEAD:
-    cvs -q up -d -A
-    if ($status) goto failure;
-    breaksw;
-   case NONE:
-    breaksw;
-   default:
-    cvs -q up -d -r $tag
-    if ($status) goto failure;
-    breaksw;
-  endsw
- endif
-
- # how do we build this component?
- # - autogen.sh : configure : make : make install
- # - configure : make : make install
- # - make : make install
- # - perl Build.PL : ./Build : ./Build install
- 
- if (-e Build.PL) then
-    echo $PERL5LIB
-    alias psperlbuild
-    psperlbuild
-    # perl Build.PL --install_path script=$bindir --install_path lib=$libdir --install_path bindoc={$PSCONFDIR}/man/man1 --install_path libdoc={$PSCONFDIR}/man/man3
-    if ($status) goto failure;
-
-    ./Build
-    if ($status) goto failure;
-
-    ./Build install
-    if ($status) goto failure;
-
-    goto success;
- endif
-
- if ($rebuild && $clean) then
-   if (-e configure) rm -f Makefile
-   if (-e configure.ac && -e autogen.sh) rm -f configure
- endif
-
- if (! -e Makefile) set rebuild = 1
-
- #  fix this: this runs autogen, which runs configure, then re-runs configure!
- if ($rebuild && ! -e configure && -e autogen.sh) then
-    echo psautogen $psopts
-    psautogen $psopts
-    if ($status) goto failure;
- endif
-
- if ($rebuild && -e configure) then
-    echo psconfigure $psopts
-    psconfigure $psopts
-    if ($status) goto failure;
- endif
-
- if (! -e Makefile) goto failure;
-
- if ($clean) then 
-    echo make clean
-    make clean
-    if ($status) goto failure;
- endif
-
- make
- if ($status) goto failure;
-
- make install
- if ($status) goto failure;
-
- success:
- cd $current
-
- if ("$stop" != "") then
-   if ("$stop" == "$dir") then
-     echo "stopping at $dir"
-     exit 0
-   endif
- endif
-
-end
-
-exit 0
-
-usage:
-  echo "USAGE: psbuild (group) [-version version] [-clean] [-rebuild] [-update] [-optimize]"
-  exit 2
-
-failure:
-  echo "psbuild failed"
-  echo "target: $target"
-  echo "dir: $dir"
-  echo "tag: $tag"
-  exit 2
+	if (-e "Build.PL") {
+	    vsystem ("$psperlbuild");
+	    if ($?) { &failure($cvsname[$i], "failure in perl Build.PL"); }
+
+	    vsystem ("./Build");
+	    if ($?) { &failure($cvsname[$i], "failure in Build"); }
+
+	    vsystem ("./Build install");
+	    if ($?) { &failure($cvsname[$i], "failure in Build install"); }
+	    
+	    next;
+	}
+
+	if ($rebuild && $clean) {
+	    if (-e "configure") { unlink "Makefile"; }
+	    if (-e "configure.ac" && -e "autogen.sh") { unlink "configure"; }
+	}
+	$rebuild_this = $rebuild;
+
+	# set a local variable for this loop on rebuild;
+	if (! -e "Makefile") { $rebuild_this = 1; }
+
+	#  run autogen
+	$skip_configure = 0;
+	if ($rebuild_this && ! -e "configure" && -e "autogen.sh") {
+	    $skip_configure = 1;
+	    vsystem ("$psautogen $psopts");
+	    if ($?) { &failure($cvsname[$i], "failure in psautogen"); }
+	}
+
+	if ($rebuild_this && -e "configure" && !$skip_configure) {
+	    vsystem ("$psconfigure $psopts");
+	    if ($?) { &failure($cvsname[$i], "failure in psconfigure"); }
+	}
+
+	if (! -e "Makefile") { &failure($cvsname[$i], "missing makefile"); }
+
+	if ($clean) { 
+	    vsystem ("make clean");
+	    if ($?) { &failure($cvsname[$i], "failure in make clean"); }
+	}
+
+	vsystem ("make");
+	if ($?) { &failure($cvsname[$i], "failure in make"); }
+
+	vsystem ("make install");
+	if ($?) { &failure($cvsname[$i], "failure in make install"); }
+
+	print "*** done with $cvsname[$i] ***\n";
+
+      success:
+	chdir $homedir;
+	if (($stop ne "") && ($stop eq $cvsname[$i])) { last; }
+    }
+    print "\033]0; ** psbuild: finished ** \007";
+    exit 0;
+}
+
+sub vsystem {
+    print STDERR "@_\n";
+    $status = system ("@_");
+    $status;
+}
+
+sub list_distributions {
+    @list = <$tagsets/*.dst>;
+    foreach $line (@list) {
+	chomp $line;
+	($dist) = $line =~ m|$tagsets/(\S*).dst|;
+	print STDERR "$dist\n";
+    }
+    exit 2;
+}
+
+sub load_distfile {
+    # open and read the distribution file
+    # results go into @cvsname, @branchtag, @branchver, @mode
+    $file = "$tagsets/$ARGV[0].dst";
+    open (FILE, $file) || die "ERROR: can't open distribution file $file\n";
+    @list = <FILE>;
+    close (FILE);
+
+    @mode = ();
+    @cvsname = ();
+    @branchtag = ();
+    @branchver = ();
+
+    foreach $line (@list) {
+	chop $line;
+	if ($line =~ m|^\s*$|) { next; }
+	if ($line =~ m|^\s*\#|) { next; }
+
+	($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
+	
+	if ($cvsname eq "") { die "missing module name\n"; }
+
+	($do_tag, $do_build, $do_package, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
+	if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
+	if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
+	if (($do_package ne "Y") && ($do_package ne "N")) { die "invalid tag option $do_package\n"; }
+	if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
+	
+	if ($verbose) { print "tag: $do_tag, build: $do_build, package: $do_package, update: $do_update "; }
+	if ($verbose) { print "module: $cvsname, branchtag: $branchtag, branchver: $branchver \n"; }
+
+	push @mode, $mode;
+	push @cvsname, $cvsname;
+	push @branchtag, $branchtag;
+	push @branchver, $branchver;
+    }
+}
+
+sub failure {
+    die "problem building $_[0] : $_[1]\n";
+    print "\033]0; ** psbuild: failure  ** \007";
+}
+
+sub usage {
+    print STDERR "USAGE: psbuild [options] (distribution)\n";
+    print STDERR "     : -version (version) : specify alternate psconfig installation version\n";
+    print STDERR "     : -clean             : clean the source directories before building\n";
+    print STDERR "     : -rebuild           : run 'autogen' (C code)\n";
+    print STDERR "     : -optimize          : set flags for optimized code\n";
+    print STDERR "     : -only (module)     : only build the specified module\n";
+    print STDERR "     : -start (module)    : begin build at specified module\n";
+    print STDERR "     : -stop (module)     : stop build after specified module\n\n";
+    print STDERR "     : psbuild -list      : list the available distributions\n";
+    print STDERR "     : psbuild -h         : this help listing\n";
+    print STDERR "     : psbuild -help      : this help listing\n";
+    print STDERR "     : psbuild --help     : this help listing\n";
+    exit 2;
+}
+
+sub ps_setenv {
+
+    my $var = $_[0];
+    my $flag = $_[1];
+
+    my $answer = `csh psconfig.sh $flag $version`;
+    chomp $answer;
+
+    $ENV{$var} = $answer;
+}
+
Index: /trunk/psconfig/psdist
===================================================================
--- /trunk/psconfig/psdist	(revision 12136)
+++ /trunk/psconfig/psdist	(revision 12136)
@@ -0,0 +1,280 @@
+#!/usr/bin/env perl
+
+$tagsets = "tagsets";
+
+$cvs  = 0;
+$diff = 0;
+$settag = 0;
+$update = 0;
+$mkdist = 0;
+$module = "";
+$settag_mode = "";
+$update_mode = "";
+$mkdist_mode = "";
+$mkdist_head = 0;
+@tARGV = ();
+for (; @ARGV > 0; ) {
+    if ($ARGV[0] eq "-diff") {
+	$diff = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-update") {
+	$update = 1; shift; 
+	if ($ARGV[0] eq "tags") {
+	    $update_mode = "tags";
+	    shift; next
+	}
+	if ($ARGV[0] eq "head") {
+	    $update_mode = "head";
+	    shift; next
+	}
+	&usage();
+    }
+    if ($ARGV[0] eq "-tag") {
+	$settag = 1; shift;
+	if ($ARGV[0] eq "dev") {
+	    $settag_mode = "dev";
+	    shift; next
+	}
+	if ($ARGV[0] eq "rev") {
+	    $settag_mode = "rev";
+	    shift; next
+	}
+	if ($ARGV[0] eq "branch") {
+	    $settag_mode = "branch";
+	    shift; next
+	}
+	&usage();
+    }
+    if ($ARGV[0] eq "-dist") {
+	$mkdist = 1; shift;
+	if ($ARGV[0] eq "cvs") {
+	    $mkdist_mode = "cvs";
+	    shift; next
+	}
+	if ($ARGV[0] eq "tree") {
+	    $mkdist_mode = "tree";
+	    shift; next
+	}
+	if ($ARGV[0] eq "tarball") {
+	    $mkdist_mode = "tarball";
+	    shift; next
+	}
+	&usage();
+    }
+    if ($ARGV[0] eq "-module") {
+	$module = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-head")  { $mkdist_head = 1; shift; next; }
+    if ($ARGV[0] eq "-list")  { &list_distributions(); }
+    if ($ARGV[0] eq "-h")     { &usage(); }
+    if ($ARGV[0] eq "-help")  { &usage(); }
+    if ($ARGV[0] eq "--help") { &usage(); }
+    @tARGV = (@tARGV, $ARGV[0]);
+    shift;
+}
+@ARGV = @tARGV;
+
+if ( @ARGV != 1) { &usage (); }
+
+$distribution = $ARGV[0];
+&load_distfile ();
+
+if ($diff)   { &difflist (); }
+if ($settag) { &settags (); }
+if ($update) { &update_tree (); }
+if ($mkdist) { &make_distribution (); }
+&usage();
+
+sub vsystem {
+    print STDERR "@_\n";
+    #$status = system ("@_");
+    #$status;
+}
+
+sub difflist {
+
+    for ($i = 0; $i < @cvsname; $i++) {
+	# the base component cannot be rdiffed
+	print STDERR "--- $cvsname[$i] ---\n";
+	if ($cvsname[$i] eq "base") { next; }
+	if ($tag[$i] eq "") { next; }
+	&vsystem ("cvs -q rdiff -s -r $tag[$i] $cvsname[$i]");
+	print STDERR "\n\n";
+    }
+    exit 0;
+}
+
+sub settags {
+    print STDERR "setting tags\n";
+    if ($settag_mode eq "") { die "-tag mode is not set\n"; }
+    for ($i = 0; $i < @cvsname; $i++) {
+	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+	if ($do_tag eq "N") { 
+	    push @remind, $cvsname[$i];
+	    next; 
+	}
+	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+	$tag = "$branchtag[$i]$branchver[$i]";
+	if ($settag_mode eq "branch") { 
+	    &vsystem ("cvs -q rtag -b $branchtag[$i] $cvsname[$i]");
+	    next;
+	} 
+	if ($settag_mode eq "dev") { 
+	    &vsystem ("cvs -q rtag $tag $cvsname[$i]");
+	    next;
+	}
+	if ($settag_mode eq "rev") { 
+	    &vsystem ("cvs -q rtag -r $branchtag[$i] $tag $cvsname[$i]");
+	    next;
+	}
+	die "programming error";
+    }
+    for ($i = 0; $i < @remind; $i++) {
+	print STDERR "remember to set tag for $remind[$i] if needed\n";
+    }
+    exit 0;
+}
+
+sub update_tree {
+    print STDERR "updating tree\n";
+    if ($update_mode eq "") { die "-update mode is not set\n"; }
+
+    $homedir = `pwd`; chomp $homedir;
+    chdir "..";
+
+    for ($i = 0; $i < @cvsname; $i++) {
+	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+	if ($do_update eq "N") { 
+	    push @remind, $cvsname[$i];
+	    next; 
+	}
+	# only update modules with tags
+	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+	$tag = "$branchtag[$i]$branchver[$i]";
+	if ($update_mode eq "tags") { 
+	    &vsystem ("cvs -q co -r $tag $cvsname[$i]");
+	    next;
+	}
+	if ($update_mode eq "head") { 
+	    &vsystem ("cvs -q co -A $cvsname[$i]");
+	    next;
+	}
+	die "programming error";
+    }
+    for ($i = 0; $i < @remind; $i++) {
+	print STDERR "remember to update $remind[$i] if needed\n";
+    }
+    chdir $homedir;
+    exit 0;
+}
+
+# XXX probably need to force CVSROOT here
+sub make_distribution {
+    # package distribution into a tarball
+    print STDERR "making distribution\n";
+    if ($mkdist_mode eq "") { die "-dist mode is not set\n"; }
+    mkdir $distribution;
+    chdir $distribution;
+    for ($i = 0; $i < @cvsname; $i++) {
+	if (($module ne "") && ($module ne $cvsname[$i])) { next; }
+	($do_tag, $do_build, $do_dist, $do_update) = $mode[$i] =~ m|(\S)(\S)(\S)(\S)|;
+	if ($do_dist eq "N") { next; }
+
+	if ($branchtag[$i] eq "") { die "branch tag missing for $cvsname[$i]\n"; }
+	if ($branchver[$i] eq "") { die "branch tag version missing\n"; }
+	$tag = "$branchtag[$i]$branchver[$i]";
+
+	if ($mkdist_head) {
+	    &vsystem ("cvs co $cvsname[$i]");
+	    if ($status) { die "error running cvs"; }
+	} else {
+	    &vsystem ("cvs co -r $tag $cvsname[$i]");
+	    if ($status) { die "error running cvs"; }
+	}	
+    }
+    chdir "..";
+    if ($mkdist_mode eq "cvs") { exit 0; }
+
+    &vsystem ("rm -r `find $distribution -name CVS`");
+    if ($mkdist_mode eq "tree") { exit 0; }
+
+    if (! -e tarballs) { mkdir "tarballs"; }
+    &vsystem ("tar cvzf tarballs/$distribution.tgz  $distribution");
+    if ($status) { die "error creating tarball\n"; }
+    exit 0;
+}
+
+sub list_distributions {
+    @list = <$tagsets/*.dst>;
+    foreach $line (@list) {
+	chomp $line;
+	($dist) = $line =~ m|$tagsets/(\S*).dst|;
+	print STDERR "$dist\n";
+    }
+    exit 2;
+}
+
+sub load_distfile {
+    # open and read the distribution file
+    # results go into @cvsname, @branchtag, @branchver, @mode
+    $file = "$tagsets/$ARGV[0].dst";
+    open (FILE, $file) || die "ERROR: can't open distribution file $file\n";
+    @list = <FILE>;
+    close (FILE);
+
+    @mode = ();
+    @cvsname = ();
+    @branchtag = ();
+    @branchver = ();
+
+    foreach $line (@list) {
+	chop $line;
+	if ($line =~ m|^\s*$|) { next; }
+	if ($line =~ m|^\s*\#|) { next; }
+
+	($mode, $cvsname, $branchtag, $branchver) = split (" ", $line);
+	
+	if ($cvsname eq "") { die "missing module name\n"; }
+
+	($do_tag, $do_build, $do_dist, $do_update) = $mode =~ m|(\S)(\S)(\S)(\S)|;
+	if (($do_tag ne "Y") && ($do_tag ne "N")) { die "invalid tag option $do_tag\n"; }
+	if (($do_build ne "Y") && ($do_build ne "N")) { die "invalid tag option $do_build\n"; }
+	if (($do_dist ne "Y") && ($do_dist ne "N")) { die "invalid tag option $do_dist\n"; }
+	if (($do_update ne "Y") && ($do_update ne "N")) { die "invalid tag option $do_update\n"; }
+	
+	# print "module: $cvsname, branchtag: $branchtag, branchver: $branchver "; 
+	# print "tag: $do_tag, build: $do_build, dist: $do_dist, update: $do_update\n";
+
+	push @mode, $mode;
+	push @cvsname, $cvsname;
+	push @branchtag, $branchtag;
+	push @branchver, $branchver;
+    }
+}
+
+sub usage {
+    print STDERR "USAGE: mkdist [options] (distribution]\n";
+    print STDERR "     : -tag (dev)      : set tags on cvs HEAD based on distribution table (requires -tag)\n";
+    print STDERR "     : -tag (rev)      : set tags on branch based on distribution table\n";
+    print STDERR "     : -tag (branch)   : create branch tags based on distribution table (requires -tag)\n\n";
+
+    print STDERR "     : -update (tags)  : update this tree from cvs to match distribution tags\n";
+    print STDERR "     : -update (head)  : update this tree from cvs to match distribution tags\n\n";
+
+    print STDERR "     : -dist (cvs)     : check out a distribution and leave CVS directories in place\n";
+    print STDERR "     : -dist (tree)    : check out a distribution and leave a clean tree\n";
+    print STDERR "     : -dist (tarball) : check out a distribution and make a tarball\n";
+    print STDERR "     : -head           : use the cvs HEAD for distribution checkout (requires -dist)\n\n";
+
+    print STDERR "     : -module         : perform action only on the specified module\n";
+    print STDERR "     : -list           : list valid distributions \n";
+    print STDERR "     : -diff           : show the difference between the distribution and current cvs HEAD\n\n";
+    exit 2;
+}
+
Index: /trunk/psconfig/psperlmods
===================================================================
--- /trunk/psconfig/psperlmods	(revision 12136)
+++ /trunk/psconfig/psperlmods	(revision 12136)
@@ -0,0 +1,102 @@
+#!/usr/bin/env perl
+
+$version = "";
+$check = 0;
+@tARGV = ();
+for (; @ARGV > 0; ) {
+    if ($ARGV[0] eq "-version") {
+	$version = $ARGV[1];
+        shift; shift; next;
+    }
+    if ($ARGV[0] eq "-check") {
+	$check = 1;
+        shift; next;
+    }
+    if ($ARGV[0] eq "-h")     { &usage (); }
+    if ($ARGV[0] eq "-help")  { &usage (); }
+    if ($ARGV[0] eq "--help") { &usage (); }
+    @tARGV = (@tARGV, $ARGV[0]);
+    shift;
+}
+@ARGV = @tARGV;
+if ( @ARGV != 0) { &usage (); }
+
+# load the perl module list
+$file = "tagsets/ipp-extperl.dst";
+open (FILE, $file) || die "ERROR: can't open perl module list: $file\n";
+@list = <FILE>;
+close (FILE);
+
+# set the psconfig version:
+if ("$version" eq "") {
+    $version = $ENV{'PSVERSION'};
+}
+if ("$version" eq "") {
+    $version = "default";
+}
+
+print "version: $version\n";
+
+$prefix = `csh -f psconfig.sh --prefix $version`; chomp $prefix;
+$perldir = `csh -f psconfig.sh --perldir $version`; chomp $perldir;
+$homedir = `pwd`; chomp $homedir;
+
+print "prefix: $prefix\n";
+print "perldir: $perldir\n";
+print "PERL5LIB: $ENV{'PERL5LIB'}\n";
+
+foreach $line (@list) {
+    chop $line;
+    if ($line =~ m|^\s*$|) { next; }
+    if ($line =~ m|^\s*\#|) { next; }
+
+    ($N, $module, $tarball, $prompts) = split (" ", $line);
+    
+    system ("ckmodule.pl $module");
+    if ($? == 0) { 
+	# print "$module: found\n";
+	next; 
+    }
+
+    print "$module: missing\n";
+    if ($check) { next; }
+
+    # try to build the module from ../../extperl/Module.*.tar.gz
+    chdir "../../extperl";
+
+    print "extract $module from $tarball\n";
+    vsystem ("tar xvzf $tarball");
+    
+    ($tardir) = $tarball =~ m|(\S*).tar.gz|;
+    print "tardir: $tardir\n";
+
+    chdir $tardir;
+
+    # build the MakeMaker makefile, setting the output directories
+    if ($prompts) {
+	@answers = split (",", $prompts);
+	open (PIPE, "|perl Makefile.PL PREFIX=$prefix LIB=$perldir");
+	foreach $answer (@answers) {
+	    print PIPE "$answer\n";
+	}
+	close (PIPE);
+    } else {
+	vsystem ("perl Makefile.PL PREFIX=$prefix LIB=$perldir");
+    }
+    
+    vsystem ("make < /dev/null");
+    vsystem ("make install");
+
+    chdir $homedir;
+}
+
+sub usage {
+    print STDERR "USAGE: ckperlmods [-version] [-check]\n";
+    exit 2;
+}
+
+sub vsystem {
+    print STDERR "@_\n";
+    $status = system ("@_");
+    $status;
+}
Index: unk/psconfig/psupdate
===================================================================
--- /trunk/psconfig/psupdate	(revision 12135)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#!/bin/tcsh
-
-set args=""
-while ($#argv)
- switch ($1)
-  default:
-   set args=($args $1);
-   breaksw;
- endsw
- shift
-end
-
-if ($#args != 1) goto usage
-if ("$args" == "") goto usage
-
-set group   = $args[1]
-set tagsets = tagsets/$group
-
-if (! -e $tagsets) then
-  echo "target $group not found in tagsets"
-  exit 2
-endif
-
-foreach target (`cat $tagsets | grep -v \#`)
- set name = `echo $target | tr ':' ' '`
- set dir = $name[1]
- set tag = $name[2]
-
- set current = `pwd`
- cd ../$dir
- 
- echo ""
- echo "***** updating $name ($target) *****"
- pwd
-
- switch ($tag)
-  case HEAD:
-   cvs -q up -d -A
-   if ($status) goto failure;
-   breaksw;
-  case NONE:
-   breaksw;
-  default:
-   cvs -q up -d -r $tag
-   if ($status) goto failure;
-   breaksw;
- endsw
-
- success:
- cd $current
-end
-
-exit 0
-
-usage:
-  echo "USAGE: psupdate (group)"
-  exit 2
-
-failure:
-  echo "psupdate failed"
-  echo "target: $target"
-  echo "dir: $dir"
-  echo "tag: $tag"
-  exit 2
Index: /trunk/psconfig/tagsets/ipp-1.0.dst
===================================================================
--- /trunk/psconfig/tagsets/ipp-1.0.dst	(revision 12135)
+++ /trunk/psconfig/tagsets/ipp-1.0.dst	(revision 12136)
@@ -7,24 +7,24 @@
 # ||||  CVS module     CVS branch tag   CVS branch version   
 # |||| 
-  NYNY  Ohana
-  NNYN  ohana.base     	base-1-5         -0
-  NNYN  libohana       	libohana-1-9     -0
-  NNYN  libfits        	libfits-1-7      -0
-  NNYN  libautocode    	libautocode-1-6  -0
-  NNYN  libdvo         	libdvo-1-4       -0
-  NNYN  libkapa        	libkapa-1-3      -0
-  NNYN  addstar        	addstar-1-8      -0
-  NNYN  delstar        	delstar-1-7      -0
-  NNYN  getstar        	getstar-1-3      -0
-  NNYN  kapa           	kapa-1-7         -0
-  NNYN  kii            	kii-1-7          -0
-  NNYN  relphot        	relphot-1-5      -0
-  NNYN  uniphot        	uniphot-1-5      -0
-  NNYN  opihi.base     	opihi-2-9        -0
-  NNYN  mana           	mana-1-7         -0
-  NNYN  dvo            	dvo-1-0          -0
-  NNYN  pantasks       	pantasks-1-0     -0
-  NNYN  pcontrol       	pcontrol-1-0     -0
-  NNYN  pclient        	pclient-1-0      -0
+  NYNN  Ohana
+  NNYY  ohana.base     	base-1-5         -0
+  NNYY  libohana       	libohana-1-9     -0
+  NNYY  libfits        	libfits-1-7      -0
+  NNYY  libautocode    	libautocode-1-6  -0
+  NNYY  libdvo         	libdvo-1-4       -0
+  NNYY  libkapa        	libkapa-1-3      -0
+  NNYY  addstar        	addstar-1-8      -0
+  NNYY  delstar        	delstar-1-7      -0
+  NNYY  getstar        	getstar-1-3      -0
+  NNYY  kapa           	kapa-1-7         -0
+  NNYY  kii            	kii-1-7          -0
+  NNYY  relphot        	relphot-1-5      -0
+  NNYY  uniphot        	uniphot-1-5      -0
+  NNYY  opihi.base     	opihi-2-9        -0
+  NNYY  mana           	mana-1-7         -0
+  NNYY  dvo            	dvo-1-0          -0
+  NNYY  pantasks       	pantasks-1-0     -0
+  NNYY  pcontrol       	pcontrol-1-0     -0
+  NNYY  pclient        	pclient-1-0      -0
   NYYY  psLib          	rel-1-0          -0
   NYYY  psModules      	rel-1-0          -0
