20 #while importing check if all modules are available, else raise error |
20 #while importing check if all modules are available, else raise error |
21 try: |
21 try: |
22 import subprocess |
22 import subprocess |
23 import platform |
23 import platform |
24 import urllib |
24 import urllib |
|
25 import xml.dom.minidom |
25 except ImportError: |
26 except ImportError: |
26 python_error() |
27 python_error() |
27 |
28 |
28 #-------------------------Hardcoded values----------------------------------------- |
29 #-------------------------Hardcoded values----------------------------------------- |
29 #Currently hardcoded values, these will be moved to a metadata file later |
|
30 #data version denotes compatibility between the tool and carbide plugin |
|
31 DATA_VERSION = "6" |
|
32 #tool version denotes the version of the core tools package |
30 #tool version denotes the version of the core tools package |
33 TOOL_VERSION = "2.8.3" |
31 TOOL_VERSION = "2.8.4" |
34 TOOL_DATE = "1st December 2009" |
32 TOOL_DATE = "16th February 2010" |
35 |
33 |
36 #server to be used for downloading Core tools package and knownissues |
34 #server to be used for downloading Core tools package and knownissues |
37 SERVER_PATH = "http://" |
35 SERVER_PATH = "http://" |
38 |
36 |
39 #-------------------------Global values-------------------------------------------- |
37 #-------------------------Global values-------------------------------------------- |
45 #create the \data and \bin paths which contain the necessary additional headers |
43 #create the \data and \bin paths which contain the necessary additional headers |
46 DATA_PATH = TOOL_DIR + "data" + os.sep |
44 DATA_PATH = TOOL_DIR + "data" + os.sep |
47 EXEC_PATH = TOOL_DIR + "bin" + os.sep |
45 EXEC_PATH = TOOL_DIR + "bin" + os.sep |
48 REPORT_PATH = TOOL_DIR + "reports" + os.sep |
46 REPORT_PATH = TOOL_DIR + "reports" + os.sep |
49 DEFAULT_ISSUES_FILE = TOOL_DIR + "data" + os.sep + "knownissues.xml" |
47 DEFAULT_ISSUES_FILE = TOOL_DIR + "data" + os.sep + "knownissues.xml" |
50 s60_build_targets = [ 'armv5', 'armv5_abiv2', 'armv6', 'armv6t2', 'armv7a' ] |
48 GLOBAL_DATA_FILE = TOOL_DIR + "global_data.xml" |
51 tool_chain = ['gcc','gcce','rvct'] |
49 tool_chain = ['gcc','gcce','rvct'] |
52 sdk_version = [ '5.0','5.1','5.2','sf1','sf2'] |
50 |
|
51 DATA_VERSION = '' |
|
52 ALL_HEADER_SET = '' |
|
53 sdk_version = [] |
|
54 s60_build_targets = [] |
|
55 sys_includes = {} |
|
56 |
|
57 doc = xml.dom.minidom.parse(GLOBAL_DATA_FILE) |
|
58 |
|
59 #data version denotes compatibility between the tool and carbide plugin |
|
60 #Read dataversion from global_data.xml |
|
61 DATA_VERSION = doc.getElementsByTagName("dataversion")[0].childNodes[0].data |
|
62 |
|
63 #Read supported filetypes in header analyser from global_data.xml |
|
64 for filetype in doc.getElementsByTagName("filetypes")[0].getElementsByTagName("type"): |
|
65 if ALL_HEADER_SET != '': |
|
66 ALL_HEADER_SET += ';' |
|
67 ALL_HEADER_SET += filetype.childNodes[0].data |
|
68 |
|
69 #Read supported sdk versions from global_data.xml |
|
70 for version in doc.getElementsByTagName("supportedversions")[0].getElementsByTagName("version"): |
|
71 sdk_version.append(version.childNodes[0].data) |
|
72 |
|
73 #Read supported build targets from global_data.xml |
|
74 for buildtarget in doc.getElementsByTagName("buildtargets")[0].getElementsByTagName("target"): |
|
75 s60_build_targets.append(buildtarget.childNodes[0].data) |
|
76 |
|
77 #Read system include paths for supported sdk versions from global_data.xml |
|
78 for node in doc.getElementsByTagName("sys_includes"): |
|
79 ver = node.getAttribute("version") |
|
80 includes = [] |
|
81 for inc in node.getElementsByTagName("inc"): |
|
82 includes.append(inc.childNodes[0].data) |
|
83 sys_includes[ver] = includes |
53 |
84 |
54 #dictionary elements which hold the platform data(CDS) and forced header(symbian macros) information |
85 #dictionary elements which hold the platform data(CDS) and forced header(symbian macros) information |
55 #these are available only when the \data and \bin folders respectively are avaliable |
86 #these are available only when the \data and \bin folders respectively are avaliable |
56 if os.path.exists( DATA_PATH ): |
87 if os.path.exists( DATA_PATH ): |
57 platformdata = { |
88 platformdata = { |
|
89 "3.0": DATA_PATH + "s60_platform_data_30.xml", |
|
90 "3.1": DATA_PATH + "s60_platform_data_31.xml", |
|
91 "3.2": DATA_PATH + "s60_platform_data_32.xml", |
58 "5.0": DATA_PATH + "s60_platform_data_50.xml", |
92 "5.0": DATA_PATH + "s60_platform_data_50.xml", |
59 "5.1": DATA_PATH + "s60_platform_data_51.xml", |
93 "5.1": DATA_PATH + "s60_platform_data_51.xml", |
60 "5.2": DATA_PATH + "s60_platform_data_52.xml", |
94 "5.2": DATA_PATH + "s60_platform_data_52.xml", |
61 "SF1": DATA_PATH + "s60_platform_data_51.xml", |
95 "SF1": DATA_PATH + "s60_platform_data_51.xml", |
62 "SF2": DATA_PATH + "s60_platform_data_52.xml" |
96 "SF2": DATA_PATH + "s60_platform_data_52.xml" |
64 else: |
98 else: |
65 platformdata = {} |
99 platformdata = {} |
66 |
100 |
67 if os.path.exists( EXEC_PATH ): |
101 if os.path.exists( EXEC_PATH ): |
68 forcedheadersdata = { |
102 forcedheadersdata = { |
|
103 "3.0": EXEC_PATH + "forced_9.1.h", |
|
104 "3.1": EXEC_PATH + "forced_9.2.h", |
|
105 "3.2": EXEC_PATH + "forced_9.3.h", |
69 "5.0": EXEC_PATH + "forced_9.4.h", |
106 "5.0": EXEC_PATH + "forced_9.4.h", |
70 "5.0v2": EXEC_PATH + "forced_9.4v2.h", |
107 "5.0v2": EXEC_PATH + "forced_9.4v2.h", |
71 "5.1": EXEC_PATH + "forced_9.4v2.h", |
108 "5.1": EXEC_PATH + "forced_9.4v2.h", |
72 "5.2": EXEC_PATH + "forced_9.4v2.h", |
109 "5.2": EXEC_PATH + "forced_9.4v2.h", |
73 "SF1": EXEC_PATH + "forced_9.4v2.h", |
110 "SF1": EXEC_PATH + "forced_9.4v2.h", |
76 else: |
113 else: |
77 forcedheadersdata = {} |
114 forcedheadersdata = {} |
78 |
115 |
79 if os.path.exists( DATA_PATH ): |
116 if os.path.exists( DATA_PATH ): |
80 dllXMLdata = { |
117 dllXMLdata = { |
|
118 "3.0": DATA_PATH + "s60_dll_data_30.xml", |
|
119 "3.1": DATA_PATH + "s60_dll_data_31.xml", |
|
120 "3.2": DATA_PATH + "s60_dll_data_32.xml", |
81 "5.0": DATA_PATH + "s60_dll_data_50.xml", |
121 "5.0": DATA_PATH + "s60_dll_data_50.xml", |
82 "5.1": DATA_PATH + "s60_dll_data_51.xml", |
122 "5.1": DATA_PATH + "s60_dll_data_51.xml", |
83 "5.2": DATA_PATH + "s60_dll_data_52.xml", |
123 "5.2": DATA_PATH + "s60_dll_data_52.xml", |
84 "SF1": DATA_PATH + "s60_dll_data_51.xml", |
124 "SF1": DATA_PATH + "s60_dll_data_51.xml", |
85 "SF2": DATA_PATH + "s60_dll_data_52.xml" |
125 "SF2": DATA_PATH + "s60_dll_data_52.xml" |
86 } |
126 } |
87 else: |
127 else: |
88 dllXMLdata = {} |
128 dllXMLdata = {} |
89 |
|
90 #Lists to hold platform dependant system include paths |
|
91 sys_hdr_30 = [ '', 'libc', 'oem', 'ecom' ] |
|
92 |
|
93 sys_hdr_32 = ['middleware', 'domain'+ os.sep +'middleware', 'osextensions', 'domain'+ os.sep +'osextensions', 'applications', 'domain'+ os.sep +'applications'] |
|
94 sys_hdr_32.extend(sys_hdr_30) |
|
95 |
|
96 sys_hdr_50 = ['domain'+ os.sep +'middleware'+ os.sep + 'loc', 'domain'+ os.sep +'osextensions'+ os.sep +'loc', 'domain'+ os.sep +'applications' + os.sep + 'loc', |
|
97 'domain'+ os.sep +'middleware'+ os.sep +'loc'+ os.sep +'sc', 'domain'+ os.sep +'osextensions'+ os.sep +'loc'+ os.sep +'sc', |
|
98 'domain'+ os.sep +'applications'+ os.sep +'loc'+ os.sep +'sc'] |
|
99 sys_hdr_50.extend(sys_hdr_30) |
|
100 sys_hdr_50.extend(sys_hdr_32) |
|
101 |
|
102 sys_hdr_51 = ['mw', 'platform'+ os.sep + 'mw', 'platform', 'app','platform'+ os.sep + 'app', 'platform'+ os.sep + 'loc', 'platform'+ os.sep + 'mw' + os.sep + 'loc', |
|
103 'platform'+ os.sep + 'app' + os.sep + 'loc', 'platform'+ os.sep + 'loc' + os.sep + 'sc', 'platform'+ os.sep + 'mw' + os.sep + 'loc' + os.sep +'sc', |
|
104 'platform'+ os.sep + 'app' + os.sep + 'loc' + os.sep +'sc'] |
|
105 sys_hdr_51.extend(sys_hdr_50) |
|
106 |
|
107 sys_includes = { |
|
108 "5.0": sys_hdr_50, |
|
109 "5.1": sys_hdr_51, |
|
110 "5.2": sys_hdr_51, |
|
111 "SF1": sys_hdr_51, |
|
112 "SF2": sys_hdr_51 |
|
113 } |
|
114 |
129 |
115 #set of binaries in the Core tools set, this is windows specific, to be added for linux support |
130 #set of binaries in the Core tools set, this is windows specific, to be added for linux support |
116 if os.name == 'nt': |
131 if os.name == 'nt': |
117 HA_SET = [ EXEC_PATH+"ha.exe", EXEC_PATH+"ha_gccxml_cc1plus.exe", EXEC_PATH+"libxerces-c2_7_0.dll" ] |
132 HA_SET = [ EXEC_PATH+"ha.exe", EXEC_PATH+"ha_gccxml_cc1plus.exe", EXEC_PATH+"libxerces-c2_7_0.dll" ] |
118 LA_SET = [ EXEC_PATH+"la.exe", EXEC_PATH+"cfilt.exe" ] |
133 LA_SET = [ EXEC_PATH+"la.exe", EXEC_PATH+"cfilt.exe" ] |
124 |
139 |
125 #Default report paths |
140 #Default report paths |
126 HEADER_REPORT = "Headers_CompatibilityReport" |
141 HEADER_REPORT = "Headers_CompatibilityReport" |
127 LIBRARY_REPORT = "Libraries_CompatibilityReport" |
142 LIBRARY_REPORT = "Libraries_CompatibilityReport" |
128 |
143 |
129 #-------------------------Global Definitions------------------------------------------ |
|
130 #defines set of file types analysed supported in header analyser |
|
131 ALL_HEADER_SET = '*.h;*.hrh;*.mbg;*.rsg;*.pan;*.hpp;*.rh' |
|
132 #true if checkbc is called from carbide plugin, |
144 #true if checkbc is called from carbide plugin, |
133 #this make additional info available to STDOUT and STDEERR |
145 #this make additional info available to STDOUT and STDEERR |
134 CARBIDE_PLUGIN = False |
146 CARBIDE_PLUGIN = False |
135 #-------------------------Error Handling-------------------------------------------- |
147 #-------------------------Error Handling-------------------------------------------- |
136 #exhults with a environment error when the installed python version is unsupported |
148 #exhults with a environment error when the installed python version is unsupported |
578 if not getdata( ip_data, "BASELINE_SDK_DIR"): |
590 if not getdata( ip_data, "BASELINE_SDK_DIR"): |
579 raise InputError(["confMP", "baseline importlib directory missing" + os.linesep, False]) |
591 raise InputError(["confMP", "baseline importlib directory missing" + os.linesep, False]) |
580 if not getdata( ip_data, "CURRENT_SDK_DIR"): |
592 if not getdata( ip_data, "CURRENT_SDK_DIR"): |
581 raise InputError(["confMP", "current importlib directory missing" + os.linesep, False]) |
593 raise InputError(["confMP", "current importlib directory missing" + os.linesep, False]) |
582 |
594 |
583 self.args["TEMP"] = ["-temp", quotep( ip_data["TEMP"] )] |
595 self.args["TEMP"] = ["-temp", quotep( ip_data["TEMP"] )] |
584 |
|
585 if getdata( ip_data, "BASELINE_BUILDTYPE"): |
|
586 validateBulidType(ip_data["BASELINE_BUILDTYPE"],True) |
|
587 basebldtype = ip_data["BASELINE_BUILDTYPE"] |
|
588 else: |
|
589 basebldtype = 'urel' |
|
590 |
|
591 if getdata( ip_data, "CURRENT_BUILDTYPE"): |
|
592 validateBulidType(ip_data["CURRENT_BUILDTYPE"],False) |
|
593 curbldtype = ip_data["CURRENT_BUILDTYPE"] |
|
594 else: |
|
595 curbldtype = 'urel' |
|
596 |
|
597 if basebldtype == "" and curbldtype == "": |
|
598 basebldtype = 'urel' |
|
599 curbldtype = 'urel' |
|
600 else: |
|
601 if basebldtype == "": |
|
602 basebldtype = curbldtype |
|
603 else: |
|
604 curbldtype = basebldtype |
|
605 |
596 |
606 if getdata( dllXMLdata, ip_data["BASELINE_SDK_S60_VERSION"] ): |
597 if getdata( dllXMLdata, ip_data["BASELINE_SDK_S60_VERSION"] ): |
607 baseDlldata = dllXMLdata[ip_data["BASELINE_SDK_S60_VERSION"]] |
598 baseDlldata = dllXMLdata[ip_data["BASELINE_SDK_S60_VERSION"]] |
608 if getdata( dllXMLdata, ip_data["CURRENT_SDK_S60_VERSION"] ): |
599 if getdata( dllXMLdata, ip_data["CURRENT_SDK_S60_VERSION"] ): |
609 currDlldata = dllXMLdata[ip_data["CURRENT_SDK_S60_VERSION"]] |
600 currDlldata = dllXMLdata[ip_data["CURRENT_SDK_S60_VERSION"]] |
610 |
601 |
611 dbasebuild = GetBuildTarget(ip_data["BASELINE_SDK_DIR"],validate(baseDlldata),ip_data["TEMP"],basebldtype) |
602 dbasebuild = GetBuildTarget(ip_data["BASELINE_SDK_DIR"],validate(baseDlldata),ip_data["TEMP"]) |
612 dcurrentbuild = GetBuildTarget(ip_data["CURRENT_SDK_DIR"],validate(currDlldata),ip_data["TEMP"],curbldtype) |
603 dcurrentbuild = GetBuildTarget(ip_data["CURRENT_SDK_DIR"],validate(currDlldata),ip_data["TEMP"]) |
613 |
604 |
614 if getdata( ip_data, "BASELINE_BUILDTARGET"): |
605 if getdata( ip_data, "BASELINE_BUILDTARGET"): |
615 basebuild = ip_data["BASELINE_BUILDTARGET"] |
606 basebuild = ip_data["BASELINE_BUILDTARGET"] |
616 else: |
607 else: |
617 basebuild = dbasebuild |
608 basebuild = dbasebuild |
660 if dbasebuild == "": |
651 if dbasebuild == "": |
661 dllBasetmp.append(baseDlldata) |
652 dllBasetmp.append(baseDlldata) |
662 else: |
653 else: |
663 for target in basebuild.split(';'): |
654 for target in basebuild.split(';'): |
664 if(ip_data["BASELINE_SDK_DIR"] == os.sep): |
655 if(ip_data["BASELINE_SDK_DIR"] == os.sep): |
665 dllBasetmp.append(os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + basebldtype) |
656 dllBasetmp.append(os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + 'urel') |
666 else: |
657 else: |
667 dllBasetmp.append(ip_data["BASELINE_SDK_DIR"] + os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + basebldtype) |
658 dllBasetmp.append(ip_data["BASELINE_SDK_DIR"] + os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + 'urel') |
668 |
659 |
669 if getdata( ip_data, "BASELINE_IMPORTDLLS"): |
660 if getdata( ip_data, "BASELINE_IMPORTDLLS"): |
670 if(ip_data["BASELINE_IMPORTDLLS"] == os.sep): |
661 if(ip_data["BASELINE_IMPORTDLLS"] == os.sep): |
671 for path in dllBasetmp: |
662 for path in dllBasetmp: |
672 dlltmp.append(validate(path)) |
663 dlltmp.append(validate(path)) |
716 if dcurrentbuild == "": |
707 if dcurrentbuild == "": |
717 dllCurrtmp.append(currDlldata) |
708 dllCurrtmp.append(currDlldata) |
718 else: |
709 else: |
719 for target in currentbuild.split(';'): |
710 for target in currentbuild.split(';'): |
720 if(ip_data["CURRENT_SDK_DIR"] == os.sep): |
711 if(ip_data["CURRENT_SDK_DIR"] == os.sep): |
721 dllCurrtmp.append(os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + curbldtype) |
712 dllCurrtmp.append(os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + 'urel') |
722 else: |
713 else: |
723 dllCurrtmp.append(ip_data["CURRENT_SDK_DIR"] + os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + curbldtype) |
714 dllCurrtmp.append(ip_data["CURRENT_SDK_DIR"] + os.sep + 'epoc32' + os.sep + 'release' + os.sep + target + os.sep + 'urel') |
724 |
715 |
725 if getdata( ip_data, "CURRENT_IMPORTDLLS"): |
716 if getdata( ip_data, "CURRENT_IMPORTDLLS"): |
726 if(ip_data["CURRENT_IMPORTDLLS"] == os.sep): |
717 if(ip_data["CURRENT_IMPORTDLLS"] == os.sep): |
727 for target in dllCurrtmp: |
718 for target in dllCurrtmp: |
728 dlltmp.append(validate(target)) |
719 dlltmp.append(validate(target)) |
1128 if '' != mydict[key]: |
1119 if '' != mydict[key]: |
1129 return mydict[key] |
1120 return mydict[key] |
1130 return '' |
1121 return '' |
1131 |
1122 |
1132 #return default build target from Rnd SDK and "" from Public SDK |
1123 #return default build target from Rnd SDK and "" from Public SDK |
1133 def GetBuildTarget(sdk,dlldata,temp_path,bld_type): |
1124 def GetBuildTarget(sdk,dlldata,temp_path): |
1134 bldtarget = "" |
1125 bldtarget = "" |
1135 path = "" |
1126 path = "" |
1136 xmlFile = open (dlldata); |
1127 xmlFile = open (dlldata); |
1137 dllcases = xmlFile.readlines() |
1128 dllcases = xmlFile.readlines() |
1138 xmlFile.close() |
1129 xmlFile.close() |
1139 |
1130 |
1140 dll_file = temp_path + os.sep + "dll.txt" |
1131 dll_file = temp_path + os.sep + "dll.txt" |
1141 dir_err_file = temp_path + os.sep + "dir_err.txt" |
1132 dir_err_file = temp_path + os.sep + "dir_err.txt" |
|
1133 |
1142 for target in s60_build_targets: |
1134 for target in s60_build_targets: |
1143 if sdk == os.sep: |
1135 if sdk == os.sep: |
1144 path = quote(os.sep+'epoc32'+os.sep+'release'+os.sep+target+os.sep+bld_type+os.sep) |
1136 path = quote(os.sep+'epoc32'+os.sep+'release'+os.sep+target+os.sep+'urel'+os.sep) |
1145 else: |
1137 else: |
1146 path = quote(sdk+os.sep+'epoc32'+os.sep+'release'+os.sep+target+os.sep+bld_type+os.sep) |
1138 path = quote(validateTargetPath(sdk+os.sep+'epoc32'+os.sep+'release'+os.sep+target+os.sep+'urel')+os.sep) |
1147 if not os.path.exists(path): |
1139 if not os.path.exists(path): |
1148 pass |
1140 pass |
1149 |
1141 |
1150 if os.name =='nt': |
1142 if os.name =='nt': |
1151 cmd = "dir /b " + path + "*.dll > " + quote(dll_file) + " 2> " + quote (dir_err_file) |
1143 cmd = "dir /b " + path + "*.dll > " + quote(dll_file) + " 2> " + quote (dir_err_file) |
1206 if( baseline == True): |
1198 if( baseline == True): |
1207 raise InputError(["confIP", "BASELINE_BUILDTARGET\n", False]) |
1199 raise InputError(["confIP", "BASELINE_BUILDTARGET\n", False]) |
1208 else: |
1200 else: |
1209 raise InputError(["confIP", "CURRENT_BUILDTARGET\n", False]) |
1201 raise InputError(["confIP", "CURRENT_BUILDTARGET\n", False]) |
1210 |
1202 |
1211 def validateBulidType(buildtype,baseline): |
1203 def validateTargetPath(path): |
1212 bldTypelist = ['urel','udeb'] |
1204 if not os.path.exists(path): |
1213 found = False |
1205 tmp = os.path.abspath(path) |
1214 for i in bldTypelist: |
1206 path = tmp |
1215 if(i == buildtype.lower()): |
1207 return os.path.normpath(os.path.abspath(path)) |
1216 found = True |
|
1217 break |
|
1218 if found == False: |
|
1219 if( baseline == True): |
|
1220 raise InputError(["confIP", "BASELINE_BUILDTYPE\n", False]) |
|
1221 else: |
|
1222 raise InputError(["confIP", "CURRENT_BUILDTYPE\n", False]) |
|
1223 |
|
1224 |
|
1225 |
|
1226 |
|
1227 |
|
1228 |
|
1229 |
1208 |
1230 |
1209 |
1231 #---------------------------Other funcs--------------------------------------------- |
1210 #---------------------------Other funcs--------------------------------------------- |
1232 def getdataversion(): |
1211 def getdataversion(): |
1233 return DATA_VERSION |
1212 return DATA_VERSION |