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(): ...@@ -186,13 +186,10 @@ def main():
" one of %s" % (branch, allowed_branches)) " one of %s" % (branch, allowed_branches))
# Fix needed environment variables # Fix needed environment variables
v = utils.get_vcs_info()
os.environ["DEVFLOW_BUILD_MODE"] = mode os.environ["DEVFLOW_BUILD_MODE"] = mode
git_config = original_repo.config_reader() os.environ["DEBFULLNAME"] = v.name
try: os.environ["DEBEMAIL"] = v.email
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"
# Check that base version file and branch are correct # Check that base version file and branch are correct
versioning.get_python_version() versioning.get_python_version()
...@@ -237,10 +234,21 @@ def main(): ...@@ -237,10 +234,21 @@ def main():
# Update the version files # Update the version files
versioning.update_version() 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 # Tag branch with python version
branch_tag = python_version branch_tag = python_version
tag_message = "%s version %s" % (mode.capitalize(), python_version)
try: try:
repo.git.tag(branch_tag, branch) repo.git.tag(branch_tag, branch, sign_tag_opt, "-m=%s" % tag_message)
except GitCommandError: except GitCommandError:
# Tag may already exist, if only the debian branch has changed # Tag may already exist, if only the debian branch has changed
pass pass
...@@ -280,8 +288,9 @@ def main(): ...@@ -280,8 +288,9 @@ def main():
repo.git.commit("-s", "-a", m="Bump version to %s" % debian_version) repo.git.commit("-s", "-a", m="Bump version to %s" % debian_version)
# Tag debian branch # Tag debian branch
debian_branch_tag = "debian/" + utils.version_to_tag(debian_version) debian_branch_tag = "debian/" + utils.version_to_tag(debian_version)
tag_message = "%s version %s" % (mode.capitalize(), debian_version)
if mode == "release": 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 # Add version.py files to repo
call("grep \"__version_vcs\" -r . -l -I | xargs git add -f") call("grep \"__version_vcs\" -r . -l -I | xargs git add -f")
......
...@@ -80,12 +80,15 @@ def get_vcs_info(): ...@@ -80,12 +80,15 @@ def get_vcs_info():
revid = get_commit_id(branch.commit, branch) revid = get_commit_id(branch.commit, branch)
revno = len(list(repo.iter_commits())) revno = len(list(repo.iter_commits()))
toplevel = repo.working_dir 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", info = namedtuple("vcs_info", ["branch", "revid", "revno",
"toplevel"]) "toplevel", "name", "email"])
return info(branch=branch.name, revid=revid, revno=revno, return info(branch=branch.name, revid=revid, revno=revno,
toplevel=toplevel) toplevel=toplevel, name=name, email=email)
def get_commit_id(commit, current_branch): def get_commit_id(commit, current_branch):
......
...@@ -44,7 +44,6 @@ of the repository code. ...@@ -44,7 +44,6 @@ of the repository code.
import os import os
import re import re
import sys import sys
import pprint
from distutils import log # pylint: disable=E0611 from distutils import log # pylint: disable=E0611
...@@ -299,18 +298,18 @@ def debian_version_from_python_version(pyver): ...@@ -299,18 +298,18 @@ def debian_version_from_python_version(pyver):
""" """
version = pyver.replace("_", "~").replace("rc", "~rc") version = pyver.replace("_", "~").replace("rc", "~rc")
minor = str(get_revision(version))
codename = utils.get_distribution_codename() codename = utils.get_distribution_codename()
minor = str(get_revision(version, codename))
return version + "-" + minor + "~" + codename return version + "-" + minor + "~" + codename
def get_revision(version): def get_revision(version, codename):
"""Find revision for a debian version""" """Find revision for a debian version"""
version_tag = utils.version_to_tag(version) version_tag = utils.version_to_tag(version)
repo = utils.get_repository() repo = utils.get_repository()
minor = 1 minor = 1
while True: while True:
tag = "debian/" + version_tag + "-" + str(minor) tag = "debian/" + version_tag + "-" + str(minor) + codename
if tag in repo.tags: if tag in repo.tags:
minor += 1 minor += 1
else: else:
...@@ -336,12 +335,6 @@ def get_debian_version(): ...@@ -336,12 +335,6 @@ def get_debian_version():
return debian_version(b, v, mode) return debian_version(b, v, mode)
def user_info():
import getpass
import socket
return "%s@%s" % (getpass.getuser(), socket.getfqdn())
def update_version(): def update_version():
"""Generate or replace version files """Generate or replace version files
...@@ -361,7 +354,6 @@ def update_version(): ...@@ -361,7 +354,6 @@ def update_version():
b = get_base_version(v) b = get_base_version(v)
mode = utils.get_build_mode() mode = utils.get_build_mode()
version = python_version(b, v, mode) version = python_version(b, v, mode)
vcs_info_dict = dict(v._asdict()) # pylint: disable=W0212
vcs_info = """{ vcs_info = """{
'branch': '%s', 'branch': '%s',
'revid': '%s', 'revid': '%s',
...@@ -370,10 +362,12 @@ def update_version(): ...@@ -370,10 +362,12 @@ def update_version():
"""__version__ = "%(version)s" """__version__ = "%(version)s"
__version_info__ = %(version_info)s __version_info__ = %(version_info)s
__version_vcs_info__ = %(vcs_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("."), """ % dict(version=version, version_info=version.split("."),
vcs_info=vcs_info, 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(): for _pkg_name, pkg_info in config['packages'].items():
version_filename = pkg_info['version_file'] 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