Change-Id: I07b508491850a483eee1d63fa870ab40d9d87276
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5918
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Tested-by: gerrit-photon <photon-checkins@vmware.com>
... | ... |
@@ -567,6 +567,7 @@ generate-yaml-files: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
567 | 567 |
-s $(PHOTON_SPECS_DIR) \ |
568 | 568 |
-a $(PHOTON_SRPMS_DIR) \ |
569 | 569 |
-l $(PHOTON_LOGS_DIR) \ |
570 |
+ -d $(PHOTON_DIST_TAG) \ |
|
570 | 571 |
-z $(LOGLEVEL) \ |
571 | 572 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
572 | 573 |
-f $(PHOTON_PKG_BLACKLIST_FILE) |
... | ... |
@@ -33,6 +33,8 @@ def main(): |
33 | 33 |
default=False, action="store_true") |
34 | 34 |
parser.add_argument("-y", "--generate-yaml-files", dest="generateYamlFiles", |
35 | 35 |
default=False, action="store_true") |
36 |
+ parser.add_argument("-d", "--dist", dest="dist", |
|
37 |
+ default="") |
|
36 | 38 |
|
37 | 39 |
options = parser.parse_args() |
38 | 40 |
errorFlag = False |
... | ... |
@@ -65,6 +67,10 @@ def main(): |
65 | 65 |
+ options.pullsourcesConfig) |
66 | 66 |
errorFlag = True |
67 | 67 |
|
68 |
+ if options.dist: |
|
69 |
+ dist_tag = options.dist |
|
70 |
+ logger.info("release tag is %s" % (dist_tag)) |
|
71 |
+ |
|
68 | 72 |
if errorFlag: |
69 | 73 |
logger.error("Found some errors. Please fix input options and re-run it.") |
70 | 74 |
sys.exit(1) |
... | ... |
@@ -88,7 +94,7 @@ def main(): |
88 | 88 |
elif options.generateYamlFiles: |
89 | 89 |
blackListPkgs = readBlackListPackages(options.pkgBlacklistFile) |
90 | 90 |
buildSourcesList(options.outputDirPath, blackListPkgs, logger) |
91 |
- buildSRPMList(options.sourceRpmPath, options.outputDirPath, blackListPkgs, logger) |
|
91 |
+ buildSRPMList(options.sourceRpmPath, options.outputDirPath, blackListPkgs, dist_tag, logger) |
|
92 | 92 |
|
93 | 93 |
except Exception as e: |
94 | 94 |
print("Caught Exception: " + str(e)) |
... | ... |
@@ -166,7 +172,7 @@ def buildSourcesList(yamlDir, blackListPkgs, logger, singleFile=True): |
166 | 166 |
yamlFile.write("vmwsource:" + ossname + ":" + version + ":\n") |
167 | 167 |
yamlFile.write(" repository: VMWsource\n") |
168 | 168 |
yamlFile.write(" name: '" + ossname + "'\n") |
169 |
- yamlFile.write(" version: '" + ossversion + "'\n") |
|
169 |
+ yamlFile.write(" version: '" + version + "'\n") |
|
170 | 170 |
yamlFile.write(" url: " + str(url) + "\n") |
171 | 171 |
yamlFile.write(" license: UNKNOWN\n") |
172 | 172 |
if sourceName is not None: |
... | ... |
@@ -182,7 +188,7 @@ def buildSourcesList(yamlDir, blackListPkgs, logger, singleFile=True): |
182 | 182 |
logger.debug("Generated source yaml files for all packages") |
183 | 183 |
|
184 | 184 |
|
185 |
-def buildSRPMList(srpmPath, yamlDir, blackListPkgs, logger, singleFile=True): |
|
185 |
+def buildSRPMList(srpmPath, yamlDir, blackListPkgs, dist_tag, logger, singleFile=True): |
|
186 | 186 |
cmdUtils = CommandUtils() |
187 | 187 |
yamlSrpmDir = os.path.join(yamlDir, "yaml_srpms") |
188 | 188 |
if not os.path.isdir(yamlSrpmDir): |
... | ... |
@@ -197,10 +203,10 @@ def buildSRPMList(srpmPath, yamlDir, blackListPkgs, logger, singleFile=True): |
197 | 197 |
ossname = package |
198 | 198 |
for ossversion in SPECS.getData().getVersions(package): |
199 | 199 |
ossrelease = SPECS.getData().getRelease(package, ossversion) |
200 |
+ srpm_file_name = "%s-%s-%s%s.src.rpm" % (ossname, ossversion, ossrelease, dist_tag) |
|
201 |
+ logger.info("srpm name is %s" % (srpm_file_name)) |
|
202 |
+ listFoundSRPMFiles = cmdUtils.findFile(srpm_file_name, srpmPath) |
|
200 | 203 |
|
201 |
- listFoundSRPMFiles = cmdUtils.findFile(ossname + "-" + ossversion + "-" + ossrelease |
|
202 |
- + ".src.rpm", |
|
203 |
- srpmPath) |
|
204 | 204 |
srpmName = None |
205 | 205 |
if len(listFoundSRPMFiles) == 1: |
206 | 206 |
srpmFullPath = listFoundSRPMFiles[0] |