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 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