diff options
author | Oz Linden <oz@lindenlab.com> | 2013-02-07 11:56:57 -0500 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2013-02-07 11:56:57 -0500 |
commit | d7e90f4160aaa81e30206c80047b82833c049482 (patch) | |
tree | fd27b80b5b9ffd8519418fcd47fdac2c6162da4f | |
parent | e87000ba0750e55d9d6b55feccc4124f5d2b4b74 (diff) |
derive version number from indra/VIEWER_VERSION.txt
23 files changed, 194 insertions, 596 deletions
@@ -159,21 +159,6 @@ fi # Check to see if we're skipping the platform eval '$build_'"$arch" || pass -# Run the version number update script -# File no longer exists in code-sep branch, so let's make sure it exists in order to use it. -if test -f scripts/update_version_files.py ; then - begin_section UpdateVer - eval $(python scripts/update_version_files.py \ - --channel="$viewer_channel" \ - --server_channel="$server_channel" \ - --revision=$revision \ - --verbose \ - | sed -n -e "s,Setting viewer channel/version: '\([^']*\)' / '\([^']*\)',VIEWER_CHANNEL='\1';VIEWER_VERSION='\2',p")\ - || fail update_version_files.py - echo "{\"Type\":\"viewer\",\"Version\":\"${VIEWER_VERSION}\"}" > summary.json - end_section UpdateVer -fi - if [ -z "$AUTOBUILD" ] then export autobuild_dir="$here/../../../autobuild/bin/" diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 001bb4b935..dde700c932 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -19,6 +19,7 @@ project(${ROOT_PROJECT_NAME}) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") include(Variables) +include(BuildVersion) if (DARWIN) # 2.6.4 fixes a Mac bug in get_target_property(... "SLPlugin" LOCATION): diff --git a/indra/cmake/BuildVersion.cmake b/indra/cmake/BuildVersion.cmake index 60a519c9af..7ee852bf72 100644 --- a/indra/cmake/BuildVersion.cmake +++ b/indra/cmake/BuildVersion.cmake @@ -1,18 +1,48 @@ # -*- cmake -*- +# Construct the viewer version number based on the indra/VIEWER_VERSION file -include(Python) +if (NOT DEFINED VIEWER_SHORT_VERSION) # will be true in indra/, false in indra/newview/ + set(VIEWER_VERSION_BASE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/newview/VIEWER_VERSION.txt") -macro (build_version _target) - execute_process( - COMMAND ${PYTHON_EXECUTABLE} ${SCRIPTS_DIR}/build_version.py - llversion${_target}.h ${LLCOMMON_INCLUDE_DIRS} - OUTPUT_VARIABLE ${_target}_VERSION - OUTPUT_STRIP_TRAILING_WHITESPACE - ) + if ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) + file(STRINGS ${VIEWER_VERSION_BASE_FILE} VIEWER_SHORT_VERSION REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+") + string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+" "\\1" VIEWER_VERSION_MAJOR ${VIEWER_SHORT_VERSION}) + string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+" "\\1" VIEWER_VERSION_MINOR ${VIEWER_SHORT_VERSION}) + string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+)" "\\1" VIEWER_VERSION_PATCH ${VIEWER_SHORT_VERSION}) - if (${_target}_VERSION) - message(STATUS "Version of ${_target} is ${${_target}_VERSION}") - else (${_target}_VERSION) - message(SEND_ERROR "Could not determine ${_target} version") - endif (${_target}_VERSION) -endmacro (build_version) + if (DEFINED ENV{revision}) + set(VIEWER_VERSION_REVISION $ENV{revision}) + message("Revision (from environment): ${VIEWER_VERSION_REVISION}") + + else (DEFINED ENV{revision}) + find_program(MERCURIAL hg) + if (DEFINED MERCURIAL) + execute_process( + COMMAND ${MERCURIAL} parents --template "{rev}" + OUTPUT_VARIABLE VIEWER_VERSION_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + if (DEFINED VIEWER_VERSION_REVISION) + message("Revision (from hg) ${VIEWER_VERSION_REVISION}") + else (DEFINED VIEWER_VERSION_REVISION) + set(VIEWER_VERSION_REVISION 0 ) + message("Revision not set, repository not found, using ${VIEWER_VERSION_REVISION}") + endif (DEFINED VIEWER_VERSION_REVISION) + else (DEFINED MERCURIAL) + set(VIEWER_VERSION_REVISION 0) + message("Revision not set, 'hg' not found (${MERCURIAL}), using ${VIEWER_VERSION_REVISION}") + endif (DEFINED MERCURIAL) + endif (DEFINED ENV{revision}) + message("Building Version ${VIEWER_SHORT_VERSION} ${VIEWER_VERSION_REVISION}") + else ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) + message(SEND_ERROR "Cannot get viewer version from '${VIEWER_VERSION_BASE_FILE}'") + endif ( EXISTS ${VIEWER_VERSION_BASE_FILE} ) + + set(VIEWER_CHANNEL_VERSION_DEFINES + "LL_VIEWER_CHANNEL=\"${VIEWER_CHANNEL}\"" + "LL_VIEWER_VERSION_MAJOR=${VIEWER_VERSION_MAJOR}" + "LL_VIEWER_VERSION_MINOR=${VIEWER_VERSION_MINOR}" + "LL_VIEWER_VERSION_PATCH=${VIEWER_VERSION_PATCH}" + "LL_VIEWER_VERSION_BUILD=${VIEWER_VERSION_REVISION}" + ) +endif (NOT DEFINED VIEWER_SHORT_VERSION) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 569034a6fb..4f567988b7 100644 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -12,7 +12,6 @@ set(cmake_SOURCE_FILES Audio.cmake BerkeleyDB.cmake Boost.cmake - BuildVersion.cmake CARes.cmake CURL.cmake CMakeCopyIfDifferent.cmake diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 4b459f1a48..6c3b7801b9 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -141,7 +141,7 @@ endif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") set(GRID agni CACHE STRING "Target Grid") set(VIEWER ON CACHE BOOL "Build Second Life viewer.") -set(VIEWER_CHANNEL "LindenDeveloper" CACHE STRING "Viewer Channel Name") +set(VIEWER_CHANNEL "Second Life Test" CACHE STRING "Viewer Channel Name") set(VIEWER_LOGIN_CHANNEL ${VIEWER_CHANNEL} CACHE STRING "Fake login channel for A/B Testing") if (XCODE_VERSION GREATER 4.2) diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py index 97cc31bba0..eaa94925b1 100644 --- a/indra/lib/python/indra/util/llmanifest.py +++ b/indra/lib/python/indra/util/llmanifest.py @@ -84,28 +84,6 @@ def get_default_platform(dummy): 'darwin':'darwin' }[sys.platform] -def get_default_version(srctree): - # look up llversion.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() - major = re.search("LL_VERSION_MAJOR\s=\s([0-9]+)", contents).group(1) - minor = re.search("LL_VERSION_MINOR\s=\s([0-9]+)", contents).group(1) - patch = re.search("LL_VERSION_PATCH\s=\s([0-9]+)", contents).group(1) - 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\"(.+)\";\s*$", contents, flags = re.M).group(1) - return channel - - DEFAULT_SRCTREE = os.path.dirname(sys.argv[0]) DEFAULT_CHANNEL = 'Second Life Release' @@ -140,7 +118,7 @@ ARGUMENTS=[ default=""), dict(name='channel', description="""The channel to use for updates, packaging, settings name, etc.""", - default=get_channel), + default='CHANNEL UNSET'), dict(name='login_channel', description="""The channel to use for login handshake/updates only.""", default=None), @@ -164,10 +142,8 @@ ARGUMENTS=[ contain the name of the final package in a form suitable for use by a .bat file.""", default=None), - dict(name='version', - description="""This specifies the version of Second Life that is - being packaged up.""", - default=get_default_version), + dict(name='versionfile', + description="""The name of a file containing the full version number."""), dict(name='signature', description="""This specifies an identity to sign the viewer with, if any. If no value is supplied, the default signature will be used, if any. Currently @@ -232,9 +208,14 @@ def main(): args[arg['name']] = default # fix up version - if isinstance(args.get('version'), str): - args['version'] = args['version'].split('.') - + if isinstance(args.get('versionfile'), str): + try: # read in the version string + vf = open(args['versionfile'], 'r') + args['version'] = vf.read().strip().split('.') + except: + print "Unable to read versionfile '%s'" % args['versionfile'] + raise + # default and agni are default if args['grid'] in ['default', 'agni']: args['grid'] = '' diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 5cce8ff2c4..f3afd9c1a9 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -246,7 +246,6 @@ set(llcommon_HEADER_FILES lluuid.h lluuidhashmap.h llversionserver.h - llversionviewer.h llworkerthread.h ll_template_cast.h metaclass.h diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h deleted file mode 100644 index 39f9de3bc2..0000000000 --- a/indra/llcommon/llversionviewer.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * @file llversionviewer.h - * @brief - * - * $LicenseInfo:firstyear=2002&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2010, Linden Research, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License only. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA - * $/LicenseInfo$ - */ - -#ifndef LL_LLVERSIONVIEWER_H -#define LL_LLVERSIONVIEWER_H - -const S32 LL_VERSION_MAJOR = 3; -const S32 LL_VERSION_MINOR = 4; -const S32 LL_VERSION_PATCH = 5; -const S32 LL_VERSION_BUILD = 0; - -const char * const LL_CHANNEL = "Second Life Developer"; - -#if LL_DARWIN -const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer"; -#endif - -#endif diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index e93d73ad0e..dbd6a60a7c 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -4,7 +4,6 @@ project(viewer) include(00-Common) include(Boost) -include(BuildVersion) include(DBusGlib) include(DirectX) include(OpenSSL) @@ -1228,6 +1227,21 @@ set(viewer_HEADER_FILES source_group("CMake Rules" FILES ViewerInstall.cmake) +set_source_files_properties( + llversioninfo.cpp tests/llversioninfo_test.cpp + PROPERTIES + OBJECT_DEPENDS always_generate_version + COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake + ) + +add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/VIEWER_VERSION.txt + COMMAND echo "${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}" > ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt + COMMENT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Generating viewer_version.txt + ) +add_custom_target(generate_viewer_version DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt") +add_dependencies(generate_viewer_version "${CMAKE_CURRENT_SOURCE_DIR}/VIEWER_VERSION.txt") + if (DARWIN) LIST(APPEND viewer_SOURCE_FILES llappviewermacosx.cpp) @@ -1308,12 +1322,16 @@ if (WINDOWS) string(TOLOWER ${VIEWER_CHANNEL} channel_lower) if(channel_lower MATCHES "^second life release") set(ICON_PATH "release") + set(VIEWER_MACOSX_PHASE "f") elseif(channel_lower MATCHES "^second life beta viewer") set(ICON_PATH "beta") + set(VIEWER_MACOSX_PHASE "b") elseif(channel_lower MATCHES "^second life development") set(ICON_PATH "development") + set(VIEWER_MACOSX_PHASE "d") elseif(channel_lower MATCHES "project") set(ICON_PATH "project") + set(VIEWER_MACOSX_PHASE "a") endif() message("Copying icons for ${ICON_PATH}") execute_process( @@ -1382,8 +1400,11 @@ if (WINDOWS) set_source_files_properties(${viewer_RESOURCE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/res/viewerRes.rc + ${CMAKE_CURRENT_BINARY_DIR}/res/viewerRes.rc + ) set(viewer_RESOURCE_FILES - res/viewerRes.rc + ${CMAKE_CURRENT_BINARY_DIR}/res/viewerRes.rc ${viewer_RESOURCE_FILES} ) @@ -1695,10 +1716,13 @@ if (WINDOWS) --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt stage_third_party_libs ${COPY_INPUT_DEPENDENCIES} COMMENT "Performing viewer_manifest copy" @@ -1757,6 +1781,7 @@ if (WINDOWS) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} --grid=${GRID} @@ -1766,12 +1791,14 @@ if (WINDOWS) DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt ${COPY_INPUT_DEPENDENCIES} ) add_custom_target(package ALL DEPENDS ${CMAKE_CFG_INTDIR}/touched.bat windows-setup-build-all + generate_viewer_version ) # temporarily disable packaging of event_host until hg subrepos get # sorted out on the parabuild cluster... @@ -1854,14 +1881,11 @@ else (USE_KDU) ) endif (USE_KDU) -build_version(viewer) - set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Path to artwork files.") - if (LINUX) - set(product SecondLife-${ARCH}-${viewer_VERSION}) + set(product SecondLife-${ARCH}-${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}) # These are the generated targets that are copied to package/ set(COPY_INPUT_DEPENDENCIES @@ -1883,6 +1907,7 @@ if (LINUX) --build=${CMAKE_CURRENT_BINARY_DIR} --buildtype=${CMAKE_BUILD_TYPE} --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} @@ -1892,11 +1917,13 @@ if (LINUX) --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt ${COPY_INPUT_DEPENDENCIES} ) if (PACKAGE) endif (PACKAGE) + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched COMMAND ${PYTHON_EXECUTABLE} @@ -1910,9 +1937,12 @@ if (LINUX) --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged --grid=${GRID} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt ${COPY_INPUT_DEPENDENCIES} COMMENT "Performing viewer_manifest copy" ) @@ -1929,20 +1959,29 @@ endif (LINUX) if (DARWIN) set(product "Second Life") + set_target_properties( ${VIEWER_BINARY_NAME} PROPERTIES OUTPUT_NAME "${product}" - MACOSX_BUNDLE_INFO_STRING "info string - localize me" + MACOSX_BUNDLE_INFO_STRING "Second Life Viewer" MACOSX_BUNDLE_ICON_FILE "secondlife.icns" MACOSX_BUNDLE_GUI_IDENTIFIER "Second Life" - MACOSX_BUNDLE_LONG_VERSION_STRING "ververver" + MACOSX_BUNDLE_LONG_VERSION_STRING "${VIEWER_CHANNEL} ${VIEWER_SHORT_VERSION}.${VIEWER_VERSION_REVISION}" MACOSX_BUNDLE_BUNDLE_NAME "Second Life" - MACOSX_BUNDLE_SHORT_VERSION_STRING "asdf" - MACOSX_BUNDLE_BUNDLE_VERSION "asdf" - MACOSX_BUNDLE_COPYRIGHT "copyright linden lab 2007 - localize me and run me through a legal wringer" + MACOSX_BUNDLE_SHORT_VERSION_STRING "${VIEWER_SHORT_VERSION}" + MACOSX_BUNDLE_BUNDLE_VERSION "${VIEWER_SHORT_VERSION}${VIEWER_MACOSX_PHASE}${VIEWER_REVISION}" + MACOSX_BUNDLE_COPYRIGHT "Copyright © Linden Research, Inc. 2007" ) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/Info-SecondLife.plist" + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app/Contents/Info.plist" + ) + #configure_file( + # "${CMAKE_CURRENT_SOURCE_DIR}/English.lproj/InfoPlist.strings" + # "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app/Contents/Resources/English.lproj/InfoPlist.strings" + # ) add_custom_command( TARGET ${VIEWER_BINARY_NAME} POST_BUILD COMMAND ${PYTHON_EXECUTABLE} @@ -1955,8 +1994,13 @@ if (DARWIN) --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app --grid=${GRID} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --source=${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${VIEWER_BINARY_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + DEPENDS + ${VIEWER_BINARY_NAME} + ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt ) add_dependencies(${VIEWER_BINARY_NAME} SLPlugin media_plugin_quicktime media_plugin_webkit mac-updater mac-crash-logger) @@ -1969,6 +2013,7 @@ if (DARWIN) if (PACKAGE) add_custom_target(package ALL DEPENDS ${VIEWER_BINARY_NAME}) + add_dependencies(package generate_viewer_version) add_custom_command( TARGET package POST_BUILD @@ -1982,12 +2027,15 @@ if (DARWIN) --configuration=${CMAKE_CFG_INTDIR} --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app --grid=${GRID} + --channel=${VIEWER_CHANNEL} + --versionfile=${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt --login_channel=${VIEWER_LOGIN_CHANNEL} --source=${CMAKE_CURRENT_SOURCE_DIR} --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.touched ${SIGNING_SETTING} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py + ${CMAKE_CURRENT_BINARY_DIR}/viewer_version.txt ) endif (PACKAGE) endif (DARWIN) diff --git a/indra/newview/English.lproj/InfoPlist.strings b/indra/newview/English.lproj/InfoPlist.strings index 5c7cacedec..041b8cea0b 100644 --- a/indra/newview/English.lproj/InfoPlist.strings +++ b/indra/newview/English.lproj/InfoPlist.strings @@ -2,6 +2,6 @@ CFBundleName = "Second Life"; -CFBundleShortVersionString = "Second Life version 2.1.0.13828"; -CFBundleGetInfoString = "Second Life version 2.1.0.13828, Copyright 2004-2009 Linden Research, Inc."; +CFBundleShortVersionString = "Second Life version %%VERSION%%"; +CFBundleGetInfoString = "Second Life version %%VERSION%%, Copyright 2004 Linden Research, Inc."; diff --git a/indra/newview/Info-SecondLife.plist b/indra/newview/Info-SecondLife.plist index f7b11b217c..a19844f11c 100644 --- a/indra/newview/Info-SecondLife.plist +++ b/indra/newview/Info-SecondLife.plist @@ -60,7 +60,7 @@ </dict> </array> <key>CFBundleVersion</key> - <string>2.1.0.13828</string> + <string>${VIEWER_VERSION_MAJOR}.${VIEWER_VERSION_MINOR}.${VIEWER_VERSION_PATCH}.${VIEWER_VERSION_REVISION}</string> <key>CSResourcesFileMapped</key> <true/> </dict> diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt new file mode 100644 index 0000000000..6cb9d3dd0d --- /dev/null +++ b/indra/newview/VIEWER_VERSION.txt @@ -0,0 +1 @@ +3.4.3 diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 20936c6460..98c8674fa5 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -113,7 +113,7 @@ export SAVED_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" export LD_LIBRARY_PATH="$PWD/lib:${LD_LIBRARY_PATH}" # Have to deal specially with gridargs.dat; typical contents look like: -# --channel "Second Life Developer" --settings settings_developer.xml +# --channel "Second Life Test" --settings settings_test.xml # Simply embedding $(<etc/gridargs.dat) into a command line treats each of # Second, Life and Developer as separate args -- no good. We need bash to # process quotes using eval. diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 1000c0e1e8..468a297c2d 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -30,7 +30,6 @@ // Viewer includes #include "llversioninfo.h" -#include "llversionviewer.h" #include "llfeaturemanager.h" #include "lluictrlfactory.h" #include "lltexteditor.h" @@ -251,6 +250,7 @@ static LLAppViewerListener sAppViewerListener(LLAppViewer::instance); // viewer.cpp - these are only used in viewer, should be easily moved. #if LL_DARWIN +const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.indra.viewer"; extern void init_apple_menu(const char* product); #endif // LL_DARWIN diff --git a/indra/newview/llversioninfo.cpp b/indra/newview/llversioninfo.cpp index 673d0c24cf..a15b280fc0 100644 --- a/indra/newview/llversioninfo.cpp +++ b/indra/newview/llversioninfo.cpp @@ -25,74 +25,78 @@ * $/LicenseInfo$ */ -#include "llviewerprecompiledheaders.h" +#include <iostream> +#include <sstream> #include "llversioninfo.h" -#include "llversionviewer.h" +#if ! defined(LL_VIEWER_VERSION_MAJOR) \ + || ! defined(LL_VIEWER_VERSION_MINOR) \ + || ! defined(LL_VIEWER_VERSION_PATCH) \ + || ! defined(LL_VIEWER_VERSION_BUILD) + #error "Version information is undefined" +#endif + +#ifndef LL_VIEWER_CHANNEL +#define LL_VIEWER_CHANNEL "Second Life Test" +#endif +const char * const LL_CHANNEL = LL_VIEWER_CHANNEL; // -// Set the version numbers in indra/llcommon/llversionviewer.h +// Set the version numbers in indra/VIEWER_VERSION // //static S32 LLVersionInfo::getMajor() { - return LL_VERSION_MAJOR; + return LL_VIEWER_VERSION_MAJOR; } //static S32 LLVersionInfo::getMinor() { - return LL_VERSION_MINOR; + return LL_VIEWER_VERSION_MINOR; } //static S32 LLVersionInfo::getPatch() { - return LL_VERSION_PATCH; + return LL_VIEWER_VERSION_PATCH; } //static S32 LLVersionInfo::getBuild() { - return LL_VERSION_BUILD; + return LL_VIEWER_VERSION_BUILD; } //static const std::string &LLVersionInfo::getVersion() { static std::string version(""); - if (version.empty()) { - // cache the version string std::ostringstream stream; - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; + stream << LLVersionInfo::getShortVersion() << "." << LLVersionInfo::getBuild(); + // cache the version string version = stream.str(); } - return version; } //static const std::string &LLVersionInfo::getShortVersion() { - static std::string version(""); - - if (version.empty()) + static std::string short_version(""); + if(short_version.empty()) { // cache the version string std::ostringstream stream; - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH; - version = stream.str(); + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH; + short_version = stream.str(); } - - return version; + return short_version; } namespace @@ -100,7 +104,7 @@ namespace /// Storage of the channel name the viewer is using. // The channel name is set by hardcoded constant, // or by calling LLVersionInfo::resetChannel() - std::string sWorkingChannelName(LL_CHANNEL); + std::string sWorkingChannelName(LL_VIEWER_CHANNEL); // Storage for the "version and channel" string. // This will get reset too. @@ -113,11 +117,7 @@ const std::string &LLVersionInfo::getChannelAndVersion() if (sVersionChannel.empty()) { // cache the version string - std::ostringstream stream; - stream << LLVersionInfo::getChannel() - << " " - << LLVersionInfo::getVersion(); - sVersionChannel = stream.str(); + sVersionChannel = LLVersionInfo::getChannel() + " " + LLVersionInfo::getVersion(); } return sVersionChannel; diff --git a/indra/newview/llversioninfo.h b/indra/newview/llversioninfo.h index 6f64544f3b..077105cae8 100644 --- a/indra/newview/llversioninfo.h +++ b/indra/newview/llversioninfo.h @@ -29,6 +29,7 @@ #define LL_LLVERSIONINFO_H #include <string> +#include "stdtypes.h" /// /// This API provides version information for the viewer. This diff --git a/indra/newview/res/viewerRes.rc b/indra/newview/res/viewerRes.rc index df75f3f697..5360842134 100644 --- a/indra/newview/res/viewerRes.rc +++ b/indra/newview/res/viewerRes.rc @@ -135,8 +135,8 @@ TOOLNO CURSOR "llno.cur" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,1,1,0 - PRODUCTVERSION 2,1,1,0 + FILEVERSION ${VIEWER_VERSION_MAJOR},${VIEWER_VERSION_MINOR},${VIEWER_VERSION_PATCH},${VIEWER_VERSION_BUILD} + PRODUCTVERSION ${VIEWER_VERSION_MAJOR},${VIEWER_VERSION_MINOR},${VIEWER_VERSION_PATCH},${VIEWER_VERSION_BUILD} FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -153,12 +153,12 @@ BEGIN BEGIN VALUE "CompanyName", "Linden Lab" VALUE "FileDescription", "Second Life" - VALUE "FileVersion", "2.1.1.0" + VALUE "FileVersion", "${VIEWER_VERSION_MAJOR}.${VIEWER_VERSION_MINOR}.${VIEWER_VERSION_PATCH}.${VIEWER_VERSION_BUILD}" VALUE "InternalName", "Second Life" - VALUE "LegalCopyright", "Copyright � 2001-2010, Linden Research, Inc." + VALUE "LegalCopyright", "Copyright � 2001, Linden Research, Inc." VALUE "OriginalFilename", "SecondLife.exe" VALUE "ProductName", "Second Life" - VALUE "ProductVersion", "2.1.1.0" + VALUE "ProductVersion", "${VIEWER_VERSION_MAJOR}.${VIEWER_VERSION_MINOR}.${VIEWER_VERSION_PATCH}.${VIEWER_VERSION_BUILD}" END END BLOCK "VarFileInfo" diff --git a/indra/newview/tests/llversioninfo_test.cpp b/indra/newview/tests/llversioninfo_test.cpp index 398d8f16ed..6b0be29c2d 100644 --- a/indra/newview/tests/llversioninfo_test.cpp +++ b/indra/newview/tests/llversioninfo_test.cpp @@ -28,7 +28,6 @@ #include "../test/lltut.h" #include "../llversioninfo.h" -#include "llversionviewer.h" namespace tut { @@ -38,20 +37,20 @@ namespace tut : mResetChannel("Reset Channel") { std::ostringstream stream; - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH << "." + << LL_VIEWER_VERSION_BUILD; mVersion = stream.str(); stream.str(""); - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH; mShortVersion = stream.str(); stream.str(""); - stream << LL_CHANNEL + stream << LL_VIEWER_CHANNEL << " " << mVersion; mVersionAndChannel = stream.str(); @@ -78,20 +77,19 @@ namespace tut { ensure_equals("Major version", LLVersionInfo::getMajor(), - LL_VERSION_MAJOR); + LL_VIEWER_VERSION_MAJOR); ensure_equals("Minor version", LLVersionInfo::getMinor(), - LL_VERSION_MINOR); + LL_VIEWER_VERSION_MINOR); ensure_equals("Patch version", LLVersionInfo::getPatch(), - LL_VERSION_PATCH); + LL_VIEWER_VERSION_PATCH); ensure_equals("Build version", LLVersionInfo::getBuild(), - LL_VERSION_BUILD); + LL_VIEWER_VERSION_BUILD); ensure_equals("Channel version", LLVersionInfo::getChannel(), - LL_CHANNEL); - + LL_VIEWER_CHANNEL); ensure_equals("Version String", LLVersionInfo::getVersion(), mVersion); diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index e7108141ee..20f64dbf4b 100644 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -666,7 +666,7 @@ class DarwinManifest(ViewerManifest): self.path(self.args['configuration'] + "/Second Life.app", dst="") if self.prefix(src="", dst="Contents"): # everything goes in Contents - self.path("Info-SecondLife.plist", dst="Info.plist") + self.path("Info.plist", dst="Info.plist") # copy additional libs in <bundle>/Contents/MacOS/ self.path("../packages/lib/release/libndofdev.dylib", dst="Resources/libndofdev.dylib") @@ -694,7 +694,11 @@ class DarwinManifest(ViewerManifest): self.path("SecondLife.nib") # Translations - self.path("English.lproj") + self.path("English.lproj/language.txt") + self.replace_in(src="English.lproj/InfoPlist.strings", + dst="English.lproj/InfoPlist.strings", + searchdict={'%%VERSION%%':'.'.join(self.args['version'])} + ) self.path("German.lproj") self.path("Japanese.lproj") self.path("Korean.lproj") diff --git a/indra/viewer_components/updater/CMakeLists.txt b/indra/viewer_components/updater/CMakeLists.txt index ef82290b47..5d84f79dbd 100644 --- a/indra/viewer_components/updater/CMakeLists.txt +++ b/indra/viewer_components/updater/CMakeLists.txt @@ -38,6 +38,13 @@ set(updater_service_HEADER_FILES set_source_files_properties(${updater_service_HEADER_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) +set_source_files_properties( + llupdaterservice.cpp + PROPERTIES + OBJECT_DEPENDS always_generate_version + COMPILE_DEFINITIONS "${VIEWER_CHANNEL_VERSION_DEFINES}" # see BuildVersion.cmake + ) + list(APPEND updater_service_SOURCE_FILES ${updater_service_HEADER_FILES} diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp index bc73c72ddc..d783360f80 100644 --- a/indra/viewer_components/updater/llupdaterservice.cpp +++ b/indra/viewer_components/updater/llupdaterservice.cpp @@ -32,7 +32,6 @@ #include "lltimer.h" #include "llupdatechecker.h" #include "llupdateinstaller.h" -#include "llversionviewer.h" #include <boost/scoped_ptr.hpp> #include <boost/weak_ptr.hpp> @@ -44,6 +43,12 @@ #pragma warning (disable : 4355) // 'this' used in initializer list: yes, intentionally #endif +#if ! defined(LL_VIEWER_VERSION_MAJOR) \ + || ! defined(LL_VIEWER_VERSION_MINOR) \ + || ! defined(LL_VIEWER_VERSION_PATCH) \ + || ! defined(LL_VIEWER_VERSION_BUILD) +#error "Version information is undefined" +#endif namespace { @@ -609,10 +614,10 @@ std::string const & ll_get_version(void) { if (version.empty()) { std::ostringstream stream; - stream << LL_VERSION_MAJOR << "." - << LL_VERSION_MINOR << "." - << LL_VERSION_PATCH << "." - << LL_VERSION_BUILD; + stream << LL_VIEWER_VERSION_MAJOR << "." + << LL_VIEWER_VERSION_MINOR << "." + << LL_VIEWER_VERSION_PATCH << "." + << LL_VIEWER_VERSION_BUILD; version = stream.str(); } diff --git a/scripts/build_version.py b/scripts/build_version.py deleted file mode 100755 index 203d76fe9e..0000000000 --- a/scripts/build_version.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -"""\ -@file build_version.py -@brief Print the build information embedded in a header file. - - Expects to be invoked from the command line with a file name and a - list of directories to search. The file name will be one of the - following: - - llversionserver.h - llversionviewer.h - - The directory list that follows will include indra/llcommon, where - these files live. - -$LicenseInfo:firstyear=2010&license=viewerlgpl$ -Second Life Viewer Source Code -Copyright (C) 2010-2011, Linden Research, Inc. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; -version 2.1 of the License only. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -$/LicenseInfo$ -""" - -import errno, os, re - -def get_version(filename): - fp = open(filename) - data = fp.read() - fp.close() - - vals = {} - m = re.search('const S32 LL_VERSION_MAJOR = (\d+);', data) - vals['major'] = m.group(1) - m = re.search('const S32 LL_VERSION_MINOR = (\d+);', data) - vals['minor'] = m.group(1) - m = re.search('const S32 LL_VERSION_PATCH = (\d+);', data) - vals['patch'] = m.group(1) - m = re.search('const S32 LL_VERSION_BUILD = (\d+);', data) - vals['build'] = m.group(1) - - return "%(major)s.%(minor)s.%(patch)s.%(build)s" % vals - -if __name__ == '__main__': - import sys - - try: - for path in sys.argv[2:]: - name = os.path.join(path, sys.argv[1]) - try: - print get_version(name) - break - except OSError, err: - if err.errno != errno.ENOENT: - raise - else: - print >> sys.stderr, 'File not found:', sys.argv[1] - sys.exit(1) - except AttributeError: - print >> sys.stderr, 'Error: malformatted file: ', name - sys.exit(1) - except IndexError: - print >> sys.stderr, ('Usage: %s llversion[...].h [directories]' % - sys.argv[0]) diff --git a/scripts/update_version_files.py b/scripts/update_version_files.py deleted file mode 100755 index 87036dc1c0..0000000000 --- a/scripts/update_version_files.py +++ /dev/null @@ -1,343 +0,0 @@ -#!/usr/bin/env python -"""\ -@file update_version_files.py -@brief Update all of the various files in the repository to a new version number, -instead of having to figure it out by hand - -$LicenseInfo:firstyear=2010&license=viewerlgpl$ -Second Life Viewer Source Code -Copyright (C) 2010-2011, Linden Research, Inc. - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; -version 2.1 of the License only. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA -$/LicenseInfo$ -""" - -import sys -import os.path - -# Look for indra/lib/python in all possible parent directories ... -# This is an improvement over the setup-path.py method used previously: -# * the script may blocated anywhere inside the source tree -# * it doesn't depend on the current directory -# * it doesn't depend on another file being present. - -def add_indra_lib_path(): - root = os.path.realpath(__file__) - # always insert the directory of the script in the search path - dir = os.path.dirname(root) - if dir not in sys.path: - sys.path.insert(0, dir) - - # Now go look for indra/lib/python in the parent dies - while root != os.path.sep: - root = os.path.dirname(root) - dir = os.path.join(root, 'indra', 'lib', 'python') - if os.path.isdir(dir): - if dir not in sys.path: - sys.path.insert(0, dir) - break - else: - print >>sys.stderr, "This script is not inside a valid installation." - sys.exit(1) - -add_indra_lib_path() - -import getopt, 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. - --revision - Specify the revision to replace the last digit of the version. - By default, revision is computed from the version control system. - --skip-on-branch - Specify a regular expression against which the current branch - is matched. If it matches, then leave version strings alone. - Use this to avoid changing version strings on release candidate - builds. - --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 hg revision: - update_version_files.py - - # Update build numbers unless we are on a release branch: - update_version_files.py --skip-on-branch='^Branch_' - - # 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 hg 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.""" - if os.path.sep != "/": - # stupid #%#$$ windows - cmd = 'cmd.exe /c "'+cmd+'"' - pipe = os.popen(cmd, 'r') - text = pipe.read() - sts = pipe.close() - if sts is None: sts = 0 - if text[-1:] == '\n': text = text[:-1] - return sts, text - -re_map = {} - -#re_map['filename'] = (('pattern', 'replacement'), -# ('pattern', 'replacement') -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 = "%(VIEWER_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/viewerRes.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"')) - -# 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>'),) - -# 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')) - - -version_re = re.compile('(\d+).(\d+).(\d+).(\d+)') - -def main(): - script_path = os.path.dirname(__file__) - src_root = script_path + "/../" - verbose = False - - opts, args = getopt.getopt(sys.argv[1:], - "", - ['version=', - 'revision=', - 'channel=', - 'server_channel=', - 'skip-on-branch=', - 'verbose', - 'server', - 'viewer', - 'help']) - update_server = False - update_viewer = False - new_version = None - new_revision = None - new_viewer_channel = None - new_server_channel = None - skip_on_branch_re = None - for o,a in opts: - if o in ('--version'): - new_version = a - if o in ('--revision'): - new_revision = a - if o in ('--skip-on-branch'): - skip_on_branch_re = re.compile(a) - if o in ('--channel'): - new_viewer_channel = a - if o in ('--server_channel'): - new_server_channel = 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 current channel/version from llversion*.h - try: - viewer_channel = llversion.get_viewer_channel() - viewer_version = llversion.get_viewer_version() - except IOError: - print "Viewer version file not present, skipping..." - viewer_channel = None - viewer_version = None - update_viewer = False - - try: - server_channel = llversion.get_server_channel() - server_version = llversion.get_server_version() - except IOError: - print "Server version file not present, skipping..." - server_channel = None - server_version = None - update_server = False - - if verbose: - print "Source Path:", src_root - if viewer_channel != None: - print "Current viewer channel/version: '%(viewer_channel)s' / '%(viewer_version)s'" % locals() - if server_channel != None: - print "Current server channel/version: '%(server_channel)s' / '%(server_version)s'" % locals() - print - - # Determine new channel(s) - if new_viewer_channel != None and len(new_viewer_channel) > 0: - viewer_channel = new_viewer_channel - if new_server_channel != None and len(new_server_channel) > 0: - server_channel = new_server_channel - - # Determine new version(s) - if new_version: - m = version_re.match(new_version) - if not m: - print "Invalid version string specified!" - return -1 - if update_viewer: - viewer_version = new_version - if update_server: - server_version = new_version - else: - - if llversion.using_hg(): - if new_revision: - revision = new_revision - else: - revision = llversion.get_hg_changeset() - branch = llversion.get_hg_repo() - elif new_revision: - revision = new_revision - branch = "unknown" - else: - print >>sys.stderr, "ERROR: could not determine revision and branch" - return -1 - - if skip_on_branch_re and skip_on_branch_re.match(branch): - print "Release Candidate Build, leaving version files untouched." - return 0 - 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: - if update_viewer: - print "Setting viewer channel/version: '%(viewer_channel)s' / '%(viewer_version)s'" % locals() - if update_server: - print "Setting server channel/version: '%(server_channel)s' / '%(server_version)s'" % locals() - print - - # split out version parts - if viewer_version != None: - 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) - - if server_version != None: - 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) - - # For readability and symmetry with version strings: - VIEWER_CHANNEL = viewer_channel - SERVER_CHANNEL = server_channel - - # Iterate through all of the files in the map, and apply the - # substitution filters - for filename in re_map.keys(): - try: - # 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() - except IOError: - print "File %(filename)s not present, skipping..." % locals() - return 0 - -if __name__ == '__main__': - sys.exit(main()) - |