Created
October 22, 2013 06:20
-
-
Save sjp38/7095984 to your computer and use it in GitHub Desktop.
Extract all SRPMs in current path to source level
This file contains hidden or 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 | |
import os | |
import sys | |
for filename in os.listdir('./'): | |
if not filename.endswith('.rpm'): | |
continue | |
if sys.argv[1][-1] == '/': | |
sys.argv[1] = sys.argv[1][0:-1] | |
topdir = "%s/%s" % (sys.argv[1], filename[0:-4]) | |
cmd = "rpm --define '_topdir %s' -i %s" % ( | |
topdir, filename) | |
print cmd | |
os.system(cmd) | |
os.chdir('%s/SPECS' % topdir) | |
for specfile in os.listdir('./'): | |
if not specfile.endswith('.spec'): | |
continue | |
cmd = "rpmbuild --define '_topdir %s' -bp %s" % ( | |
topdir, specfile) | |
print cmd | |
os.system(cmd) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment