... | ... |
@@ -6,7 +6,6 @@ from CommandUtils import CommandUtils |
6 | 6 |
import os.path |
7 | 7 |
from constants import constants |
8 | 8 |
import shutil |
9 |
-from time import sleep |
|
10 | 9 |
|
11 | 10 |
class PackageBuilder(object): |
12 | 11 |
|
... | ... |
@@ -22,7 +21,6 @@ class PackageBuilder(object): |
22 | 22 |
self.listAvailableCyclicPackages = listAvailableCyclicPackages |
23 | 23 |
self.listNodepsPackages = ["glibc","gmp","zlib","file","binutils","mpfr","mpc","gcc","ncurses","util-linux","groff","perl","texinfo","rpm","openssl","go"] |
24 | 24 |
self.runInChrootCommand="./run-in-chroot.sh" |
25 |
- self.adjustGCCSpecScript="adjust-gcc-specs.sh" |
|
26 | 25 |
|
27 | 26 |
def prepareBuildRoot(self,chrootName,isToolChainPackage=False): |
28 | 27 |
chrootID=None |
... | ... |
@@ -100,8 +98,8 @@ class PackageBuilder(object): |
100 | 100 |
for pkg in listDependentPackages: |
101 | 101 |
self.installPackage(pkg,chrootID,destLogPath,listInstalledPackages) |
102 | 102 |
self.logger.info("Finished installing the build time dependent packages......") |
103 |
- self.adjustGCCSpecs(package, chrootID, destLogPath) |
|
104 | 103 |
pkgUtils = PackageUtils(self.logName,self.logPath) |
104 |
+ pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath) |
|
105 | 105 |
pkgUtils.buildRPMSForGivenPackage(package,chrootID,destLogPath) |
106 | 106 |
self.logger.info("Successfully built the package:"+package) |
107 | 107 |
except Exception as e: |
... | ... |
@@ -145,24 +143,3 @@ class PackageBuilder(object): |
145 | 145 |
if pkg in listInstalledPackages: |
146 | 146 |
continue |
147 | 147 |
self.installPackage(pkg,chrootID,destLogPath,listInstalledPackages) |
148 |
- |
|
149 |
- def adjustGCCSpecs(self, package, chrootID, logPath): |
|
150 |
- opt = " " + constants.specData.getSecurityHardeningOption(package) |
|
151 |
- shutil.copy2(self.adjustGCCSpecScript, chrootID+"/tmp/"+self.adjustGCCSpecScript) |
|
152 |
- cmdUtils=CommandUtils() |
|
153 |
- cmd = "/tmp/"+self.adjustGCCSpecScript+opt |
|
154 |
- logFile = logPath+"/adjustGCCSpecScript.log" |
|
155 |
- chrootCmd=self.runInChrootCommand+" "+chrootID |
|
156 |
- retryCount=10 |
|
157 |
- returnVal=False |
|
158 |
- while retryCount > 0: |
|
159 |
- returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd) |
|
160 |
- if returnVal: |
|
161 |
- return |
|
162 |
- self.logger.error("Failed while adjusting gcc specs") |
|
163 |
- self.logger.error("Retrying again .....") |
|
164 |
- retryCount = retryCount - 1 |
|
165 |
- sleep(5) |
|
166 |
- if not returnVal: |
|
167 |
- self.logger.error("Failed while adjusting gcc specs") |
|
168 |
- raise "Failed while adjusting gcc specs" |
... | ... |
@@ -4,7 +4,7 @@ import os |
4 | 4 |
import shutil |
5 | 5 |
from constants import constants |
6 | 6 |
import re |
7 |
- |
|
7 |
+from time import sleep |
|
8 | 8 |
|
9 | 9 |
class PackageUtils(object): |
10 | 10 |
|
... | ... |
@@ -26,6 +26,7 @@ class PackageUtils(object): |
26 | 26 |
self.rpmbuildNocheckOption = "--nocheck" |
27 | 27 |
self.queryRpmPackageOptions = "-qa" |
28 | 28 |
self.forceRpmPackageOptions = "--force" |
29 |
+ self.adjustGCCSpecScript="adjust-gcc-specs.sh" |
|
29 | 30 |
|
30 | 31 |
def getRPMDestDir(self,rpmName,rpmDir): |
31 | 32 |
arch="" |
... | ... |
@@ -174,3 +175,24 @@ class PackageUtils(object): |
174 | 174 |
cmdUtils=CommandUtils() |
175 | 175 |
result=cmdUtils.runCommandInShell2(cmd, chrootCmd) |
176 | 176 |
return result |
177 |
+ |
|
178 |
+ def adjustGCCSpecs(self, package, chrootID, logPath): |
|
179 |
+ opt = " " + constants.specData.getSecurityHardeningOption(package) |
|
180 |
+ shutil.copy2(self.adjustGCCSpecScript, chrootID+"/tmp/"+self.adjustGCCSpecScript) |
|
181 |
+ cmdUtils=CommandUtils() |
|
182 |
+ cmd = "/tmp/"+self.adjustGCCSpecScript+opt |
|
183 |
+ logFile = logPath+"/adjustGCCSpecScript.log" |
|
184 |
+ chrootCmd=self.runInChrootCommand+" "+chrootID |
|
185 |
+ retryCount=10 |
|
186 |
+ returnVal=False |
|
187 |
+ while retryCount > 0: |
|
188 |
+ returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd) |
|
189 |
+ if returnVal: |
|
190 |
+ return |
|
191 |
+ self.logger.error("Failed while adjusting gcc specs") |
|
192 |
+ self.logger.error("Retrying again .....") |
|
193 |
+ retryCount = retryCount - 1 |
|
194 |
+ sleep(5) |
|
195 |
+ if not returnVal: |
|
196 |
+ self.logger.error("Failed while adjusting gcc specs") |
|
197 |
+ raise "Failed while adjusting gcc specs" |
... | ... |
@@ -126,6 +126,7 @@ class ToolChainUtils(object): |
126 | 126 |
self.logger.error("Creating chroot failed") |
127 | 127 |
raise Exception("creating chroot failed") |
128 | 128 |
self.installToolChainRPMS(chrootID) |
129 |
+ pkgUtils.adjustGCCSpecs(package, chrootID, destLogPath) |
|
129 | 130 |
pkgUtils.buildRPMSForGivenPackage(package, chrootID,destLogPath) |
130 | 131 |
chrUtils.destroyChroot(chrootID) |
131 | 132 |
chrootID=None |