def buildPackagesList(specPath, csvFilename): csvFile = open(csvFilename, "w") csvFile.write("Package,Version,License,URL,Sources,Patches\n") lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec = Specutils(specFile) name = spec.getBasePackageName() version = spec.getRPMVersion(name) license = spec.getLicense(name) url = spec.getURL(name) ss = spec.getSourceURLs() sources = "" for s in ss: if (s.startswith("http") or s.startswith("ftp")): if sources != "": sources += " " sources += s patches = "" ps = spec.getPatchNames() for p in ps: if patches != "": patches += " " patches += p csvFile.write(name + "," + version + "," + license + "," + url + "," + sources + "," + patches + "\n") csvFile.close()
def buildPackagesList(specPath, csvFilename): csvFile = open(csvFilename, "w") csvFile.write("Package,Version,License,URL,Sources,Patches\n") lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec=Specutils(specFile) name=spec.getBasePackageName() version=spec.getRPMVersion(name) license=spec.getLicense(name) url=spec.getURL(name) ss=spec.getSourceURLs() sources="" for s in ss: if (s.startswith("http") or s.startswith("ftp")): if sources != "": sources += " " sources += s patches="" ps=spec.getPatchNames() for p in ps: if patches != "": patches += " " patches += p csvFile.write(name+","+version+","+license+","+url+","+sources+","+patches+"\n") csvFile.close()
def buildSourcesList(specPath, yamlDir, singleFile=False): strUtils = StringUtils() if singleFile: yamlFile = open(yamlDir+"sources_list.yaml", "w") lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec=Specutils(specFile) modified = len(spec.getPatchNames()) > 0 ss=spec.getSourceURLs() for s in ss: if (s.startswith("http") or s.startswith("ftp")): ossname=strUtils.getPackageNameFromURL(s) ossversion=strUtils.getPackageVersionFromURL(s) if not singleFile: yamlFile = open(yamlDir+ossname+"-"+ossversion+".yaml", "w") yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n") yamlFile.write(" repository: VMWsource\n") yamlFile.write(" name: '"+ossname+"'\n") yamlFile.write(" version: '"+ossversion+"'\n") yamlFile.write(" url: "+s+"\n") yamlFile.write(" license: UNKNOWN\n") if modified: yamlFile.write(" modified: true\n") yamlFile.write("\n") if not singleFile: yamlFile.close() if singleFile: yamlFile.close()
def buildSourcesList(specPath, sourcePath, yamlDir, logger, singleFile=True): strUtils = StringUtils() if singleFile: yamlFile = open(yamlDir + "sources_list.yaml", "w") lst = os.listdir(specPath) lst.sort() import PullSources for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec = Specutils(specFile) modified = len(spec.getPatchNames()) > 0 listSourceURLs = spec.getSourceURLs() ossname = spec.getBasePackageName() ossversion = spec.getVersion() url = None listSourceNames = spec.getSourceNames() sourceName = None if len(listSourceNames) > 0: sourceName = listSourceNames[0] sha1 = spec.getChecksumForSource(sourceName) if sha1 is not None: PullSources.get(sourceName, sha1, sourcePath, constants.pullsourcesConfig) if len(listSourceURLs) > 0: sourceURL = listSourceURLs[0] if sourceURL.startswith( "http") or sourceURL.startswith("ftp"): url = sourceURL else: url = spec.getURL(ossname) if not singleFile: yamlFile = open( yamlDir + "/" + ossname + "-" + ossversion + ".yaml", "w") yamlFile.write("vmwsource:" + ossname + ":" + ossversion + ":\n") yamlFile.write(" repository: VMWsource\n") yamlFile.write(" name: '" + ossname + "'\n") yamlFile.write(" version: '" + ossversion + "'\n") yamlFile.write(" url: " + str(url) + "\n") yamlFile.write(" license: UNKNOWN\n") if sourceName is not None: yamlFile.write(" vmwsource-distribution: " + str(sourceName) + "\n") if modified: yamlFile.write(" modified: true\n") yamlFile.write("\n") if not singleFile: yamlFile.close() if singleFile: yamlFile.close() logger.info("Generated source yaml files for all packages")
def buildSourcesList(specPath,sourcePath, yamlDir, logger, singleFile=False): strUtils = StringUtils() if singleFile: yamlFile = open(yamlDir+"sources_list.yaml", "w") lst = os.listdir(specPath) lst.sort() import PullSources for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec=Specutils(specFile) modified = len(spec.getPatchNames()) > 0 listSourceURLs=spec.getSourceURLs() ossname = spec.getBasePackageName() ossversion = spec.getVersion() url = None listSourceNames = spec.getSourceNames() sourceName = None if len(listSourceNames) >0: sourceName=listSourceNames[0] sha1 = spec.getChecksumForSource(sourceName) if sha1 is not None: PullSources.get(sourceName, sha1, sourcePath, constants.pullsourcesConfig) if len(listSourceURLs) > 0: sourceURL = listSourceURLs[0] if sourceURL.startswith("http") or sourceURL.startswith("ftp"): url = sourceURL; else: url=spec.getURL(ossname) if not singleFile: yamlFile = open(yamlDir+"/"+ossname+"-"+ossversion+".yaml", "w") yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n") yamlFile.write(" repository: VMWsource\n") yamlFile.write(" name: '"+ossname+"'\n") yamlFile.write(" version: '"+ossversion+"'\n") yamlFile.write(" url: "+str(url)+"\n") yamlFile.write(" license: UNKNOWN\n") if sourceName is not None: yamlFile.write(" vmwsource-distribution: "+str(sourceName)+"\n") if modified: yamlFile.write(" modified: true\n") yamlFile.write("\n") if not singleFile: yamlFile.close() if singleFile: yamlFile.close() logger.info("Generated source yaml files for all packages")
def buildSourcesList(specPath, yamlDir, singleFile=False): strUtils = StringUtils() if singleFile: yamlFile = open(yamlDir + "sources_list.yaml", "w") lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec = Specutils(specFile) modified = len(spec.getPatchNames()) > 0 listSourceURLs = spec.getSourceURLs() ossname = spec.getBasePackageName() ossversion = spec.getVersion() url = None if len(listSourceURLs) > 0: sourceURL = listSourceURLs[0] if sourceURL.startswith( "http") or sourceURL.startswith("ftp"): url = sourceURL else: url = spec.getURL(ossname) if not singleFile: yamlFile = open( yamlDir + ossname + "-" + ossversion + ".yaml", "w") yamlFile.write("vmwsource:" + ossname + ":" + ossversion + ":\n") yamlFile.write(" repository: VMWsource\n") yamlFile.write(" name: '" + ossname + "'\n") yamlFile.write(" version: '" + ossversion + "'\n") yamlFile.write(" url: " + str(url) + "\n") yamlFile.write(" license: UNKNOWN\n") if modified: yamlFile.write(" modified: true\n") yamlFile.write("\n") if not singleFile: yamlFile.close() if singleFile: yamlFile.close()
def buildSourcesList(specPath, yamlDir, singleFile=False): strUtils = StringUtils() if singleFile: yamlFile = open(yamlDir+"sources_list.yaml", "w") lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec=Specutils(specFile) modified = len(spec.getPatchNames()) > 0 listSourceURLs=spec.getSourceURLs() ossname = spec.getBasePackageName() ossversion = spec.getVersion() url = None if len(listSourceURLs) > 0: sourceURL = listSourceURLs[0] if sourceURL.startswith("http") or sourceURL.startswith("ftp"): url = sourceURL; else: url=spec.getURL(ossname) if not singleFile: yamlFile = open(yamlDir+ossname+"-"+ossversion+".yaml", "w") yamlFile.write("vmwsource:"+ossname+":"+ossversion+":\n") yamlFile.write(" repository: VMWsource\n") yamlFile.write(" name: '"+ossname+"'\n") yamlFile.write(" version: '"+ossversion+"'\n") yamlFile.write(" url: "+str(url)+"\n") yamlFile.write(" license: UNKNOWN\n") if modified: yamlFile.write(" modified: true\n") yamlFile.write("\n") if not singleFile: yamlFile.close() if singleFile: yamlFile.close()
def buildPackageList(specPath): print "Package,Version,License,URL,Sources,Patches" lst = os.listdir(specPath) lst.sort() for dirEntry in lst: specDir = os.path.join(specPath, dirEntry) if os.path.isdir(specDir): for specEntry in os.listdir(specDir): specFile = os.path.join(specDir, specEntry) if os.path.isfile(specFile) and specFile.endswith(".spec"): spec = Specutils(specFile) name = spec.getPackageNames()[0] version = spec.getRPMVersion(name) license = spec.getLicense(name) url = spec.getURL(name) source = spec.getSourceURLs()[0] patches = "" ps = spec.getPatchNames() for p in ps: if patches != "": patches += " " patches += p print name + "," + version + "," + license + "," + url + "," + source + "," + patches