Commit 6b88d711 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Get vcs_user info from gitconfig

parent 36860fc2
......@@ -186,13 +186,10 @@ def main():
" one of %s" % (branch, allowed_branches))
# Fix needed environment variables
v = utils.get_vcs_info()
os.environ["DEVFLOW_BUILD_MODE"] = mode
git_config = original_repo.config_reader()
try:
os.environ["DEBFULLNAME"] = git_config.get_value("user", "name")
os.environ["DEBEMAIL"] = git_config.get_value("user", "email")
except:
print "Could not load user/email from config"
os.environ["DEBFULLNAME"] = v.name
os.environ["DEBEMAIL"] = v.email
# Check that base version file and branch are correct
versioning.get_python_version()
......
......@@ -80,12 +80,15 @@ def get_vcs_info():
revid = get_commit_id(branch.commit, branch)
revno = len(list(repo.iter_commits()))
toplevel = repo.working_dir
config = repo.config_reader()
name = config.get_value("user", "name")
email = config.get_value("user", "email")
info = namedtuple("vcs_info", ["branch", "revid", "revno",
"toplevel"])
"toplevel", "name", "email"])
return info(branch=branch.name, revid=revid, revno=revno,
toplevel=toplevel)
toplevel=toplevel, name=name, email=email)
def get_commit_id(commit, current_branch):
......
......@@ -44,7 +44,6 @@ of the repository code.
import os
import re
import sys
import pprint
from distutils import log # pylint: disable=E0611
......@@ -336,12 +335,6 @@ def get_debian_version():
return debian_version(b, v, mode)
def user_info():
import getpass
import socket
return "%s@%s" % (getpass.getuser(), socket.getfqdn())
def update_version():
"""Generate or replace version files
......@@ -361,7 +354,6 @@ def update_version():
b = get_base_version(v)
mode = utils.get_build_mode()
version = python_version(b, v, mode)
vcs_info_dict = dict(v._asdict()) # pylint: disable=W0212
vcs_info = """{
'branch': '%s',
'revid': '%s',
......@@ -370,10 +362,12 @@ def update_version():
"""__version__ = "%(version)s"
__version_info__ = %(version_info)s
__version_vcs_info__ = %(vcs_info)s
__version_user_info__ = "%(user_info)s"
__version_user_email__ = "%(user_email)s"
__version_user_name__ = "%(user_name)s"
""" % dict(version=version, version_info=version.split("."),
vcs_info=vcs_info,
user_info=user_info())
user_email=v.email,
user_name=v.name)
for _pkg_name, pkg_info in config['packages'].items():
version_filename = pkg_info['version_file']
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment