/breezy-debian/unstable

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-debian/unstable
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#    release.py -- The plugin for bzr
#    Copyright (C) 2018 Jelmer Vernooij
#
#    This file is part of breezy-debian.
#
#    bzr-builddeb is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    bzr-builddeb is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with bzr-builddeb; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
#

import subprocess

from .util import (
    find_changelog,
    )


def release(local_tree):
    """Release a tree."""
    (changelog, top_level) = find_changelog(
        local_tree, False, max_blocks=2)

    # TODO(jelmer): If this changelog is automatically updated,
    # insert missing entries now.
    if changelog.distributions == "UNRELEASED":
        if top_level:
            changelog_path = 'changelog'
        else:
            changelog_path = 'debian/changelog'
        changelog_arg = "--changelog=%s" % changelog_path
        # TODO(jelmer): don't send output to stderr
        subprocess.check_call(["dch", changelog_arg, "--release", ""], cwd=local_tree.basedir)
        subprocess.check_call(["debcommit", changelog_arg, "-ar"], cwd=local_tree.basedir)