merge -r 66233:67472 svn+ssh://svn/svn/linden/branches/het-grid-4 Paired by Tess and Leyla.
Added tests to version manager and fixed failed tests. Paired by rdw and Tess.master
parent
52cb2aea86
commit
3b2515fd5f
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
from eventlet.httpc import *
|
||||
|
||||
|
||||
import os
|
||||
import time
|
||||
import urlparse
|
||||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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**)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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)})
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
#include "lltut.h"
|
||||
|
||||
#include "llapr.h"
|
||||
#include "llversion.h"
|
||||
#include "llversionserver.h"
|
||||
#include "message.h"
|
||||
#include "message_prehash.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -5381,6 +5381,10 @@ version 2.0
|
|||
{ RegionHandle U64 }
|
||||
{ Timestamp U32 }
|
||||
}
|
||||
{
|
||||
SimData Single
|
||||
{ ChannelVersion Variable 2 }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
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=', '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
|
||||
|
||||
opts, args = getopt.getopt(sys.argv[1:],
|
||||
"",
|
||||
['version=', 'verbose'])
|
||||
if not(update_server or update_viewer):
|
||||
update_server = True
|
||||
update_viewer = True
|
||||
|
||||
version_string = None
|
||||
for o,a in opts:
|
||||
if o in ('--version'):
|
||||
version_string = a
|
||||
if o in ('--verbose'):
|
||||
verbose = 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
|
||||
|
||||
if verbose:
|
||||
print "Source Path:", src_root
|
||||
print "Current version: %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)s" % locals()
|
||||
# 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 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 "Setting viewer version: '%(viewer_version)s'" % locals()
|
||||
print "Setting server version: '%(server_version)s'" % locals()
|
||||
print
|
||||
|
||||
if verbose:
|
||||
print "New version: %(VER_MAJOR)s.%(VER_MINOR)s.%(VER_PATCH)s.%(VER_BUILD)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)
|
||||
|
||||
# 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()
|
||||
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)
|
||||
|
||||
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)
|
||||
# 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()
|
||||
|
||||
file = open(full_fn,"w")
|
||||
file.write(file_str)
|
||||
file.close()
|
||||
return 0
|
||||
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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue