From: Benjamin Drung Date: Fri, 25 Jul 2014 20:03:10 +0000 (+0200) Subject: debian_build.py: Fix adding only a new changelog entry if really needed. X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=f1724da6cb3c17a58efffeece8db2305294618e3;p=profitbricks%2Fjenkins-build-scripts.git debian_build.py: Fix adding only a new changelog entry if really needed. --- diff --git a/debian_build.py b/debian_build.py index 3fb8825..7394489 100755 --- a/debian_build.py +++ b/debian_build.py @@ -556,7 +556,6 @@ if __name__ == '__main__': cl.parse_changelog(open('debian/changelog')) new_version = cl.full_version new_tag = new_version.replace('~', '_').replace(':', ',') - add_changelog_entry = True except Exception as error: logger.error('Autoincrement failed. Standard error returned:\n\n%s\n' % error.stderr, exc_info=error) @@ -567,8 +566,7 @@ if __name__ == '__main__': logger.info('Project is not respected by autoincrement.') cl = changelog.Changelog() cl.parse_changelog(open('debian/changelog')) - add_changelog_entry = new_dist != cl.distributions or new_version != cl.full_version - if add_changelog_entry: + if new_dist != cl.distributions or new_version != cl.full_version: cmd = [ BIN_DCH, '--newversion', @@ -598,24 +596,22 @@ if __name__ == '__main__': dch.stdin.write('\n') ret = dch.wait() - if add_changelog_entry: # we need to commit here else git-buildpackage will use the existing debian/changelog # TODO: Later we should investigate why "--ignore-new" does not work! gitrepo.git.add('-A') gitrepo.git.commit('-a', '-m', 'add new changelog entry') - if ret: - raise Exception( - '"{command}" returned with exitcode: {code}'.format( - command=' '.join(cmd), - code=ret, + if ret: + raise Exception( + '"{command}" returned with exitcode: {code}'.format( + command=' '.join(cmd), + code=ret, + ) ) - ) - else: - logger.info('Changelog updated by Jenkins using debian_build.py!') + else: + logger.info('Changelog updated by Jenkins using debian_build.py!') # let me see the first two entries or our adjusted changelog: - # TODO: use changelog python libs instead of DCH calls, see above cl = changelog.Changelog() cl.parse_changelog(open('debian/changelog')) logger.info('New changelog:')