Updates to Raptor Installer Maker tool to take into account win32-support repository location. wip
authorDaniel Jacobs <daniel.jacobs@nokia.com>
Fri, 11 Dec 2009 16:23:21 +0000
branchwip
changeset 79 540de0f551cf
parent 78 796529273552
child 84 203efe4f6b60
child 95 c2eb160d064a
child 97 3127d8e83e30
Updates to Raptor Installer Maker tool to take into account win32-support repository location.
sbsv2/raptor/util/install-windows/raptorinstallermaker.py
sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi
--- a/sbsv2/raptor/util/install-windows/raptorinstallermaker.py	Fri Dec 11 14:08:26 2009 +0000
+++ b/sbsv2/raptor/util/install-windows/raptorinstallermaker.py	Fri Dec 11 16:23:21 2009 +0000
@@ -30,40 +30,51 @@
 tempdir = ""
 
 parser = optparse.OptionParser()
-parser.add_option("-s", "--sbs_home", dest="sbs_home",
+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 use as SBS_HOME environment variable. If not present the script exits.")
 
 (options, args) = parser.parse_args()
 
-if options.sbs_home == None:
+if options.sbshome == None:
 	print "ERROR: no SBS_HOME passed in. Exiting..."
 	sys.exit(2)
 
+if options.win32support == None:
+	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", "python252"]
+	for dir in win32supportdirs:
+		if not os.path.isdir(os.path.join(options.win32support, dir)):
+			print "ERROR: directory %s does not exist. Cannot build installer. Exiting..."
+			sys.exit(2)
 
 def parseconfig(xmlFile="raptorinstallermaker.xml"):
 	pass
 
-def generateinstallerversionheader(sbs_home = None):
-	os.environ["SBS_HOME"] = sbs_home
-	os.environ["PATH"] = os.path.join(os.environ["SBS_HOME"], "bin") + os.pathsep + os.environ["PATH"]
+def generateinstallerversionheader(sbshome = None):
+	shellenv = os.environ.copy()
+	shellenv["PYTHONPATH"] = os.path.join(os.environ["SBS_HOME"], "python")
 	
-	versioncommand = "sbs -v"
+	raptorversioncommand = "python -c \"import raptor_version; print raptor_version.numericversion()\""
 	
-	# Raptor version string looks like this
-	# sbs version 2.5.0 [2009-02-20 release]
+	# Raptor version is obtained from raptor_version module's numericversion function.
 	sbs_version_matcher = re.compile(".*(\d+\.\d+\.\d+).*", re.I)
 	
 	# Create Raptor subprocess
-	sbs = subprocess.Popen(versioncommand, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
-	
+	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 sbs.stdout.readlines():
+	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
 
-	sbs.wait() # Wait for process to end
+	versioncommand.wait() # Wait for process to end
 	
 	raptorversion_nsis_header_string = "# Raptor version file\n\n!define RAPTOR_VERSION %s\n" % raptorversion
 	
@@ -94,11 +105,16 @@
 	global tempdir
 	print "Cleaning up temporary directory %s" % tempdir
 	shutil.rmtree(tempdir,True)
+	try:
+		os.remove("raptorversion.nsh")
+		print "Successfully deleted raptorversion.nsh."
+	except:
+		print "ERROR: failed to remove raptorversion.nsh - remove manually if needed."
 	print "Done."
 
 makensispath = unzipnsis(".\\NSIS.zip")
-generateinstallerversionheader(options.sbs_home)
-nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s raptorinstallerscript.nsi" % options.sbs_home
+generateinstallerversionheader(options.sbshome)
+nsiscommand = makensispath + " /DRAPTOR_LOCATION=%s /DWIN32SUPPORT=%s raptorinstallerscript.nsi" % (options.sbshome, options.win32support)
 print "nsiscommand = %s" % nsiscommand
 runmakensis(nsiscommand)
 cleanup()
--- a/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi	Fri Dec 11 14:08:26 2009 +0000
+++ b/sbsv2/raptor/util/install-windows/raptorinstallerscript.nsi	Fri Dec 11 16:23:21 2009 +0000
@@ -114,6 +114,14 @@
     File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\schema\*.*
     SetOutPath "$INSTDIR\win32"
     File /r /x distribution.policy.s60 ${RAPTOR_LOCATION}\win32\*.*
+    SetOutPath "$INSTDIR\win32\bv"
+    File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\bv\*.*
+    SetOutPath "$INSTDIR\win32\cygwin"
+    File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\cygwin\*.*
+    SetOutPath "$INSTDIR\win32\mingw"
+    File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\mingw\*.*
+    SetOutPath "$INSTDIR\win32\python252"
+    File /r /x distribution.policy.s60 /x .hg ${WIN32SUPPORT}\python252\*.*
     
     SetOutPath "$INSTDIR"
     File ${RAPTOR_LOCATION}\RELEASE-NOTES.txt