Commit 42868817 authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

Add dist codename in debian version and changelog

parent a09634f8
......@@ -132,10 +132,8 @@ def main():
help="Use this keyid for gpg signing")
parser.add_option("--dist",
dest="dist",
default="unstable",
help="If running in snapshot mode, automatically set"
" the changelog distribution to this value"
" (default=unstable).")
default=None,
help="Force distribution in Debian changelog"),
parser.add_option("-S", "--source-only",
dest="source_only",
default=False,
......@@ -250,16 +248,23 @@ def main():
"--new-version=%s" % debian_version)
print_green("Successfully ran '%s'" % " ".join(dch.cmd))
if options.dist is not None:
distribution = options.dist
elif mode == "release":
distribution = utils.get_distribution_codename()
else:
distribution = "unstable"
f = open("debian/changelog", 'r+')
lines = f.readlines()
lines[0] = lines[0].replace("UNRELEASED", distribution)
lines[2] = lines[2].replace("UNRELEASED", "%s build" % mode)
f.seek(0)
f.writelines(lines)
f.close()
if mode == "release":
call("vim debian/changelog")
else:
f = open("debian/changelog", 'r+')
lines = f.readlines()
lines[0] = lines[0].replace("UNRELEASED", options.dist)
lines[2] = lines[2].replace("UNRELEASED", "Snapshot build")
f.seek(0)
f.writelines(lines)
f.close()
# Add changelog to INDEX
repo.git.add("debian/changelog")
......
......@@ -33,6 +33,7 @@
import os
import git
import sh
from collections import namedtuple
from configobj import ConfigObj
......@@ -193,3 +194,10 @@ def undebianize(branch):
return branch.replace("debian-", "")
else:
return branch
def get_distribution_codename():
output = sh.lsb_release("-c")
_, codename = output.split("\t")
codename = codename.strip()
return codename
......@@ -299,8 +299,9 @@ def debian_version_from_python_version(pyver):
"""
version = pyver.replace("_", "~").replace("rc", "~rc")
minor = get_revision(version)
return version + "-" + str(minor)
minor = str(get_revision(version))
codename = utils.get_distribution_codename()
return version + "-" + minor + "~" + codename
def get_revision(version):
......
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