Change-Id: Ie73064f618fec09a6c10838ee661579507307ff4
Reviewed-on: http://photon-jenkins.eng.vmware.com/604
Tested-by: jenkins-photon <wangnan2015@hotmail.com>
Reviewed-by: suezzelur <anishs@vmware.com>
... | ... |
@@ -184,24 +184,29 @@ def buildSourcesList(specPath, yamlDir, singleFile=False): |
184 | 184 |
if os.path.isfile(specFile) and specFile.endswith(".spec"): |
185 | 185 |
spec=Specutils(specFile) |
186 | 186 |
modified = len(spec.getPatchNames()) > 0 |
187 |
- ss=spec.getSourceURLs() |
|
188 |
- for s in ss: |
|
189 |
- if (s.startswith("http") or s.startswith("ftp")): |
|
190 |
- ossname=strUtils.getPackageNameFromURL(s) |
|
191 |
- ossversion=strUtils.getPackageVersionFromURL(s) |
|
192 |
- if not singleFile: |
|
193 |
- yamlFile = open(yamlDir+ossname+"-"+ossversion+".yaml", "w") |
|
194 |
- yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n") |
|
195 |
- yamlFile.write(" repository: VMWsource\n") |
|
196 |
- yamlFile.write(" name: '"+ossname+"'\n") |
|
197 |
- yamlFile.write(" version: '"+ossversion+"'\n") |
|
198 |
- yamlFile.write(" url: "+s+"\n") |
|
199 |
- yamlFile.write(" license: UNKNOWN\n") |
|
200 |
- if modified: |
|
201 |
- yamlFile.write(" modified: true\n") |
|
202 |
- yamlFile.write("\n") |
|
203 |
- if not singleFile: |
|
204 |
- yamlFile.close() |
|
187 |
+ listSourceURLs=spec.getSourceURLs() |
|
188 |
+ ossname = spec.getBasePackageName() |
|
189 |
+ ossversion = spec.getVersion() |
|
190 |
+ url = None |
|
191 |
+ if len(listSourceURLs) > 0: |
|
192 |
+ sourceURL = listSourceURLs[0] |
|
193 |
+ if sourceURL.startswith("http") or sourceURL.startswith("ftp"): |
|
194 |
+ url = sourceURL; |
|
195 |
+ else: |
|
196 |
+ url=spec.getURL(ossname) |
|
197 |
+ if not singleFile: |
|
198 |
+ yamlFile = open(yamlDir+ossname+"-"+ossversion+".yaml", "w") |
|
199 |
+ yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n") |
|
200 |
+ yamlFile.write(" repository: VMWsource\n") |
|
201 |
+ yamlFile.write(" name: '"+ossname+"'\n") |
|
202 |
+ yamlFile.write(" version: '"+ossversion+"'\n") |
|
203 |
+ yamlFile.write(" url: "+str(url)+"\n") |
|
204 |
+ yamlFile.write(" license: UNKNOWN\n") |
|
205 |
+ if modified: |
|
206 |
+ yamlFile.write(" modified: true\n") |
|
207 |
+ yamlFile.write("\n") |
|
208 |
+ if not singleFile: |
|
209 |
+ yamlFile.close() |
|
205 | 210 |
if singleFile: |
206 | 211 |
yamlFile.close() |
207 | 212 |
|