SF Bug 2081 - [Raptor] - Exported file executable permissions not maintained (linux) fix
authortimothy.murphy@nokia.com
Fri, 26 Feb 2010 17:07:56 +0000
branchfix
changeset 278 c38bfd29ee57
parent 277 dbd582b8c0ab
child 288 80540207516e
SF Bug 2081 - [Raptor] - Exported file executable permissions not maintained (linux)
sbsv2/raptor/RELEASE-NOTES.txt
sbsv2/raptor/python/raptor_meta.py
sbsv2/raptor/test/smoke_suite/export.py
sbsv2/raptor/test/smoke_suite/test_resources/simple_export/bld.inf
sbsv2/raptor/test/smoke_suite/test_resources/simple_export/executable_file
--- a/sbsv2/raptor/RELEASE-NOTES.txt	Thu Feb 25 16:59:00 2010 +0000
+++ b/sbsv2/raptor/RELEASE-NOTES.txt	Fri Feb 26 17:07:56 2010 +0000
@@ -3,6 +3,7 @@
 next version
 
 Defect Fixes:
+- SF Bug 2081 - [Raptor] - Exported file executable permissions not maintained (linux)
 - SF Bug 2007 - [Raptor] GCCE 4.4.1 builds require 4.3.1 and 4.3.2 SBS_GCCE???BIN env vars etc.
 - SF Bug 2000 - [Raptor] Talon fails when installed in a path containing the string '-c' (windows only)
 - SF Bug 1861 - [Raptor] More helpful console message in case of timeouts
--- a/sbsv2/raptor/python/raptor_meta.py	Thu Feb 25 16:59:00 2010 +0000
+++ b/sbsv2/raptor/python/raptor_meta.py	Fri Feb 26 17:07:56 2010 +0000
@@ -2835,8 +2835,10 @@
 
 			sourceMTime = 0
 			destMTime = 0
+			sourceStat = 0
 			try:
-				sourceMTime = os.stat(source_str)[stat.ST_MTIME]
+				sourceStat = os.stat(source_str)
+				sourceMTime = sourceStat[stat.ST_MTIME]
 				destMTime = os.stat(dest_str)[stat.ST_MTIME]
 			except OSError, e:
 				if sourceMTime == 0:
@@ -2850,6 +2852,9 @@
 				if os.path.exists(dest_str):
 					os.chmod(dest_str,stat.S_IREAD | stat.S_IWRITE)
 				shutil.copyfile(source_str, dest_str)
+
+				# Ensure that the destination file remains executable if the source was also:
+				os.chmod(dest_str,sourceStat[stat.ST_MODE] | stat.S_IREAD | stat.S_IWRITE | stat.S_IWGRP ) 
 				self.__Raptor.Info("Copied %s to %s", source_str, dest_str)
 			else:
 				self.__Raptor.Info("Up-to-date: %s", dest_str)
--- a/sbsv2/raptor/test/smoke_suite/export.py	Thu Feb 25 16:59:00 2010 +0000
+++ b/sbsv2/raptor/test/smoke_suite/export.py	Fri Feb 26 17:07:56 2010 +0000
@@ -35,6 +35,7 @@
 		"simple_exp1.h exported_1.h\n"
 		"simple_exp2.h exported_2.h\n"
 		"simple_exp3.h exported_3.h\n"
+		"executable_file executable_file\n"
 		'"file with a space.doc" "exportedfilewithspacesremoved.doc"\n'
 		'"file with a space.doc" "exported file with a space.doc"\n\n'
 
@@ -59,6 +60,7 @@
 		"/tmp/$(USER)/simple_exp1.h",
 		"/tmp/$(USER)/simple_exp2.h",
 		"/tmp/$(USER)/simple_exp3.h",
+		"$(EPOCROOT)/epoc32/include/executable_file",
 		"$(EPOCROOT)/epoc32/include/simple_exp4.h"
 		]
 	t.run()
@@ -66,15 +68,31 @@
 		result = SmokeTest.FAIL
 
 
+	t = SmokeTest()
+	t.id = "0023a1"
+	t.name = "export"
+	t.usebash = True
+	t.command = "ls -l ${EPOCROOT}/epoc32/include/executable_file"
+	t.mustmatch = [ "^.rwxrwxr.x .*executable_file.*$" ]
+	t.targets = []
+	t.run()
+	t.usebash = False
+
+	if t.result == SmokeTest.FAIL:
+		result = SmokeTest.FAIL
+
+
 	# Testing if clean deletes any exports which it is not supposed to
 	t.id = "0023b"
 	t.name = "export_clean" 
 	t.command = "sbs -b smoke_suite/test_resources/simple_export/expbld.inf " \
 			+ "-c armv5 clean"
+	t.mustmatch = []
 	t.targets = [
 		"$(EPOCROOT)/epoc32/include/exported_1.h",
 		"$(EPOCROOT)/epoc32/include/exported_2.h",
 		"$(EPOCROOT)/epoc32/include/exported_3.h",
+		"$(EPOCROOT)/epoc32/include/executable_file",
 		"$(EPOCROOT)/epoc32/include/exportedfilewithspacesremoved.doc",
 		"$(EPOCROOT)/epoc32/include/exported file with a space.doc",
 		"/tmp/$(USER)/simple_exp1.h",
@@ -95,6 +113,7 @@
 		'$(EPOCROOT)/epoc32/include/exported_1.h',
 		'$(EPOCROOT)/epoc32/include/exported_2.h',
 		'$(EPOCROOT)/epoc32/include/exported_3.h',
+		"$(EPOCROOT)/epoc32/include/executable_file",
 		'$(EPOCROOT)/epoc32/include/exportedfilewithspacesremoved.doc',
 		'$(EPOCROOT)/epoc32/include/exported file with a space.doc',
 		'/tmp/$(USER)/simple_exp1.h',
@@ -116,6 +135,7 @@
 		'$(EPOCROOT)/epoc32/include/exported_1.h',
 		'$(EPOCROOT)/epoc32/include/exported_2.h',
 		'$(EPOCROOT)/epoc32/include/exported_3.h',
+		"$(EPOCROOT)/epoc32/include/executable_file",
 		'$(EPOCROOT)/epoc32/include/exportedfilewithspacesremoved.doc',
 		'$(EPOCROOT)/epoc32/include/exported file with a space.doc',
 		'/tmp/$(USER)/simple_exp1.h',
--- a/sbsv2/raptor/test/smoke_suite/test_resources/simple_export/bld.inf	Thu Feb 25 16:59:00 2010 +0000
+++ b/sbsv2/raptor/test/smoke_suite/test_resources/simple_export/bld.inf	Fri Feb 26 17:07:56 2010 +0000
@@ -26,6 +26,7 @@
 simple_exp3.h exported_3.h
 "file with a space.doc" "exportedfilewithspacesremoved.doc"
 "file with a space.doc" "exported file with a space.doc"
+executable_file	executable_file
 
 simple_exp1.h /tmp/$$(USER)/  //
 simple_exp2.h \tmp\$$(USER)/  //