Commit 3c9b5ba0 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Merge branch 'hotfix-0.11.6' into develop

Conflicts:
	version
parents 48995a96 6b88d711
......@@ -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()
......@@ -237,10 +234,21 @@ def main():
# Update the version files
versioning.update_version()
if not options.sign:
sign_tag_opt = None
elif options.keyid:
sign_tag_opt = "-u=%s" % options.keyid
elif mode == "release":
sign_tag_opt = "-s"
else:
sign_tag_opt = None
# Tag branch with python version
branch_tag = python_version
tag_message = "%s version %s" % (mode.capitalize(), python_version)
try:
repo.git.tag(branch_tag, branch)
repo.git.tag(branch_tag, branch, sign_tag_opt, "-m=%s" % tag_message)
except GitCommandError:
# Tag may already exist, if only the debian branch has changed
pass
......@@ -280,8 +288,9 @@ def main():
repo.git.commit("-s", "-a", m="Bump version to %s" % debian_version)
# Tag debian branch
debian_branch_tag = "debian/" + utils.version_to_tag(debian_version)
tag_message = "%s version %s" % (mode.capitalize(), debian_version)
if mode == "release":
repo.git.tag(debian_branch_tag)
repo.git.tag(debian_branch_tag, sign_tag_opt, "-m=%s" % tag_message)
# Add version.py files to repo
call("grep \"__version_vcs\" -r . -l -I | xargs git add -f")
......
......@@ -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
......@@ -299,18 +298,18 @@ def debian_version_from_python_version(pyver):
"""
version = pyver.replace("_", "~").replace("rc", "~rc")
minor = str(get_revision(version))
codename = utils.get_distribution_codename()
minor = str(get_revision(version, codename))
return version + "-" + minor + "~" + codename
def get_revision(version):
def get_revision(version, codename):
"""Find revision for a debian version"""
version_tag = utils.version_to_tag(version)
repo = utils.get_repository()
minor = 1
while True:
tag = "debian/" + version_tag + "-" + str(minor)
tag = "debian/" + version_tag + "-" + str(minor) + codename
if tag in repo.tags:
minor += 1
else:
......@@ -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