Created
March 24, 2012 21:00
-
-
Save lmacken/2187726 to your computer and use it in GitHub Desktop.
Generate a list of all Fedora packages and their license
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 <[email protected]> | |
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)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment