Revision 42868817 devflow/autopkg.py

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")

Also available in: Unified diff