bumpspecfile: get user name and email from git config

This commit is contained in:
Chuck Ebbert 2011-11-29 05:45:06 -05:00
parent 9af210dc91
commit 5ae7978615

View File

@ -1,6 +1,7 @@
#!/usr/bin/python
#
# Needs $GIT_COMMITTER_NAME and $GIT_COMMITTER_EMAIL set.
# Uses git config options user.name and user.email, falls
# back to env vars $GIT_COMMITTER_NAME and $GIT_COMMITTER_EMAIL
#
import re
import sys
@ -44,8 +45,12 @@ class Specfile:
self.vr = " "+ver+'-'+nextrel
def addChangelogEntry(self,entry):
user = os.environ.get("GIT_COMMITTER_NAME","unknown")
email = os.environ.get("GIT_COMMITTER_EMAIL","unknown")
user = os.popen("git config --get user.name").read().rstrip()
if (user == ""):
user = os.environ.get("GIT_COMMITTER_NAME","Unknown")
email = os.popen("git config --get user.email").read().rstrip()
if (email == ""):
email = os.environ.get("GIT_COMMITTER_EMAIL","unknown")
if (email == "unknown"):
email = os.environ.get("USER","unknown")+"@fedoraproject.org"
changematch=re.compile(r"^%changelog")