diff --git a/indra/lib/python/indra/base/llsd.py b/indra/lib/python/indra/base/llsd.py
index 18e62b081754b3f97b8bb789106047139352096c..462a8787ae96b23617014c7a401b6c84e526600b 100644
--- a/indra/lib/python/indra/base/llsd.py
+++ b/indra/lib/python/indra/base/llsd.py
@@ -180,8 +180,9 @@ def MAP(self, v):
             ''.join(["%s%s" % (self.elt('key', key), self.generate(value))
              for key, value in v.items()]))
 
+    typeof = type
     def generate(self, something):
-        t = type(something)
+        t = self.typeof(something)
         if self.type_map.has_key(t):
             return self.type_map[t](something)
         else:
diff --git a/indra/lib/python/indra/ipc/httputil.py b/indra/lib/python/indra/ipc/httputil.py
index 85e4a645bc0a64e93d9c1f3aee4741b46b12e757..c4ac0a379d23f6bd54b32f2514731ff57168a047 100644
--- a/indra/lib/python/indra/ipc/httputil.py
+++ b/indra/lib/python/indra/ipc/httputil.py
@@ -1,94 +1,9 @@
-"""\
-@file httputil.py
-@brief HTTP utilities. HTTP date conversion and non-blocking HTTP
-client support.
 
-Copyright (c) 2006-2007, Linden Research, Inc.
-$License$
-"""
+import warnings
 
+warnings.warn("indra.ipc.httputil has been deprecated; use eventlet.httpc instead", DeprecationWarning, 2)
 
-import os
-import time
-import urlparse
+from eventlet.httpc import *
 
-import httplib
-try:
-    from mx.DateTime import Parser
-
-    parse_date = Parser.DateTimeFromString
-except ImportError:
-    from dateutil import parser
-
-    parse_date = parser.parse
-
-
-HTTP_TIME_FORMAT = '%a, %d %b %Y %H:%M:%S GMT'
-
-
-to_http_time = lambda t: time.strftime(HTTP_TIME_FORMAT, time.gmtime(t))
-from_http_time = lambda t: int(parse_date(t).gmticks())
-
-def host_and_port_from_url(url):
-    """@breif Simple function to get host and port from an http url.
-    @return Returns host, port and port may be None.
-    """
-    host = None
-    port = None
-    parsed_url = urlparse.urlparse(url)
-    try:
-        host, port = parsed_url[1].split(':')
-    except ValueError:
-        host = parsed_url[1].split(':')
-    return host, port
-
-
-def better_putrequest(self, method, url, skip_host=0):
-    self.method = method
-    self.path = url
-    self.old_putrequest(method, url, skip_host)
-
-
-class HttpClient(httplib.HTTPConnection):
-    """A subclass of httplib.HTTPConnection which works around a bug
-    in the interaction between eventlet sockets and httplib. httplib relies
-    on gc to close the socket, causing the socket to be closed too early.
-
-    This is an awful hack and the bug should be fixed properly ASAP.
-    """
-    def __init__(self, host, port=None, strict=None):
-       httplib.HTTPConnection.__init__(self, host, port, strict)
-
-    def close(self):
-        pass
-
-    old_putrequest = httplib.HTTPConnection.putrequest
-    putrequest = better_putrequest
-
-
-class HttpsClient(httplib.HTTPSConnection):
-    def close(self):
-        pass
-    old_putrequest = httplib.HTTPSConnection.putrequest
-    putrequest = better_putrequest
-
-
-
-scheme_to_factory_map = {
-    'http': HttpClient,
-    'https': HttpsClient,
-}
-
-
-def makeConnection(scheme, location, use_proxy):
-    if use_proxy:
-        if "http_proxy" in os.environ:
-            location = os.environ["http_proxy"]
-        elif "ALL_PROXY" in os.environ:
-            location = os.environ["ALL_PROXY"]
-        else:
-            location = "localhost:3128" #default to local squid
-        if location.startswith("http://"):
-            location = location[len("http://"):]
-    return scheme_to_factory_map[scheme](location)
 
+makeConnection = make_connection
diff --git a/indra/lib/python/indra/ipc/llsdhttp.py b/indra/lib/python/indra/ipc/llsdhttp.py
index a2a889742aaf358184c11d922a1c03f6ba02b69b..fbe08ad7fcaf2c03794ed3e60cb3bdfee2b36cfb 100644
--- a/indra/lib/python/indra/ipc/llsdhttp.py
+++ b/indra/lib/python/indra/ipc/llsdhttp.py
@@ -1,18 +1,22 @@
 """\
 @file llsdhttp.py
 @brief Functions to ease moving llsd over http
-
+ 
 Copyright (c) 2006-2007, Linden Research, Inc.
 $License$
 """
-
+ 
 import os.path
 import os
 import os
 import urlparse
 
+
+from eventlet import httpc as httputil
+
+
+
 from indra.base import llsd
-from indra.ipc import httputil
 LLSD = llsd.LLSD()
 
 
@@ -29,7 +33,7 @@ def __init__(self, method, host, port, path, status, reason, body):
 
     def __str__(self):
         return "%s(%r, %r, %r, %r, %r, %r, %r)" % (
-            type(self).__name__,
+            self.__class__.__name__,
             self.method, self.host, self.port,
             self.path, self.status, self.reason, self.body)
 
diff --git a/indra/lib/python/indra/ipc/mysql_pool.py b/indra/lib/python/indra/ipc/mysql_pool.py
index 2bbb60ba0b08a23978ec7b18ff15294a3ef58625..2e0c40f8507266e5f5e713c33bfc825594390f9c 100644
--- a/indra/lib/python/indra/ipc/mysql_pool.py
+++ b/indra/lib/python/indra/ipc/mysql_pool.py
@@ -8,7 +8,8 @@
 
 import os
 
-from eventlet.pools import Pool, DeadProcess
+from eventlet.pools import Pool
+from eventlet.processes import DeadProcess
 from indra.ipc import saranwrap
 
 import MySQLdb
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 5ab4a892a7f121572ec80ec2fac8e9bb9146bd2f..1a9f73a9d9da6f4e4b1902f8266315bb03d217fc 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -1,4 +1,3 @@
-#!/usr/bin/python
 """\
 @file llmanifest.py
 @author Ryan Williams
@@ -57,7 +56,7 @@ def get_default_platform(dummy):
 
 def get_default_version(srctree):
     # look up llversion.h and parse out the version info
-    paths = [os.path.join(srctree, x, 'llversion.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']]
+    paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']]
     for p in paths:
         if os.path.exists(p):
             contents = open(p, 'r').read()
@@ -67,6 +66,16 @@ def get_default_version(srctree):
             build = re.search("LL_VERSION_BUILD\s=\s([0-9]+)", contents).group(1)
             return major, minor, patch, build
 
+def get_channel(srctree):
+    # look up llversionserver.h and parse out the version info
+    paths = [os.path.join(srctree, x, 'llversionviewer.h') for x in ['llcommon', '../llcommon', '../../indra/llcommon.h']]
+    for p in paths:
+        if os.path.exists(p):
+            contents = open(p, 'r').read()
+            channel = re.search("LL_CHANNEL\s=\s\"([\w\s]+)\"", contents).group(1)
+            return channel
+    
+
 DEFAULT_CHANNEL = 'Second Life Release'
 
 ARGUMENTS=[
@@ -98,7 +107,7 @@ def get_default_version(srctree):
          default=""),
     dict(name='channel',
          description="""The channel to use for updates.""",
-         default=DEFAULT_CHANNEL),
+         default=get_channel),
     dict(name='installer_name',
          description=""" The name of the file that the installer should be
         packaged up into. Only used on Linux at the moment.""",
@@ -302,7 +311,9 @@ def run_command(self, command):
         output = ''.join(lines)
         status = fd.close()
         if(status):
-            raise RuntimeError, "Command " + command + " returned non-zero status (" + str(status) + ")"
+            raise RuntimeError(
+                "Command %s returned non-zero status (%s) \noutput:\n%s"
+                % (command, status, output) )
         return output
 
     def created_path(self, path):
diff --git a/indra/lib/python/indra/util/llversion.py b/indra/lib/python/indra/util/llversion.py
new file mode 100644
index 0000000000000000000000000000000000000000..5c17bb0fc5186e6df367346c90741ae96ec4b9d9
--- /dev/null
+++ b/indra/lib/python/indra/util/llversion.py
@@ -0,0 +1,75 @@
+"""@file llversion.py
+@brief Utility for parsing llcommon/llversion${server}.h
+       for the version string and channel string
+       Utility that parses svn info for branch and revision
+
+Copyright (c) 2006-$CurrentYear$, Linden Research, Inc.
+$License$
+"""
+
+import re, sys, os, commands
+
+# Methods for gathering version information from
+# llversionviewer.h and llversionserver.h
+
+def get_src_root():
+    indra_lib_python_indra_path = os.path.dirname(__file__)
+    return os.path.abspath(os.path.realpath(indra_lib_python_indra_path + "/../../../../../"))
+
+def get_version_file_contents(version_type):
+    filepath = get_src_root() + '/indra/llcommon/llversion%s.h' % version_type
+    file = open(filepath,"r")
+    file_str = file.read()
+    file.close()
+    return file_str
+
+def get_version(version_type):
+    file_str = get_version_file_contents(version_type)
+    m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', file_str)
+    VER_MAJOR = m.group(1)
+    m = re.search('const S32 LL_VERSION_MINOR = (\d+);', file_str)
+    VER_MINOR = m.group(1)
+    m = re.search('const S32 LL_VERSION_PATCH = (\d+);', file_str)
+    VER_PATCH = m.group(1)
+    m = re.search('const S32 LL_VERSION_BUILD = (\d+);', file_str)
+    VER_BUILD = m.group(1)
+    version = "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals()
+    return version
+
+def get_channel(version_type):
+    file_str = get_version_file_contents(version_type)
+    m = re.search('const char \* const LL_CHANNEL = "(.+)";', file_str)
+    return m.group(1)
+    
+def get_viewer_version():
+    return get_version('viewer')
+
+def get_server_version():
+    return get_version('server')
+
+def get_viewer_channel():
+    return get_channel('viewer')
+
+def get_server_channel():
+    return get_channel('server')
+
+# Methods for gathering subversion information
+def get_svn_status_matching(regular_expression):
+    # Get the subversion info from the working source tree
+    status, output = commands.getstatusoutput('svn info %s' % get_src_root())
+    m = regular_expression.search(output)
+    if not m:
+        print "Failed to parse svn info output, resultfollows:"
+        print output
+        raise Exception, "No matching svn status in "+src_root
+    return m.group(1)
+
+def get_svn_branch():
+    branch_re = re.compile('URL: (\S+)')
+    return get_svn_status_matching(branch_re)
+
+def get_svn_revision():
+    last_rev_re = re.compile('Last Changed Rev: (\d+)')
+    return get_svn_status_matching(last_rev_re)
+
+
diff --git a/indra/llcommon/llversionserver.h b/indra/llcommon/llversionserver.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1bcacbd863c57c08f27ffd4eb4cb0bbb73b7e79
--- /dev/null
+++ b/indra/llcommon/llversionserver.h
@@ -0,0 +1,20 @@
+/** 
+ * @file llversionserver.h
+ * @brief
+ *
+ * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#ifndef LL_LLVERSIONSERVER_H
+#define LL_LLVERSIONSERVER_H
+
+const S32 LL_VERSION_MAJOR = 1;
+const S32 LL_VERSION_MINOR = 18;
+const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_BUILD = 1;
+
+const char * const LL_CHANNEL = "Second Life Server";
+
+
+#endif
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
new file mode 100644
index 0000000000000000000000000000000000000000..e5c560f024c49fcc4fa50340eb2e4b719d3914be
--- /dev/null
+++ b/indra/llcommon/llversionviewer.h
@@ -0,0 +1,19 @@
+/** 
+ * @file llversionviewer.h
+ * @brief
+ *
+ * Copyright (c) 2002-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#ifndef LL_LLVERSIONVIEWER_H
+#define LL_LLVERSIONVIEWER_H
+
+const S32 LL_VERSION_MAJOR = 1;
+const S32 LL_VERSION_MINOR = 18;
+const S32 LL_VERSION_PATCH = 0;
+const S32 LL_VERSION_BUILD = 1;
+
+const char * const LL_CHANNEL = "Second Life Release";
+
+#endif
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index ff7e8a41b7cf01a78904c7ea7215e2b372109ac0..8a51c155de4566bb67b97b93b98a7a9ba491ed16 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -21,7 +21,7 @@
 #include "llagent.h"
 #include "llviewerstats.h"
 #include "llviewerregion.h"
-#include "llversion.h"
+#include "llversionviewer.h"
 #include "llviewerbuild.h"
 #include "llvieweruictrlfactory.h"
 #include "viewer.h"	// for gViewerDigest
@@ -89,7 +89,9 @@ LLFloaterAbout::LLFloaterAbout()
 		support.append(" (");
 		gAgent.getRegion()->getHost().getString(buffer, MAX_STRING);
 		support.append(buffer);
-		support.append(")\n\n");
+		support.append(")\n");
+		support.append(gLastVersionChannel);
+		support.append("\n\n");
 	}
 
 	// CPU
diff --git a/indra/newview/llfloaterreporter.cpp b/indra/newview/llfloaterreporter.cpp
index 71491f16e6b57f75e6c1c2ce83957ecf497c9d5c..e1a9a38ccb041d57e3be94ae0230f849f85db842 100644
--- a/indra/newview/llfloaterreporter.cpp
+++ b/indra/newview/llfloaterreporter.cpp
@@ -21,7 +21,7 @@
 #include "llinventory.h"
 #include "llstring.h"
 #include "llsys.h"
-#include "llversion.h"
+#include "llversionviewer.h"
 #include "message.h"
 #include "v3math.h"
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index e32a64eb8e086b2aa4ad94b3086234b7218f6d92..6e1a1b9f09163ca05447656f2e8e4bd0ee77b377 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -16,7 +16,7 @@
 #include "llmd5.h"
 #include "llsecondlifeurls.h"
 #include "llwindow.h"			// shell_open()
-#include "llversion.h"
+#include "llversionviewer.h"
 #include "v4color.h"
 
 #include "llbutton.h"
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index 20761ded1188d2fa425a236052ef533d52408f71..74d8aa8e9ac78ad1489ae787f0765d2dd15fbceb 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -44,7 +44,7 @@
 #include "llsecondlifeurls.h"
 #include "llstring.h"
 #include "lluserrelations.h"
-#include "llversion.h"
+#include "llversionviewer.h"
 #include "llvfs.h"
 #include "llwindow.h"		// for shell_open
 #include "llxorcipher.h"	// saved password, MAC address
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 7cf9ca956861024c4903047da82812bf6e380859..cbaa1e2f2e543cb7b6f60e4b9438b2a98891ce1a 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -64,6 +64,7 @@
 #include "llfloatermute.h"
 #include "llfloaterpostcard.h"
 #include "llfloaterpreference.h"
+#include "llfloaterreleasemsg.h"
 #include "llfollowcam.h"
 #include "llgroupnotify.h"
 #include "llhudeffect.h"
@@ -2612,6 +2613,9 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	msg->getVector3Fast(_PREHASH_Data, _PREHASH_LookAt, look_at);
 	U64 region_handle;
 	msg->getU64Fast(_PREHASH_Data, _PREHASH_RegionHandle, region_handle);
+	
+	char version_channel_char[MAX_STRING];
+	msg->getString("SimData", "ChannelVersion", MAX_STRING, version_channel_char);
 
 	LLVOAvatar* avatarp = gAgent.getAvatarObject();
 	if (!avatarp)
@@ -2745,6 +2749,23 @@ void process_agent_movement_complete(LLMessageSystem* msg, void**)
 	msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
 	msg->addBOOLFast(_PREHASH_AlwaysRun, gAgent.getAlwaysRun());
 	gAgent.sendReliableMessage();
+
+	
+	LLString version_channel = LLString(version_channel_char);
+
+	if (gLastVersionChannel != version_channel)
+	{
+		//show release message if not on initial login
+		if (!gLastVersionChannel.empty())
+		{ 
+			gLastVersionChannel = version_channel;
+			LLFloaterReleaseMsg::show();
+		}
+		else {
+			gLastVersionChannel = version_channel;
+		}
+	}
+	
 }
 
 void process_crossed_region(LLMessageSystem* msg, void**)
diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h
index 26bf41f8a2866d6af8ec4e1119077ed65c47ff76..0bcab49a840ed6463ab984cc01983f20020592e9 100644
--- a/indra/newview/llviewerprecompiledheaders.h
+++ b/indra/newview/llviewerprecompiledheaders.h
@@ -89,7 +89,7 @@
 #include "llthread.h"
 #include "lltimer.h"
 #include "lluuidhashmap.h"
-//#include "llversion.h"
+//#include "llversionviewer.h"
 //#include "processor.h"
 #include "stdenums.h"
 #include "stdtypes.h"
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index c94aec880113d69677675f4982eeb59b0767d3be..c3841cdd98d7a40bcb8778598304041cec274be2 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -1255,6 +1255,7 @@ void LLViewerRegion::setSeedCapability(const std::string& url)
 	capabilityNames.append("ParcelVoiceInfoRequest");
 	capabilityNames.append("ChatSessionRequest");
 	capabilityNames.append("ProvisionVoiceAccountRequest");
+	capabilityNames.append("ServerReleaseNotes");
 
 	llinfos << "posting to seed " << url << llendl;
 
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index 9136a06c24557cccf4940779eff57ecbda67071c..041dfd1b81a72d6afdb49ce543d0c35e4b4d25c4 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -382,8 +382,9 @@ def package_finish(self):
                 # make sure we don't have stale files laying about
                 self.remove(sparsename, finalname)
 
-                self.run_command('hdiutil create "%(sparse)s" -volname "Second Life" -fs HFS+ -type SPARSE -megabytes 300' % {
-                        'sparse':sparsename})
+                self.run_command('hdiutil create "%(sparse)s" -volname "%(channel)s" -fs HFS+ -type SPARSE -megabytes 300' % {
+                        'sparse':sparsename,
+                        'channel':channel_standin})
 
                 # mount the image and get the name of the mount point and device node
                 hdi_output = self.run_command('hdiutil attach -private "' + sparsename + '"')
@@ -439,9 +440,12 @@ def package_finish(self):
                 if(self.args.has_key('installer_name')):
                         installer_name = self.args['installer_name']
                 else:
-                        installer_name = '_'.join(['SecondLife', self.args.get('arch'), '_'.join(self.args['version'])])
-                        if not self.default_grid():
-                                installer_name += "_" + grid.upper()
+                        installer_name = '_'.join('SecondLife_', self.args.get('arch'), *self.args['version'])
+                        if self.default_channel():
+                                if not self.default_grid():
+                                        installer_name += '_' + self.args['grid'].upper()
+                        else:
+                                installer_name += '_' + self.channel_oneword().upper()
 
                 # temporarily move directory tree so that it has the right name in the tarfile
                 self.run_command("mv %(dst)s %(inst)s" % {'dst':self.get_dst_prefix(),'inst':self.src_path_of(installer_name)})
diff --git a/indra/test/lltemplatemessagebuilder_tut.cpp b/indra/test/lltemplatemessagebuilder_tut.cpp
index 5bb37b3b923162a9c620bd8a0e32e8c7eef51617..306aabfe8efd6d4661b51f5fa091febb5bb3fb89 100644
--- a/indra/test/lltemplatemessagebuilder_tut.cpp
+++ b/indra/test/lltemplatemessagebuilder_tut.cpp
@@ -16,7 +16,7 @@
 #include "llquaternion.h"
 #include "lltemplatemessagebuilder.h"
 #include "lltemplatemessagereader.h"
-#include "llversion.h"
+#include "llversionserver.h"
 #include "message_prehash.h"
 #include "u64.h"
 #include "v3dmath.h"
diff --git a/indra/test/message_tut.cpp b/indra/test/message_tut.cpp
index b2c84d5f548f6ae587f55a1420a7aa84a066c1e3..4007eb17ff172ab01f1a53f03801cb7c4cbc5b26 100644
--- a/indra/test/message_tut.cpp
+++ b/indra/test/message_tut.cpp
@@ -12,7 +12,7 @@
 #include "lltut.h"
 
 #include "llapr.h"
-#include "llversion.h"
+#include "llversionserver.h"
 #include "message.h"
 #include "message_prehash.h"
 
diff --git a/indra/test/test_llmanifest.py b/indra/test/test_llmanifest.py
index 2c4662a83ded252241574ca83f2a5c71c17b6e6f..1edcc9f2ad374ddd0d5098edfb25d658042e89b3 100644
--- a/indra/test/test_llmanifest.py
+++ b/indra/test/test_llmanifest.py
@@ -86,9 +86,13 @@ def tmp_test():
 
     def testruncommand(self):
         self.assertEqual("Hello\n", self.m.run_command("echo Hello"))
-        def tmp_test():
+        def exit_1_test():
+            self.m.run_command("exit 1")
+        self.assertRaises(RuntimeError, exit_1_test)
+        def not_found_test():
             self.m.run_command("test_command_that_should_not_be_found")
-        self.assertRaises(RuntimeError, tmp_test)
+        self.assertRaises(RuntimeError, not_found_test)
+
 
     def testpathof(self):
         self.assertEqual(self.m.src_path_of("a"), "src/a")
diff --git a/scripts/messages/message_template.msg b/scripts/messages/message_template.msg
index 13e18851383300cf5a9bf678875963370da885ba..4b789e2db3eace31a2395c74f1a41d6f538e6320 100644
--- a/scripts/messages/message_template.msg
+++ b/scripts/messages/message_template.msg
@@ -5381,6 +5381,10 @@ version 2.0
 		{	RegionHandle	U64		}
 		{	Timestamp		U32	}
 	}
+	{
+		SimData			Single
+		{	ChannelVersion	Variable 2      }
+	}
 }
 
 
diff --git a/scripts/update_version_files.py b/scripts/update_version_files.py
index 4d56015099403f5e9aa8945e184189c796bd9821..ff92b9557302ebfe5c4e4ab50fe0feae4a37065b 100755
--- a/scripts/update_version_files.py
+++ b/scripts/update_version_files.py
@@ -4,8 +4,52 @@
 # instead of having to figure it out by hand
 #
 
+from os.path import realpath, dirname, join, exists
+setup_path = join(dirname(realpath(__file__)), "setup-path.py")
+if exists(setup_path):
+    execfile(setup_path)
 import getopt, sys, os, re, commands
-
+from indra.util import llversion
+
+def usage():
+    print "Usage:"
+    print sys.argv[0] + """ [options]
+
+Options:
+  --version
+   Specify the version string to replace current version.
+  --server
+   Update llversionserver.h only with new version
+  --viewer
+   Update llversionviewer.h only with new version
+  --channel
+   Specify the viewer channel string to replace current channel.
+  --server_channel
+   Specify the server channel string to replace current channel.
+  --verbose
+  --help
+   Print this message and exit.
+
+Common Uses:
+   # Update server and viewer build numbers to the current SVN revision:
+   update_version_files.py
+
+   # Update server and viewer version numbers explicitly:
+   update_version_files.py --version=1.18.1.6     
+                               
+   # Update just the viewer version number explicitly:
+   update_version_files.py --viewer --version=1.18.1.6     
+
+   # Update just the server build number to the current SVN revision:
+   update_version_files.py --server
+                               
+   # Update the viewer channel
+   update_version_files.py --channel="First Look Puppeteering"
+                               
+   # Update the server channel
+   update_version_files.py --server_channel="Het Grid"
+   
+"""
 def _getstatusoutput(cmd):
     """Return Win32 (status, output) of executing cmd
 in a shell."""
@@ -20,122 +64,171 @@ def _getstatusoutput(cmd):
 
 #re_map['filename'] = (('pattern', 'replacement'),
 #                      ('pattern', 'replacement')
-re_map['indra/llcommon/llversion.h'] = \
-	(('const S32 LL_VERSION_MAJOR = (\d+);',
-	  'const S32 LL_VERSION_MAJOR = %(VER_MAJOR)s;'),
-	 ('const S32 LL_VERSION_MINOR = (\d+);',
-	  'const S32 LL_VERSION_MINOR = %(VER_MINOR)s;'),
-	 ('const S32 LL_VERSION_PATCH = (\d+);',
-	  'const S32 LL_VERSION_PATCH = %(VER_PATCH)s;'),
-	 ('const S32 LL_VERSION_BUILD = (\d+);',
-	  'const S32 LL_VERSION_BUILD = %(VER_BUILD)s;'))
+re_map['indra/llcommon/llversionviewer.h'] = \
+    (('const S32 LL_VERSION_MAJOR = (\d+);',
+      'const S32 LL_VERSION_MAJOR = %(VER_MAJOR)s;'),
+     ('const S32 LL_VERSION_MINOR = (\d+);',
+      'const S32 LL_VERSION_MINOR = %(VER_MINOR)s;'),
+     ('const S32 LL_VERSION_PATCH = (\d+);',
+      'const S32 LL_VERSION_PATCH = %(VER_PATCH)s;'),
+     ('const S32 LL_VERSION_BUILD = (\d+);',
+      'const S32 LL_VERSION_BUILD = %(VER_BUILD)s;'),
+     ('const char \* const LL_CHANNEL = "(.+)";',
+      'const char * const LL_CHANNEL = "%(CHANNEL)s";'))
+re_map['indra/llcommon/llversionserver.h'] = \
+    (('const S32 LL_VERSION_MAJOR = (\d+);',
+      'const S32 LL_VERSION_MAJOR = %(SERVER_VER_MAJOR)s;'),
+     ('const S32 LL_VERSION_MINOR = (\d+);',
+      'const S32 LL_VERSION_MINOR = %(SERVER_VER_MINOR)s;'),
+     ('const S32 LL_VERSION_PATCH = (\d+);',
+      'const S32 LL_VERSION_PATCH = %(SERVER_VER_PATCH)s;'),
+     ('const S32 LL_VERSION_BUILD = (\d+);',
+      'const S32 LL_VERSION_BUILD = %(SERVER_VER_BUILD)s;'),
+     ('const char \* const LL_CHANNEL = "(.+)";',
+      'const char * const LL_CHANNEL = "%(SERVER_CHANNEL)s";'))
 re_map['indra/newview/res/newViewRes.rc'] = \
-	(('FILEVERSION [0-9,]+',
-	  'FILEVERSION %(VER_MAJOR)s,%(VER_MINOR)s,%(VER_PATCH)s,%(VER_BUILD)s'),
-	 ('PRODUCTVERSION [0-9,]+',
-	  'PRODUCTVERSION %(VER_MAJOR)s,%(VER_MINOR)s,%(VER_PATCH)s,%(VER_BUILD)s'),
-	 ('VALUE "FileVersion", "[0-9.]+"',
-	  'VALUE "FileVersion", "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s"'),
-	 ('VALUE "ProductVersion", "[0-9.]+"',
-	  'VALUE "ProductVersion", "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s"'))
+    (('FILEVERSION [0-9,]+',
+      'FILEVERSION %(VER_MAJOR)s,%(VER_MINOR)s,%(VER_PATCH)s,%(VER_BUILD)s'),
+     ('PRODUCTVERSION [0-9,]+',
+      'PRODUCTVERSION %(VER_MAJOR)s,%(VER_MINOR)s,%(VER_PATCH)s,%(VER_BUILD)s'),
+     ('VALUE "FileVersion", "[0-9.]+"',
+      'VALUE "FileVersion", "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s"'),
+     ('VALUE "ProductVersion", "[0-9.]+"',
+      'VALUE "ProductVersion", "%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s"'))
 
 # Trailing ',' in top level tuple is special form to avoid parsing issues with one element tuple
 re_map['indra/newview/Info-SecondLife.plist'] = \
-	(('<key>CFBundleVersion</key>\n\t<string>[0-9.]+</string>',
-	  '<key>CFBundleVersion</key>\n\t<string>%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s</string>'),)
+    (('<key>CFBundleVersion</key>\n\t<string>[0-9.]+</string>',
+      '<key>CFBundleVersion</key>\n\t<string>%(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s</string>'),)
 
 # This will probably only work as long as InfoPlist.strings is NOT UTF16, which is should be...
 re_map['indra/newview/English.lproj/InfoPlist.strings'] = \
-	(('CFBundleShortVersionString = "Second Life version [0-9.]+";',
-	  'CFBundleShortVersionString = "Second Life version %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s";'),
-	 ('CFBundleGetInfoString = "Second Life version [0-9.]+',
-	  'CFBundleGetInfoString = "Second Life version %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s'))
+    (('CFBundleShortVersionString = "Second Life version [0-9.]+";',
+      'CFBundleShortVersionString = "Second Life version %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s";'),
+     ('CFBundleGetInfoString = "Second Life version [0-9.]+',
+      'CFBundleGetInfoString = "Second Life version %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s'))
 
 
 version_re = re.compile('(\d+).(\d+).(\d+).(\d+)')
 svn_re = re.compile('Last Changed Rev: (\d+)')
 
 def main():
-	script_path = os.path.dirname(__file__)
-	src_root = script_path + "/../"
-	verbose = False
-
-	# Get version number from llversion.h
-	full_fn = src_root + '/' + 'indra/llcommon/llversion.h'
-	file = open(full_fn,"r")
-	file_str = file.read()
-	file.close()
-	
-	m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', file_str)
-	VER_MAJOR = m.group(1)
-	m = re.search('const S32 LL_VERSION_MINOR = (\d+);', file_str)
-	VER_MINOR = m.group(1)
-	m = re.search('const S32 LL_VERSION_PATCH = (\d+);', file_str)
-	VER_PATCH = m.group(1)
-	m = re.search('const S32 LL_VERSION_BUILD = (\d+);', file_str)
-	VER_BUILD = m.group(1)
-
-	opts, args = getopt.getopt(sys.argv[1:],
-							   "",
-							   ['version=', 'verbose'])
-
-	version_string = None
-	for o,a in opts:
-		if o in ('--version'):
-			version_string = a
-		if o in ('--verbose'):
-			verbose = True
-
-	if verbose:
-		print "Source Path:", src_root
-		print "Current version: %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals()
-
-	if version_string:
-		m = version_re.match(version_string)
-		if not m:
-			print "Invalid version string specified!"
-			return -1
-		VER_MAJOR = m.group(1)
-		VER_MINOR = m.group(2)
-		VER_PATCH = m.group(3)
-		VER_BUILD = m.group(4)
-	else:
-		# Assume we're updating just the build number
-		cl = 'svn info "%s"' % src_root
-		status, output = _getstatusoutput(cl)
-		#print
-		#print "svn info output:"
-		#print "----------------"
-		#print output
-		m = svn_re.search(output)
-		if not m:
-			print "Failed to execute svn info, output follows:"
-			print output
-			return -1
-		VER_BUILD = m.group(1)
-
-	if verbose:
-		print "New version: %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals()
-		print
-
-	# Grab the version numbers off the command line
-	# Iterate through all of the files in the map, and apply the substitution filters
-	for filename in re_map.keys():
-		# Read the entire file into a string
-		full_fn = src_root + '/' + filename
-		file = open(full_fn,"r")
-		file_str = file.read()
-		file.close()
-
-		if verbose:
-			print "Processing file:",filename
-		for rule in re_map[filename]:
-			repl = rule[1] % locals()
-			file_str = re.sub(rule[0], repl, file_str)
-
-		file = open(full_fn,"w")
-		file.write(file_str)
-		file.close()
-	return 0
+    script_path = os.path.dirname(__file__)
+    src_root = script_path + "/../"
+    verbose = False
+
+    opts, args = getopt.getopt(sys.argv[1:],
+                               "",
+                               ['version=', 'channel=', 'server_channel=', 'verbose', 'server', 'viewer', 'help'])
+    update_server = False
+    update_viewer = False
+    version_string = None
+    channel_string = None
+    server_channel_string = None
+    for o,a in opts:
+        if o in ('--version'):
+            version_string = a
+        if o in ('--channel'):
+            channel_string = a
+        if o in ('--server_channel'):
+            server_channel_string = a
+        if o in ('--verbose'):
+            verbose = True
+        if o in ('--server'):
+            update_server = True
+        if o in ('--viewer'):
+            update_viewer = True
+        if o in ('--help'):
+            usage()
+            return 0
+
+    if not(update_server or update_viewer):
+        update_server = True
+        update_viewer = True
+
+    # Get channel from llversion*.h and update channel
+    CHANNEL = llversion.get_viewer_channel()
+    SERVER_CHANNEL = llversion.get_server_channel()
+    if channel_string != None:
+        CHANNEL = channel_string
+    if server_channel_string != None:
+        SERVER_CHANNEL = server_channel_string
+
+    # Get version number from llversion*.h
+    viewer_version = llversion.get_viewer_version()
+    server_version = llversion.get_server_version()
+    if verbose:
+        print "Source Path:", src_root
+        print "Current viewer version: '%(viewer_version)s'" % locals()
+        print "Current server version: '%(server_version)s'" % locals()
+    
+    if version_string:
+        m = version_re.match(version_string)
+        if not m:
+            print "Invalid version string specified!"
+            return -1
+        if update_viewer:
+            viewer_version = version_string
+        if update_server:
+            server_version = version_string
+    else:
+        # Assume we're updating just the build number
+        cl = 'svn info "%s"' % src_root
+        status, output = _getstatusoutput(cl)
+        #print
+        #print "svn info output:"
+        #print "----------------"
+        #print output
+        m = svn_re.search(output)
+        if not m:
+            print "Failed to execute svn info, output follows:"
+            print output
+            return -1
+        revision = m.group(1)
+        if update_viewer:
+            m = version_re.match(viewer_version)
+            viewer_version = m.group(1)+"."+m.group(2)+"."+m.group(3)+"."+revision
+        if update_server:
+            m = version_re.match(server_version)
+            server_version = m.group(1)+"."+m.group(2)+"."+m.group(3)+"."+revision
+
+    if verbose:
+        print "Setting viewer version: '%(viewer_version)s'" % locals()
+        print "Setting server version: '%(server_version)s'" % locals()
+        print
+
+    # split out version parts
+    m = version_re.match(viewer_version)
+    VER_MAJOR = m.group(1)
+    VER_MINOR = m.group(2)
+    VER_PATCH = m.group(3)
+    VER_BUILD = m.group(4)
+
+    m = version_re.match(server_version)
+    SERVER_VER_MAJOR = m.group(1)
+    SERVER_VER_MINOR = m.group(2)
+    SERVER_VER_PATCH = m.group(3)
+    SERVER_VER_BUILD = m.group(4)
+
+    # Iterate through all of the files in the map, and apply the
+    # substitution filters
+    for filename in re_map.keys():
+        # Read the entire file into a string
+        full_fn = src_root + '/' + filename
+        file = open(full_fn,"r")
+        file_str = file.read()
+        file.close()
+
+        if verbose:
+            print "Processing file:",filename
+        for rule in re_map[filename]:
+            repl = rule[1] % locals()
+            file_str = re.sub(rule[0], repl, file_str)
+
+        file = open(full_fn,"w")
+        file.write(file_str)
+        file.close()
+    return 0
 
 main()
+