From: Mathias Klette Date: Mon, 24 Jun 2013 11:42:33 +0000 (+0200) Subject: debian_buid.py: reset new_tag when build with autoincrement X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=ee9f3d198691e87b3b24ce8c3fd29dbba27dca55;p=profitbricks%2Fjenkins-build-scripts.git debian_buid.py: reset new_tag when build with autoincrement let's assume this: - user changes files but not version in changelog and commits - call_jenkins accepts and triggers build - debian_build.py figures out version / tag to create from changelog - debian_build.py will incrase version number and pushes new HEAD back to origin - call_jenkins will not push trigger another jenkins call - debian_build.py will build with the new version - tagging must happen when build was successful BUT with the new version number instead of the one gathered in the very first beginning of the script --- diff --git a/debian_build.py b/debian_build.py index 9d85c1d..1bb9b75 100755 --- a/debian_build.py +++ b/debian_build.py @@ -194,7 +194,7 @@ if __name__ == '__main__': # except, the existing tag uses the same commit as we were triggered with # FIXME: tagging only works for squeeze this way, change it to make it multipledist compatible remote_tag = [tag for tag in gitrepo.tags if tag.name == new_tag] - if len(remote_tag) > 0: + if not do_autoincrement and len(remote_tag) > 0: # FIXME: .id attribute but avl. in wheezy based git lib if remote_tag[0].commit.id == curr_commit_id: logger.debug('Tag {name} was already created for commit {sha}.'.format( @@ -393,6 +393,10 @@ if __name__ == '__main__': logger.debug(gitrepo.git.commit('-a', '-s', '-m', 'Released by jenkins')) logger.debug(gitrepo.git.push('origin', 'master')) logger.info('Changelog autoincremented and pushed back by Jenkins!') + + cl = changelog.Changelog() + cl.parse_changelog(open('debian/changelog')) + new_tag = cl.full_version.replace('~', '_').replace(':', ',') except Exception as error: logger.error('Autoincrement failed. Standard error returned:\n\n%s\n' % error.stderr, exc_info=error) exit_error() @@ -594,7 +598,7 @@ export {gbp_env} FORCE_SHELL=TRUE figlet('Upload OK') except Exception as error: - logger.error('Upload failed. See above for details.') + logger.error('Upload failed. See above for details.', exc_info=error) figlet('Upload failed') exit_error()