]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
fix: we must check for contents only when files are already updated
authorMathias Klette <mathias.klette@profitbricks.com>
Fri, 3 May 2013 12:59:55 +0000 (14:59 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Fri, 3 May 2013 12:59:55 +0000 (14:59 +0200)
debian_build.py

index 9a6d09351e7a59e0c8de8fb4ea3f0461d6b9b91c..fa55119212094b8c9c8ddcd79d477644cb3b8854 100755 (executable)
@@ -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