diff options
| -rw-r--r-- | indra/lib/python/indra/base/llsd.py | 3 | ||||
| -rw-r--r-- | indra/lib/python/indra/ipc/httputil.py | 93 | ||||
| -rw-r--r-- | indra/lib/python/indra/ipc/llsdhttp.py | 12 | ||||
| -rw-r--r-- | indra/lib/python/indra/ipc/mysql_pool.py | 3 | ||||
| -rw-r--r-- | indra/lib/python/indra/util/llmanifest.py | 19 | ||||
| -rw-r--r-- | indra/lib/python/indra/util/llversion.py | 75 | ||||
| -rw-r--r-- | indra/llcommon/llversionserver.h | 20 | ||||
| -rw-r--r-- | indra/llcommon/llversionviewer.h | 19 | ||||
| -rw-r--r-- | indra/newview/llfloaterabout.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llfloaterreporter.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llpanellogin.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llviewermessage.cpp | 21 | ||||
| -rw-r--r-- | indra/newview/llviewerprecompiledheaders.h | 2 | ||||
| -rw-r--r-- | indra/newview/llviewerregion.cpp | 1 | ||||
| -rwxr-xr-x | indra/newview/viewer_manifest.py | 14 | ||||
| -rw-r--r-- | indra/test/lltemplatemessagebuilder_tut.cpp | 2 | ||||
| -rw-r--r-- | indra/test/message_tut.cpp | 2 | ||||
| -rw-r--r-- | indra/test/test_llmanifest.py | 8 | ||||
| -rw-r--r-- | scripts/messages/message_template.msg | 4 | ||||
| -rwxr-xr-x | scripts/update_version_files.py | 303 | 
21 files changed, 394 insertions, 219 deletions
| diff --git a/indra/lib/python/indra/base/llsd.py b/indra/lib/python/indra/base/llsd.py index 18e62b0817..462a8787ae 100644 --- a/indra/lib/python/indra/base/llsd.py +++ b/indra/lib/python/indra/base/llsd.py @@ -180,8 +180,9 @@ class LLSDXMLFormatter(object):              ''.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 85e4a645bc..c4ac0a379d 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 a2a889742a..fbe08ad7fc 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 @@ class ConnectionError(Exception):      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 2bbb60ba0b..2e0c40f850 100644 --- a/indra/lib/python/indra/ipc/mysql_pool.py +++ b/indra/lib/python/indra/ipc/mysql_pool.py @@ -8,7 +8,8 @@ $License$  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 5ab4a892a7..1a9f73a9d9 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 @@ ARGUMENTS=[           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 @@ class LLManifest(object):          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 0000000000..5c17bb0fc5 --- /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 0000000000..f1bcacbd86 --- /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 0000000000..e5c560f024 --- /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 ff7e8a41b7..8a51c155de 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 71491f16e6..e1a9a38ccb 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 e32a64eb8e..6e1a1b9f09 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 20761ded11..74d8aa8e9a 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 7cf9ca9568..cbaa1e2f2e 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 26bf41f8a2..0bcab49a84 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 c94aec8801..c3841cdd98 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 9136a06c24..041dfd1b81 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -382,8 +382,9 @@ class DarwinManifest(ViewerManifest):                  # 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 @@ class LinuxManifest(ViewerManifest):                  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 5bb37b3b92..306aabfe8e 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 b2c84d5f54..4007eb17ff 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 2c4662a83d..1edcc9f2ad 100644 --- a/indra/test/test_llmanifest.py +++ b/indra/test/test_llmanifest.py @@ -86,9 +86,13 @@ class TestLLManifest(unittest.TestCase):      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 13e1885138..4b789e2db3 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 4d56015099..ff92b95573 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 @@ re_map = {}  #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() + | 
