'''
 Automate the release process of this code base
 1) Increment build release
 2) Clean dist area
 3) Build RPM
 4) Publish RPM to local RHN satellite
'''
import ConfigParser
import subprocess
import os

if os.path.isfile("MANIFEST"):
    os.unlink("MANIFEST")

# Step 1
config = ConfigParser.ConfigParser()
config.read('setup.cfg')
nextval = int(config.get('bdist_rpm', 'release')) + 1
config.set('bdist_rpm', 'release', nextval)
config.write( open('setup.cfg', 'w'))

# Step 2
subprocess.call("rm -f dist/*", shell=True)

# Step 3
subprocess.call("python setup.py bdist_rpm", shell=True)

# Step 4
subprocess.call("titan dist/*noarch.rpm", shell=True)

@@ -198,16 +198,148 @@
 port os%0A
+import sys%0A%0Arhel = sys.argv%5B1%5D%0Aif rhel not in %5B'rhel6', 'rhel7'%5D:%0A    print 'argv%5B1%5D must be either rhel6 or rhel7'%0A    sys.exit()%0A%0A
 %0Aif os.p
@@ -571,17 +571,16 @@
 g.write(
- 
 open('se
@@ -701,17 +701,68 @@
 dist_rpm
-%22
+ --release=%25s.%25s%22 %25 (%0A                nextval, rhel)
 , shell=

add rhel release info to generated RPM