]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
debian_build.py: Fix adding only a new changelog entry if really needed.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Fri, 25 Jul 2014 20:03:10 +0000 (22:03 +0200)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Fri, 25 Jul 2014 20:03:10 +0000 (22:03 +0200)
debian_build.py

index 3fb88253b134968ff6fe1b429bb55d2d9699cc60..7394489ea18761f687a9321a2e7fc9d001740023 100755 (executable)
@@ -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:')