# HG changeset patch # User Daniel Jacobs # Date 1267104783 0 # Node ID 4fd571a5fb6afdf09f5f35a775a55b9767bed547 # Parent 473675d0eb9531a3b5c9964d9838298ebb540086# Parent 98f67f17a03c61873cd4eea041821f5e6f9b274d Merge. diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/bin/sbs.bat --- a/sbsv2/raptor/bin/sbs.bat Thu Feb 25 13:28:42 2010 +0000 +++ b/sbsv2/raptor/bin/sbs.bat Thu Feb 25 13:33:03 2010 +0000 @@ -1,5 +1,5 @@ @rem -@rem Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +@rem Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available @rem under the terms of the License "Eclipse Public License v1.0" @@ -15,49 +15,7 @@ @rem @SETLOCAL -@SET HOSTPLATFORM=win 32 -@SET HOSTPLATFORM_DIR=win32 - - -@REM Automatically find SBS_HOME if it is not set -@IF NOT "%SBS_HOME%"=="" goto foundhome -@SET RAPTORBINDIR=%~dp0 -@SET WD=%cd% -@cd /d %RAPTORBINDIR%\.. -@SET SBS_HOME=%cd% -@cd /d %WD% -:foundhome - -@REM Use the python set by the environment if possible -@SET __PYTHON__=%SBS_PYTHON% -@IF "%__PYTHON__%"=="" SET __PYTHON__=%SBS_HOME%\win32\python264\python.exe -@SET PYTHONPATH=%SBS_PYTHONPATH% -@IF "%PYTHONPATH%"=="" SET PYTHONPATH=%SBS_HOME%\win32\python264 - -@REM Use the mingw set by the environment if possible -@SET __MINGW__=%SBS_MINGW% -@IF "%__MINGW__%"=="" SET __MINGW__=%SBS_HOME%\win32\mingw - -@REM Use the cygwin set by the environment if possible -@SET __CYGWIN__=%SBS_CYGWIN% -@IF "%__CYGWIN__%"=="" SET __CYGWIN__=%SBS_HOME%\win32\cygwin - -@REM add to the search path -@REM (make sure that we don't get into trouble if there are Path and PATH variables) -@SET PATH_TEMP=%__MINGW__%\bin;%__CYGWIN__%\bin;%SBS_HOME%\win32\bin;%PATH% -@SET PATH= -@SET PATH=%PATH_TEMP% -@SET PATH_TEMP= - -@REM Make sure that /tmp is not set incorrectly for sbs -@umount -u /tmp >NUL 2>NUL -@mount -u %TEMP% /tmp >NUL 2>NUL -@umount -u / >NUL 2>NUL -@mount -u %__CYGWIN__% / >NUL 2>NUL - -@REM Tell CYGWIN not to map unix security attributes to windows to -@REM prevent raptor from potentially creating read-only files: -@set CYGWIN=nontsec nosmbntsec +@CALL "%~dp0sbs_env.bat" @REM Run Raptor with all the arguments. @%__PYTHON__% %SBS_HOME%\python\raptor_start.py %* diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/bin/sbs_env.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sbsv2/raptor/bin/sbs_env.bat Thu Feb 25 13:33:03 2010 +0000 @@ -0,0 +1,66 @@ +@rem +@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +@rem All rights reserved. +@rem This component and the accompanying materials are made available +@rem under the terms of the License "Eclipse Public License v1.0" +@rem which accompanies this distribution, and is available +@rem at the URL "http://www.eclipse.org/legal/epl-v10.html". +@rem +@rem Initial Contributors: +@rem Nokia Corporation - initial contribution. +@rem +@rem Contributors: +@rem +@rem Description: +@rem + +@SET HOSTPLATFORM=win 32 +@SET HOSTPLATFORM_DIR=win32 + +@REM Automatically find SBS_HOME if it is not set +@IF NOT "%SBS_HOME%"=="" goto foundhome +@SET RAPTORBINDIR=%~dp0 +@SET WD=%cd% +@cd /d %RAPTORBINDIR%\.. +@SET SBS_HOME=%cd% +@cd /d %WD% +:foundhome + +@REM Use the python set by the environment if possible +@SET __PYTHON__=%SBS_PYTHON% +@IF "%__PYTHON__%"=="" SET __PYTHON__=%SBS_HOME%\win32\python264\python.exe +@SET PYTHONPATH=%SBS_PYTHONPATH% +@IF "%PYTHONPATH%"=="" SET PYTHONPATH=%SBS_HOME%\win32\python264 + +@REM Use the mingw set by the environment if possible +@SET __MINGW__=%SBS_MINGW% +@IF "%__MINGW__%"=="" SET __MINGW__=%SBS_HOME%\win32\mingw + +@REM Use the cygwin set by the environment if possible +@SET __CYGWIN__=%SBS_CYGWIN% +@IF "%__CYGWIN__%"=="" SET __CYGWIN__=%SBS_HOME%\win32\cygwin + +@REM add to the search path +@REM (make sure that we don't get into trouble if there are Path and PATH variables) +@SET PATH_TEMP=%__MINGW__%\bin;%__CYGWIN__%\bin;%SBS_HOME%\win32\bin;%PATH% +@SET PATH= +@SET PATH=%PATH_TEMP% +@SET PATH_TEMP= + +@REM Tell CYGWIN not to map unix security attributes to windows to +@REM prevent raptor from potentially creating read-only files. +@REM Assume Cygwin 1.5 CLI. +@SET __MOUNTOPTIONS__=-u +@SET __UMOUNTOPTIONS__=-u +@SET CYGWIN=nontsec nosmbntsec + +@REM Make sure that /tmp is not set incorrectly for sbs. +@umount %__UMOUNTOPTIONS__% /tmp >NUL 2>NUL + +@REM If this fails, that means we are using Cygwin 1.7, so change the options and redo the first umount +@IF %ERRORLEVEL% == 1 SET CYGWIN=nodosfilewarning && SET __MOUNTOPTIONS__=-o noacl -o user && SET __UMOUNTOPTIONS__=&& umount %__UMOUNTOPTIONS__% /tmp >NUL 2>NUL + +@mount %__MOUNTOPTIONS__% %TEMP% /tmp >NUL 2>NUL +@umount %__UMOUNTOPTIONS__% / >NUL 2>NUL +@mount %__MOUNTOPTIONS__% %__CYGWIN__% / >NUL 2>NUL + diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/bin/sbs_filter.bat --- a/sbsv2/raptor/bin/sbs_filter.bat Thu Feb 25 13:28:42 2010 +0000 +++ b/sbsv2/raptor/bin/sbs_filter.bat Thu Feb 25 13:33:03 2010 +0000 @@ -14,31 +14,8 @@ @rem Description: @rem -@REM Automatically find SBS_HOME if it is not set -@IF NOT "%SBS_HOME%"=="" goto foundhome -@SET RAPTORBINDIR=%~dp0 -@SET WD=%cd% -@cd %RAPTORBINDIR%\.. -@SET SBS_HOME=%cd% -@cd %WD% -:foundhome - -@REM Use the cygwin set by the environment if possible -@SET __CYGWIN__=%SBS_CYGWIN% -@IF "%__CYGWIN__%"=="" SET __CYGWIN__=%SBS_HOME%\win32\cygwin - -@REM add to the search path -@SET PATH=%__CYGWIN__%\bin;%PATH% - -@REM Make sure that /tmp is not set incorrectly for sbs -@umount -u /tmp >NUL 2>NUL -@mount -u %TEMP% /tmp >NUL 2>NUL -@umount -u / >NUL 2>NUL -@mount -u %__CYGWIN__% / >NUL 2>NUL - -@REM Tell CYGWIN not to map unix security attributes to windows to -@REM prevent raptor from potentially creating read-only files: -@set CYGWIN=nontsec nosmbntsec +@SETLOCAL +@CALL "%~dp0\sbs_env.bat" @REM Run with all the arguments. @bash %SBS_HOME%\bin\sbs_filter %* diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/python/sbs_dist.py --- a/sbsv2/raptor/python/sbs_dist.py Thu Feb 25 13:28:42 2010 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,139 +0,0 @@ -# -# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of the License "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# raptor linux distribution creation module -# This module allow to crate raptor linux distribution archive (tar.gz) e.g. sbs_linux_dist.tar.gz -# Script extect the following command-line parameters: -# 1. Archive name -# 2. List of files/directories to include -# By default windows specific and source files are excluded. -# example including bin and python subdir: -# sbs_dist.py sbs_linux_dist.tar.gz bin python -# - -import os -import re -import tarfile -import sys -import dos2unix - -#------------------------------------------------------------------------------ -# Create tar.gz archive including given files (fileName list and tarinfo list) -#------------------------------------------------------------------------------ -def createTarGZ(tarName, fileList): - tar = tarfile.open(tarName, "w|gz") - for name in fileList: - tar.add(name) - return tar - -#------------------------------------------------------------------------------ -# Lists files in each of given directories -#------------------------------------------------------------------------------ -def listFilesInDirs(paths): - fileList = [] - for path in paths: - fileList.extend(listFiles(path)) - return fileList - -#------------------------------------------------------------------------------ -# Lists files in given directory -#------------------------------------------------------------------------------ -def listFiles(path): - fileList = [] - for root, dirs, files in os.walk(path): - for index in range(len(files)): - fileList.append(root + "/" + files[index]) - return fileList - -#------------------------------------------------------------------------------ -# Excludes files matching "pattern" from given files list -#------------------------------------------------------------------------------ -def excludeFiles(fileList, pattern): - filteredFileList = [] - regExp = re.compile(pattern) - for fileName in fileList: - if not(regExp.match(fileName)): - filteredFileList.append(fileName) - return filteredFileList - - -#------------------------------------------------------------------------------ -# Groups given paths as files or directories -#------------------------------------------------------------------------------ -def groupFilesAndDirs(filesAndDirs): - files = [] - dirs = [] - for name in filesAndDirs: - if os.path.isdir(name): - dirs.append(name) - else: - if os.path.isfile(name): - files.append(name) - else: - print "Warning: Neither a file nor a directory! Ignoring parameter - " + name - return (files,dirs) - -#------------------------------------------------------------------------------ -# Prepares regular expression to exclude unnecessary files -#------------------------------------------------------------------------------ -def prepareExcludedFilesRegExp(): - pathPrefixRegExp = ".*[\\\/]" - filesRegExp = "((sbs)|(.*\.bat)|(.*\.pyc)|(.*\.cmd)|(.*\.exe)|(.*\.dll)|(sbs_dist.py)" - filesRegExp = filesRegExp + "|(dos2unix.py)|(raptor_py2exe_setup.py)|(make)|(bash)|(bashbug))+" - return "^" + pathPrefixRegExp + filesRegExp + "$" - -#------------------------------------------------------------------------------ -# Includes all files in fileList in given tar with altered executable permision (+X) for all -#------------------------------------------------------------------------------ -def includeAsExecutable(tar, fileList): - for f in fileList: - tarinfo = tar.gettarinfo(f) - # OR with 73 (001 001 001) - +X for all - tarinfo.mode = tarinfo.mode | 73 - tar.addfile(tarinfo,file(f, "rb")) - - -#------------------------------------------------------------------------------ -# Validate script parameters -#------------------------------------------------------------------------------ -def validateParameters(tarFileName, filesToInclude): - if not(len(tarFileName) > 0): - print "Error: No archive name given." - sys.exit() - if not(len(filesToInclude) > 0): - print "Error: No files/directories names to include in archive given." - sys.exit() - - -tarFileName = sys.argv[1] -# files and directories -filesAndDirsToInclude = sys.argv[2:] - -validateParameters(tarFileName, filesAndDirsToInclude) - -(filesToInclude,dirsToInclude) = groupFilesAndDirs(filesAndDirsToInclude) - -fileList = listFilesInDirs(dirsToInclude) -fileList.extend(filesToInclude) - -filteredFileList = excludeFiles(fileList, prepareExcludedFilesRegExp()) - -dos2unix.dos2unix("bin/sbs") - -tar = createTarGZ(tarFileName, filteredFileList) -fileToBeExecutableList = ["bin/sbs", "linux-i386/bin/make", "linux-i386/bin/bash", "linux-i386/bin/bashbug", - "bin/sbs_descramble"] -includeAsExecutable(tar, fileToBeExecutableList) -tar.close() - diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/test/run.bat --- a/sbsv2/raptor/test/run.bat Thu Feb 25 13:28:42 2010 +0000 +++ b/sbsv2/raptor/test/run.bat Thu Feb 25 13:33:03 2010 +0000 @@ -1,5 +1,5 @@ @rem -@rem Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). +@rem Copyright (c) 2005-2010 Nokia Corporation and/or its subsidiary(-ies). @rem All rights reserved. @rem This component and the accompanying materials are made available @rem under the terms of the License "Eclipse Public License v1.0" @@ -14,29 +14,16 @@ @rem Description: @rem -@echo off - -set HOSTPLATFORM=win 32 -set HOSTPLATFORM_DIR=win32 - -setlocal -set __PYTHON__=%SBS_PYTHON% -if "%__PYTHON__%"=="" set __PYTHON__=%SBS_HOME%\win32\python264\python.exe +@SETLOCAL +@CALL %SBS_HOME%\bin\sbs_env.bat -set __TEST_SUITE__=%SBS_HOME%\test\common\run_tests.pyc -set __TEST_SUITE_PY__=%SBS_HOME%\test\common\run_tests.py - -@REM Mount '/' in cygwin, in case it is not done automatically -set __CYGWIN__=%SBS_CYGWIN% -if "%__CYGWIN__%"=="" set __CYGWIN__=%SBS_HOME%\win32\cygwin -%__CYGWIN__%\bin\umount -u "/" >NUL 2>NUL -%__CYGWIN__%\bin\mount -u "%__CYGWIN__%" "/" +@SET __TEST_SUITE__=%~dp0common\run_tests.pyc +@SET __TEST_SUITE_PY__=%~dp0common\run_tests.py @REM If the Python source exists, use it. Else use the byte-compiled Python code -if exist %__TEST_SUITE_PY__% SET __TEST_SUITE__=%__TEST_SUITE_PY__% +@IF EXIST %__TEST_SUITE_PY__% SET __TEST_SUITE__=%__TEST_SUITE_PY__% @REM Then run the test suite with all the arguments -%__PYTHON__% -tt %__TEST_SUITE__% %* +@%__PYTHON__% -tt %__TEST_SUITE__% %* -endlocal -@echo on +@ENDLOCAL diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/util/install-windows/raptorinstallermaker.py --- a/sbsv2/raptor/util/install-windows/raptorinstallermaker.py Thu Feb 25 13:28:42 2010 +0000 +++ b/sbsv2/raptor/util/install-windows/raptorinstallermaker.py Thu Feb 25 13:33:03 2010 +0000 @@ -30,13 +30,28 @@ tempdir = "" parser = optparse.OptionParser() -parser.add_option("-s", "--sbs-home", dest="sbshome", - help="Path to use as SBS_HOME environment variable. If not present the script exits.") -parser.add_option("-w", "--win32-support", dest="win32support", - help="Path to Win32 support directory. If not present the script exits.") + +parser.add_option("-s", "--sbs-home", dest="sbshome", help="Path to use as SBS_HOME environment variable. If not present the script exits.") + +parser.add_option("-w", "--win32-support", dest="win32support", help="Path to Win32 support directory. If not present the script exits.") + +parser.add_option("-b", "--bv", dest="bv", help="Path to Binary variation CPP \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-c", "--cygwin", dest="cygwin", help="Path to Cygwin \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-m", "--mingw", dest="mingw", help="Path to MinGW \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("-p", "--python", dest="python", help="Path to Python \"root\" directory. Can be a full/relatitve path; prefix with \"WIN32SUPPORT\\\" to be relative to the Win32 support directory. Omitting this value will assume a default to a path inside the Win32 support directory.") + +parser.add_option("--prefix", dest="versionprefix", help="A string to use as a prefix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") + +parser.add_option("--postfix", dest="versionpostfix", help="A string to use as a postfix to the Raptor version string. This will be present in the Raptor installer's file name, the installer's pages as well as the in output from sbs -v.", type="string", default="") (options, args) = parser.parse_args() +# Required directories inside the win32-support repository +win32supportdirs = {"bv":"bv", "cygwin":"cygwin", "mingw":"mingw", "python":"python264"} + if options.sbshome == None: print "ERROR: no SBS_HOME passed in. Exiting..." sys.exit(2) @@ -45,16 +60,33 @@ print "ERROR: no win32support directory specified. Unable to proceed. Exiting..." sys.exit(2) else: - # Required irectories inside the win32-support repository - win32supportdirs = ["bv", "cygwin", "mingw", "python264"] - for dir in win32supportdirs: - if not os.path.isdir(os.path.join(options.win32support, dir)): + # Check for command line overrides to defaults + for directory in win32supportdirs: + print "TEST %s" % directory + value = getattr(options,directory) + print "value = %s" % str(value) + if value != None: # Command line override + if value.lower().startswith("win32support"): + # Strip off "WIN32SUPPORT\" and join to Win32 support location + win32supportdirs[directory] = os.path.join(options.win32support, value[13:]) + else: + # Relative to current directory + win32supportdirs[directory] = value + + else: # Use default location + win32supportdirs[directory] = os.path.join(options.win32support, win32supportdirs[directory]) + + print "\n\nwin32supportdirs = %s\n\n" % win32supportdirs + + # Check that all the specified directories exist and exit if any of them is missing. + for directory in win32supportdirs: + dir = win32supportdirs[directory] + if os.path.isdir(dir): + print "Found directory %s" % dir + else: print "ERROR: directory %s does not exist. Cannot build installer. Exiting..." % dir sys.exit(2) -def parseconfig(xmlFile="raptorinstallermaker.xml"): - pass - def generateinstallerversionheader(sbshome = None): shellenv = os.environ.copy() shellenv["PYTHONPATH"] = os.path.join(sbshome, "python") @@ -83,6 +115,29 @@ fh.close() print "Wrote raptorversion.nsh" return 0 + +def generateinstallerversion(sbshome = None): + shellenv = os.environ.copy() + shellenv["PYTHONPATH"] = os.path.join(sbshome, "python") + + raptorversioncommand = "python -c \"import raptor_version; print raptor_version.numericversion()\"" + + # Raptor version is obtained from raptor_version module's numericversion function. + sbs_version_matcher = re.compile(".*(\d+\.\d+\.\d+).*", re.I) + + # Create Raptor subprocess + versioncommand = subprocess.Popen(raptorversioncommand, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=shellenv) + raptorversion = "" + # Get all the lines matching the RE + for line in versioncommand.stdout.readlines(): + res = sbs_version_matcher.match(line) + if res: + raptorversion = res.group(1) + print "Successfully determined Raptor version %s" % raptorversion + + versioncommand.wait() # Wait for process to end + + return raptorversion def unzipnsis(pathtozip): global tempdir @@ -113,8 +168,14 @@ print "Done." makensispath = unzipnsis(".\\NSIS.zip") -generateinstallerversionheader(options.sbshome) -nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s /DWIN32SUPPORT=%s raptorinstallerscript.nsi" % (options.sbshome, options.win32support) +# generateinstallerversionheader(options.sbshome) +raptorversion = options.versionprefix + generateinstallerversion(options.sbshome) + options.versionpostfix +nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s /DBV_LOCATION=%s /DCYGWIN_LOCATION=%s /DMINGW_LOCATION=%s /DPYTHON_LOCATION=%s /DRAPTOR_VERSION=%s raptorinstallerscript.nsi" % (options.sbshome, + win32supportdirs["bv"], + win32supportdirs["cygwin"], + win32supportdirs["mingw"], + win32supportdirs["python"], + raptorversion) print "nsiscommand = %s" % nsiscommand runmakensis(nsiscommand) cleanup() diff -r 473675d0eb95 -r 4fd571a5fb6a sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi --- a/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi Thu Feb 25 13:28:42 2010 +0000 +++ b/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi Thu Feb 25 13:33:03 2010 +0000 @@ -44,10 +44,9 @@ # Custom includes (depend on above variables so much be here) !include "raptorinstallerutils.nsh" # Functions and macros for handling environment variables -!include "raptorversion.nsh" # Define the RAPTOR_VERSION variable +# !include "raptorversion.nsh" # Define the RAPTOR_VERSION variable # Defines -# !define /date DATE_STAMP "%Y-%m-%d-%H-%M-%S" !define INSTALLER_NAME "Raptor v${RAPTOR_VERSION}" !define RAPTOR "sbs" !define INSTALLER_FILENAME "${RAPTOR}-${RAPTOR_VERSION}.exe" @@ -112,16 +111,16 @@ File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\python\*.* SetOutPath "$INSTDIR\schema" File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\schema\*.* - SetOutPath "$INSTDIR\win32" - File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\*.* + SetOutPath "$INSTDIR\win32\bin" + File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\bin\*.* SetOutPath "$INSTDIR\win32\bv" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\bv\*.* + File /r /x distribution.policy.s60 /x .hg ${BV_LOCATION}\*.* SetOutPath "$INSTDIR\win32\cygwin" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\cygwin\*.* + File /r /x distribution.policy.s60 /x .hg ${CYGWIN_LOCATION}\*.* SetOutPath "$INSTDIR\win32\mingw" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\mingw\*.* + File /r /x distribution.policy.s60 /x .hg ${MINGW_LOCATION}\*.* SetOutPath "$INSTDIR\win32\python264" - File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\python264\*.* + File /r /x distribution.policy.s60 /x .hg ${PYTHON_LOCATION}\*.* SetOutPath "$INSTDIR" File ${RAPTOR_LOCATION}\RELEASE-NOTES.txt