Browse code

Fix the bug that Binutils 2.25 can't work with GCC 6.3

Change-Id: I5d2a15235d92ada411359fcd71f3c08498ca000b
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/3484
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Harish Udaiya Kumar <harishspqr@gmail.com>

Rui Gu authored on 2017/08/11 06:38:49
Showing 1 changed files
... ...
@@ -9,7 +9,7 @@ import traceback
9 9
 import shutil
10 10
 
11 11
 class ToolChainUtils(object):
12
-    
12
+
13 13
     def __init__(self,logName=None,logPath=None):
14 14
         if logName is None:
15 15
             logName = "Toolchain Utils"
... ...
@@ -45,7 +45,7 @@ class ToolChainUtils(object):
45 45
         cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/LOGS")
46 46
         cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILD")
47 47
         cmdUtils.runCommandInShell("mkdir -p "+chrootID+constants.topDirPath+"/BUILDROOT")
48
-        
48
+
49 49
         prepareChrootCmd=self.prepareBuildRootCmd+" "+chrootID
50 50
         logFile=constants.logPath+"/prepareBuildRoot.log"
51 51
         returnVal=cmdUtils.runCommandInShell(prepareChrootCmd,logFile)
... ...
@@ -72,7 +72,7 @@ class ToolChainUtils(object):
72 72
         if len(listFilterRPMFiles) > 1 :
73 73
             self.logger.error("Found multiple rpm files for given package in rpm directory.Unable to determine the rpm file for package:"+package)
74 74
             return None
75
-    
75
+
76 76
     def buildCoreToolChainPackages(self, listBuildOptionPackages, pkgBuildOptionFile):
77 77
         self.logger.info("Building core tool chain packages.....")
78 78
         chrootID=None
... ...
@@ -105,7 +105,7 @@ class ToolChainUtils(object):
105 105
             # print stacktrace
106 106
             traceback.print_exc()
107 107
             raise e
108
-                
108
+
109 109
     def installToolChainRPMS(self,chrootID, packageName):
110 110
         cmdUtils = CommandUtils()
111 111
         self.prepareBuildRoot(chrootID)
... ...
@@ -114,7 +114,10 @@ class ToolChainUtils(object):
114 114
         packages = ""
115 115
         for package in constants.listToolChainRPMsToInstall:
116 116
             pkgUtils=PackageUtils(self.logName,self.logPath)
117
-            rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
117
+            rpmFile = None
118
+            if (packageName not in constants.listToolChainRPMsToInstall or
119
+                    constants.listToolChainRPMsToInstall.index(packageName) > constants.listToolChainRPMsToInstall.index(package)):
120
+                rpmFile=pkgUtils.findRPMFileForGivenPackage(package)
118 121
             if rpmFile is None:
119 122
                 # sqlite-autoconf package was renamed, but it still published as sqlite-autoconf
120 123
                 if package == "sqlite":
... ...
@@ -138,7 +141,7 @@ class ToolChainUtils(object):
138 138
             raise Exception("RPM installation failed")
139 139
         self.logger.info("Successfully installed default Tool Chain RPMS in Chroot:"+chrootID)
140 140
         print "Building Package:"+ packageName
141
-	print constants.perPackageToolChain
141
+        print constants.perPackageToolChain
142 142
         if packageName in constants.perPackageToolChain:
143 143
             print constants.perPackageToolChain[packageName]
144 144
             self.installCustomToolChainRPMS(chrootID, constants.perPackageToolChain[packageName], packageName);
... ...
@@ -149,7 +152,7 @@ class ToolChainUtils(object):
149 149
         packages = ""
150 150
         for package in listOfToolChainPkgs:
151 151
             pkgUtils=PackageUtils(self.logName,self.logPath)
152
-	    print "DEBUG:" + package
152
+            print "DEBUG:" + package
153 153
             if "openjre8" in packageName or "openjdk8" in packageName:
154 154
                 rpmFile=self.findRPMFileInGivenLocation(package, constants.prevPublishXRPMRepo)
155 155
             else:
... ...
@@ -161,8 +164,8 @@ class ToolChainUtils(object):
161 161
             packages += " " + package
162 162
 
163 163
         self.logger.debug("Installing rpms:"+packages)
164
-	cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
165
-	print "Command Executed:" + cmd 
164
+        cmd=self.rpmCommand + " -i --nodeps --force --root "+chrootID+" --define \'_dbpath /var/lib/rpm\' "+ rpmFiles
165
+        print "Command Executed:" + cmd
166 166
         process = subprocess.Popen("%s" %cmd,shell=True,stdout=subprocess.PIPE)
167 167
         retval = process.wait()
168 168
         if retval != 0: