Revision 42868817

b/devflow/autopkg.py
132 132
                      help="Use this keyid for gpg signing")
133 133
    parser.add_option("--dist",
134 134
                      dest="dist",
135
                      default="unstable",
136
                      help="If running in snapshot mode, automatically set"
137
                           " the changelog distribution to this value"
138
                           " (default=unstable).")
135
                      default=None,
136
                      help="Force distribution in Debian changelog"),
139 137
    parser.add_option("-S", "--source-only",
140 138
                      dest="source_only",
141 139
                      default=False,
......
250 248
                  "--new-version=%s" % debian_version)
251 249
    print_green("Successfully ran '%s'" % " ".join(dch.cmd))
252 250

  
251
    if options.dist is not None:
252
        distribution = options.dist
253
    elif mode == "release":
254
        distribution = utils.get_distribution_codename()
255
    else:
256
        distribution = "unstable"
257

  
258
    f = open("debian/changelog", 'r+')
259
    lines = f.readlines()
260
    lines[0] = lines[0].replace("UNRELEASED", distribution)
261
    lines[2] = lines[2].replace("UNRELEASED", "%s build" % mode)
262
    f.seek(0)
263
    f.writelines(lines)
264
    f.close()
265

  
253 266
    if mode == "release":
254 267
        call("vim debian/changelog")
255
    else:
256
        f = open("debian/changelog", 'r+')
257
        lines = f.readlines()
258
        lines[0] = lines[0].replace("UNRELEASED", options.dist)
259
        lines[2] = lines[2].replace("UNRELEASED", "Snapshot build")
260
        f.seek(0)
261
        f.writelines(lines)
262
        f.close()
263 268

  
264 269
    # Add changelog to INDEX
265 270
    repo.git.add("debian/changelog")
b/devflow/utils.py
33 33

  
34 34
import os
35 35
import git
36
import sh
36 37
from collections import namedtuple
37 38
from configobj import ConfigObj
38 39

  
......
193 194
        return branch.replace("debian-", "")
194 195
    else:
195 196
        return branch
197

  
198

  
199
def get_distribution_codename():
200
    output = sh.lsb_release("-c")
201
    _, codename = output.split("\t")
202
    codename = codename.strip()
203
    return codename
b/devflow/versioning.py
299 299

  
300 300
    """
301 301
    version = pyver.replace("_", "~").replace("rc", "~rc")
302
    minor = get_revision(version)
303
    return version + "-" + str(minor)
302
    minor = str(get_revision(version))
303
    codename = utils.get_distribution_codename()
304
    return version + "-" + minor + "~" + codename
304 305

  
305 306

  
306 307
def get_revision(version):

Also available in: Unified diff