Index: trunk/psconfig/psbuild
===================================================================
--- trunk/psconfig/psbuild	(revision 23155)
+++ trunk/psconfig/psbuild	(revision 23229)
@@ -13,4 +13,5 @@
 $stop = "";
 $verbose = 0;
+$use_svn = 1;
 
 $extlibs = "none";
@@ -83,4 +84,8 @@
     if ($ARGV[0] eq "-bootstrap") {
         &bootstrap ();
+    }
+    if ($ARGV[0] eq "-skip-svn") {
+	$use_svn = 0;
+	shift; next;
     }
     if ($ARGV[0] eq "-env") {
@@ -157,6 +162,61 @@
 sub build_distribution {
 
+    # set environment variables used to supply SVN info to the compilation
+
+    if ($use_svn) {
+	# example dump from svn info:
+	# pikake: svn info
+	# Path: .
+	# URL: https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp/branches/eam_branches/eam_branch_20090303/ppImage
+	# Repository Root: https://svn.pan-starrs.ifa.hawaii.edu/repo/ipp
+	# Repository UUID: 60eb6cdc-a59c-4636-a4e0-dba66a9721fd
+	# Revision: 23158
+	# Node Kind: directory
+	# Schedule: normal
+	# Last Changed Author: price
+	# Last Changed Rev: 23125
+	# Last Changed Date: 2009-03-03 15:41:16 -1000 (Tue, 03 Mar 2009)
+	
+	$svn_version = `svnversion`; chomp $svn_version;
+	@svn_info = `svn info`;
+
+	# get the svn_root first:
+	foreach $line (@svn_info) {
+	    if ($line =~ m|^Repository Root:|) {
+		($svn_root) = $line =~ m|^Repository Root:\s*(\S*)|;
+		last;
+	    }
+	}
+
+	# now get the branch and UUID values
+	foreach $line (@svn_info) {
+	    if ($line =~ m|^URL:|) {
+		($svn_branch) = $line =~ m|^URL:\s*$svn_root/*(\S*)|;
+	    }
+	    if ($line =~ m|^Repository UUID:|) {
+		($svn_source) = $line =~ m|^Repository UUID:\s*(\S*)|;
+	    }
+	}
+	
+	$ENV{SVN_VERSION} = $svn_version;
+	$ENV{SVN_BRANCH}  = $svn_branch;
+	$ENV{SVN_SOURCE}  = $svn_source;
+    } else {
+	# alternatively, grab these from the following files:
+	if (! -e "SVNINFO") { 
+	    print "missing SVNINFO file for repository info, skipping\n";
+	} else {
+	    @svn_info = `cat SVNINFO`;
+	    foreach $line (@svn_info) {
+		($name, $value) = split (" ", $line);
+		$ENV{$name} = $value;
+	    }
+	}
+    }
+    print "SVN_VERSION $ENV{SVN_VERSION}\n";
+    print "SVN_BRANCH  $ENV{SVN_BRANCH}\n";
+    print "SVN_SOURCE  $ENV{SVN_SOURCE}\n";
+
     # use psconfig.csh to set needed build aliases
-
     if ($extlibs eq "check") {
         $status = vsystem ("pschecklibs");
