#!/usr/bin/env python # Writes a file called 'rawhide-pkg-licenses.txt' containing a list of all # packages in Fedora with their corresponding license. # # Before running, you must first warm up the yum cache: # # sudo yum --disablerepo=\* --enablerepo=rawhide-source makecache # # Author: Luke Macken import yum, operator yb = yum.YumBase() for repo in yb.repos.findRepos('*'): if repo.id == 'rawhide-source': repo.enable() else: repo.disable() open('rawhide-pkg-licenses.txt', 'w').writelines(('%s %s\n' % (n, l) for n, l in sorted(((p.name, p.license) for p in yb._getSacks(['src']).returnPackages()), key=operator.itemgetter(0))))