Revision 096f0cc3

b/fabfile.py
58 58
info = lambda x: sys.stdout.write(green(x) + "\n")
59 59
error = lambda x: sys.stdout.write(red(x) + "\n")
60 60

  
61

  
61 62
def dev():
62 63
    env.develop = True
63 64

  
......
155 156
    try:
156 157
        yield
157 158
    finally:
158
        git("checkout %s" % current_branch)
159

  
159
        try:
160
            git("checkout %s" % current_branch)
161
        except Exception:
162
            error("Could not checkout %s, you're still left at %s" % c)
160 163

  
161 164
#
162 165
# Debian packaging helpers
......
165 168
env.debian_branch = 'debian-0.8'
166 169
env.deb_packages = ['snf-common', 'snf-app', 'snf-ganeti-tools', 'snf-webproject']
167 170
env.signdebs = True
171
env.debrelease = False  # Increase release number in Debian changelogs
168 172

  
169 173

  
170 174
def _last_commit(f):
......
181 185
    with co(env.debian_branch):
182 186
        local("git merge master")
183 187
        with lcd(package_root(p)):
184
            local("ls .git || mkdir .git")
185

  
186
            # check for new changes in package dir
187
            diff = _diff_from_master(_last_commit("debian/changelog"), ".")
188
            vercmd  = "git describe --tags --abbrev=0 "\
189
                      " | sed -rn '\''s/^v(.*)/\\1/p'\''"
190
            version = local(vercmd, capture=True)
191
            if int(diff) > 0:
192
                local("git-dch --debian-branch=%s --auto " \
193
                      "--spawn-editor=always -N%s" % (env.debian_branch, version))
194
                local("git commit debian/changelog " \
195
                      "-m 'Updated %s changelog'" % p)
196

  
197
            local("rm -r .git")
188
            local("if [ ! -d .git ]; then mkdir .git; fi")
189

  
190
            # FIXME:
191
            # Checking for new changes in packages
192
            # has been removed temporarily.
193
            # Always create a new Debian changelog entry.
194
            ## Check for new changes in package dir
195
            #diff = _diff_from_master(_last_commit("debian/changelog"), ".")
196
            #vercmd  = "git describe --tags --abbrev=0"\
197
            #          " | sed -rn '\''s/^v(.*)/\\1/p'\''"
198
            #version = local(vercmd, capture=True)
199
            #if int(diff) > 0:
200
            if True:
201
                # Run git-dch in snapshot mode.
202
                # TODO: Support a --release mode in fabfile
203
                local(("git-dch --debian-branch=%s --auto %s" %
204
                       (env.debian_branch,
205
                        "--release" if env.debrelease else "--snapshot")))
206
                local(("git commit debian/changelog"
207
                       " -m 'Updated %s changelog'" % p))
208
                notice(("Make sure to tag Debian release in %s" %
209
                        env.debian_branch))
210
            
211
            local("rmdir .git")
212

  
213

  
214
def debrelease():
215
    env.debrelease = True
198 216

  
199 217

  
200 218
def nosigndebs():

Also available in: Unified diff