Change-Id: I67561553c290595e63b5ce589a5e50ef1823181d
Reviewed-on: http://photon-jenkins.eng.vmware.com/91
Reviewed-by: Sharath George
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
| ... | ... |
@@ -180,6 +180,7 @@ packages: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTA |
| 180 | 180 |
$(PHOTON_PACKAGE_BUILDER) -o full \ |
| 181 | 181 |
-s $(PHOTON_SPECS_DIR) \ |
| 182 | 182 |
-r $(PHOTON_RPMS_DIR) \ |
| 183 |
+ -a $(PHOTON_SRPMS_DIR) \ |
|
| 183 | 184 |
-x $(PHOTON_SRCS_DIR) \ |
| 184 | 185 |
-b $(PHOTON_CHROOT_PATH) \ |
| 185 | 186 |
-l $(PHOTON_LOGS_DIR) \ |
| ... | ... |
@@ -215,6 +216,7 @@ tool-chain-stage1: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES |
| 215 | 215 |
$(PHOTON_PACKAGE_BUILDER) -o full \ |
| 216 | 216 |
-s $(PHOTON_SPECS_DIR) \ |
| 217 | 217 |
-r $(PHOTON_RPMS_DIR) \ |
| 218 |
+ -a $(PHOTON_SRPMS_DIR) \ |
|
| 218 | 219 |
-x $(PHOTON_SRCS_DIR) \ |
| 219 | 220 |
-b $(PHOTON_CHROOT_PATH) \ |
| 220 | 221 |
-l $(PHOTON_LOGS_DIR) \ |
| ... | ... |
@@ -233,6 +235,7 @@ tool-chain-stage2: check $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES |
| 233 | 233 |
$(PHOTON_PACKAGE_BUILDER) -o full \ |
| 234 | 234 |
-s $(PHOTON_SPECS_DIR) \ |
| 235 | 235 |
-r $(PHOTON_RPMS_DIR) \ |
| 236 |
+ -a $(PHOTON_SRPMS_DIR) \ |
|
| 236 | 237 |
-x $(PHOTON_SRCS_DIR) \ |
| 237 | 238 |
-b $(PHOTON_CHROOT_PATH) \ |
| 238 | 239 |
-l $(PHOTON_LOGS_DIR) \ |
| ... | ... |
@@ -280,6 +283,8 @@ $(PHOTON_STAGE): |
| 280 | 280 |
@echo "Building RPMS folders..." |
| 281 | 281 |
@test -d $(PHOTON_RPMS_DIR_NOARCH) || $(MKDIR) -p $(PHOTON_RPMS_DIR_NOARCH) |
| 282 | 282 |
@test -d $(PHOTON_RPMS_DIR_X86_64) || $(MKDIR) -p $(PHOTON_RPMS_DIR_X86_64) |
| 283 |
+ @echo "Building SRPMS folders..." |
|
| 284 |
+ @test -d $(PHOTON_SRPMS_DIR) || $(MKDIR) -p $(PHOTON_SRPMS_DIR) |
|
| 283 | 285 |
@echo "Building UPDATED_RPMS folders..." |
| 284 | 286 |
@test -d $(PHOTON_UPDATED_RPMS_DIR_NOARCH) || $(MKDIR) -p $(PHOTON_UPDATED_RPMS_DIR_NOARCH) |
| 285 | 287 |
@test -d $(PHOTON_UPDATED_RPMS_DIR_X86_64) || $(MKDIR) -p $(PHOTON_UPDATED_RPMS_DIR_X86_64) |
| ... | ... |
@@ -442,6 +447,7 @@ check-packer-ovf-plugin: |
| 442 | 442 |
-b $(PHOTON_CHROOT_PATH) \ |
| 443 | 443 |
-s $(PHOTON_SPECS_DIR) \ |
| 444 | 444 |
-r $(PHOTON_RPMS_DIR) \ |
| 445 |
+ -a $(PHOTON_SRPMS_DIR) \ |
|
| 445 | 446 |
-x $(PHOTON_SRCS_DIR) \ |
| 446 | 447 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
| 447 | 448 |
-c $(PHOTON_BINTRAY_CONFIG) \ |
| ... | ... |
@@ -21,6 +21,7 @@ MAKEROOT := $(realpath $(MAKEROOT)) |
| 21 | 21 |
PHOTON_STAGE?=$(SRCROOT)/stage |
| 22 | 22 |
PHOTON_LOGS_DIR=$(PHOTON_STAGE)/LOGS |
| 23 | 23 |
PHOTON_RPMS_DIR=$(PHOTON_STAGE)/RPMS |
| 24 |
+PHOTON_SRPMS_DIR=$(PHOTON_STAGE)/SRPMS |
|
| 24 | 25 |
PHOTON_UPDATED_RPMS_DIR?=$(PHOTON_STAGE)/UPDATED_RPMS |
| 25 | 26 |
PHOTON_SPECS_DIR?=$(SRCROOT)/SPECS |
| 26 | 27 |
PHOTON_COMMON_DIR?=$(SRCROOT)/common |
| ... | ... |
@@ -141,8 +141,9 @@ class PackageUtils(object): |
| 141 | 141 |
self.copySourcesTobuildroot(listPatchFiles,package,chrootSourcePath) |
| 142 | 142 |
|
| 143 | 143 |
listRPMFiles=[] |
| 144 |
+ listSRPMFiles=[] |
|
| 144 | 145 |
try: |
| 145 |
- listRPMFiles = self.buildRPM(chrootSpecPath+"/"+specName,chrootLogsFilePath, chrootCmd) |
|
| 146 |
+ listRPMFiles,listSRPMFiles = self.buildRPM(chrootSpecPath+"/"+specName,chrootLogsFilePath, chrootCmd) |
|
| 146 | 147 |
except Exception as e: |
| 147 | 148 |
self.logger.error("Failed while building rpm:"+package)
|
| 148 | 149 |
raise e |
| ... | ... |
@@ -153,6 +154,9 @@ class PackageUtils(object): |
| 153 | 153 |
for rpmFile in listRPMFiles: |
| 154 | 154 |
self.copyRPM(chrootID+"/"+rpmFile, constants.rpmPath) |
| 155 | 155 |
|
| 156 |
+ for srpmFile in listSRPMFiles: |
|
| 157 |
+ self.copyRPM(chrootID+"/"+srpmFile, constants.sourceRpmPath) |
|
| 158 |
+ |
|
| 156 | 159 |
def buildRPM(self,specFile,logFile,chrootCmd): |
| 157 | 160 |
|
| 158 | 161 |
rpmBuildcmd= self.rpmbuildBinary+" "+self.rpmbuildBuildallOption+" "+self.rpmbuildDistOption |
| ... | ... |
@@ -174,13 +178,15 @@ class PackageUtils(object): |
| 174 | 174 |
fileContents=logfile.readlines() |
| 175 | 175 |
logfile.close() |
| 176 | 176 |
listRPMFiles=[] |
| 177 |
+ listSRPMFiles=[] |
|
| 177 | 178 |
for i in range(0,len(fileContents)): |
| 178 | 179 |
if re.search("^Wrote:",fileContents[i]):
|
| 179 | 180 |
listcontents=fileContents[i].split() |
| 180 | 181 |
if (len(listcontents) == 2) and listcontents[1].strip()[-4:] == ".rpm" and listcontents[1].find("/RPMS/") != -1:
|
| 181 | 182 |
listRPMFiles.append(listcontents[1]) |
| 182 |
- |
|
| 183 |
- return listRPMFiles |
|
| 183 |
+ if (len(listcontents) == 2) and listcontents[1].strip()[-8:] == ".src.rpm" and listcontents[1].find("/SRPMS/") != -1:
|
|
| 184 |
+ listSRPMFiles.append(listcontents[1]) |
|
| 185 |
+ return listRPMFiles,listSRPMFiles |
|
| 184 | 186 |
|
| 185 | 187 |
def findRPMFileForGivenPackage(self,package): |
| 186 | 188 |
cmdUtils = CommandUtils() |
| ... | ... |
@@ -34,6 +34,7 @@ def main(): |
| 34 | 34 |
parser.add_option("-n", "--build-number", dest="buildNumber", default="0000000")
|
| 35 | 35 |
parser.add_option("-v", "--release-version", dest="releaseVersion", default="NNNnNNN")
|
| 36 | 36 |
parser.add_option("-u", "--enable-rpmcheck", dest="rpmCheck", default=False, action ="store_true")
|
| 37 |
+ parser.add_option("-a", "--source-rpm-path", dest="sourceRpmPath", default="../../stage/SRPMS")
|
|
| 37 | 38 |
|
| 38 | 39 |
(options, args) = parser.parse_args() |
| 39 | 40 |
cmdUtils=CommandUtils() |
| ... | ... |
@@ -83,6 +84,9 @@ def main(): |
| 83 | 83 |
if not os.path.isdir(options.rpmPath): |
| 84 | 84 |
cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/x86_64")
|
| 85 | 85 |
cmdUtils.runCommandInShell("mkdir -p "+options.rpmPath+"/noarch")
|
| 86 |
+ |
|
| 87 |
+ if not os.path.isdir(options.sourceRpmPath): |
|
| 88 |
+ cmdUtils.runCommandInShell("mkdir -p "+options.sourceRpmPath)
|
|
| 86 | 89 |
|
| 87 | 90 |
if not os.path.isdir(options.buildRootPath): |
| 88 | 91 |
cmdUtils.runCommandInShell("mkdir -p "+options.buildRootPath)
|
| ... | ... |
@@ -16,6 +16,7 @@ class constants(object): |
| 16 | 16 |
buildPatch=False |
| 17 | 17 |
inputRPMSPath="" |
| 18 | 18 |
rpmCheck=False |
| 19 |
+ sourceRpmPath="" |
|
| 19 | 20 |
noDepsPackageList=["texinfo","bzip2","gettext","man-db","nspr","xz","bison","openjdk","go"] |
| 20 | 21 |
listToolChainPackages=["linux-api-headers", "glibc","zlib", "file", |
| 21 | 22 |
"binutils","gmp","mpfr", "mpc","gcc", "pkg-config", "ncurses", "bash", "bzip2", "sed","procps-ng","coreutils", "m4","grep", |
| ... | ... |
@@ -60,6 +61,7 @@ class constants(object): |
| 60 | 60 |
constants.specPath = options.specPath |
| 61 | 61 |
constants.sourcePath = options.sourcePath |
| 62 | 62 |
constants.rpmPath = options.rpmPath |
| 63 |
+ constants.sourceRpmPath = options.sourceRpmPath |
|
| 63 | 64 |
constants.topDirPath = options.topDirPath |
| 64 | 65 |
constants.logPath = options.logPath |
| 65 | 66 |
constants.prevPublishRPMRepo=options.publishRPMSPath |