From: Mathias Klette Date: Fri, 3 May 2013 12:59:55 +0000 (+0200) Subject: fix: we must check for contents only when files are already updated X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=133da9de70ff82fba803d591a41c83038cf4363b;p=profitbricks%2Fjenkins-build-scripts.git fix: we must check for contents only when files are already updated --- diff --git a/debian_build.py b/debian_build.py index 9a6d093..fa55119 100755 --- a/debian_build.py +++ b/debian_build.py @@ -159,11 +159,6 @@ if __name__ == '__main__': # Act II: make decissions - for line in fileinput.input('debian/control'): - if line.lower().startswith('section: unknown'): - raise Exception('debian/control sets "section" to unknown. This is not allowed, failing...') - exit_error() - if re.match(STABLE_BRANCHES_RE,ENV['GIT_BRANCH']): new_dist = 'production-proposed-updates' new_version = '{version}'.format( @@ -280,6 +275,12 @@ if __name__ == '__main__': )) figlet('Cleanup OK') + # .. NOW we can verify debian/control contents + for line in fileinput.input('debian/control'): + if line.lower().startswith('section: unknown'): + raise Exception('debian/control sets "section" to unknown. This is not allowed, failing...') + exit_error() + # .. update changelog if we trust the package if do_autoincrement: subprocess.check_call([BIN_DCH, '-i', 'Released by jenkins.']) @@ -330,11 +331,12 @@ if __name__ == '__main__': # let me see the first two changelog entries: - # TODO: use changelog python libs instead of DCH calls, see above - cl = changelog.Changelog() - cl.parse_changelog(open('debian/changelog')) - logger.info('New changelog:\n\n%s' %( - ''.join([block.__str__() for block in cl._blocks[0:2]]))) + line_counter = 0 + for line in fileinput.input('debian/changelog'): + if line.startswith(' --'): + line_counter += 1 + if line_counter <= 2: + print('debian/changelog: %s' %(line.rstrip('\n'))) # ACT IV: preparations are set, let's build @@ -431,7 +433,8 @@ if __name__ == '__main__': except Exception as error: figlet('Upload failed') - logger.exception(error) + logger.error('Upload failed. See above for details.') + exit_error() # .. define the time of completion