]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
some beautifying
authorMathias Klette <mathias.klette@profitbricks.com>
Fri, 3 May 2013 12:29:30 +0000 (14:29 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Fri, 3 May 2013 12:29:30 +0000 (14:29 +0200)
debian_build.py

index d3524cadf6bdd2697953003bc10235d6236b5515..0c8db1eae4cd77da4d922af41926ec0dade14a1e 100755 (executable)
@@ -234,7 +234,7 @@ if __name__ == '__main__':
     pb_suite = new_dist
 
 
-    # ACT III: do something actually
+    # ACT III: actually do something
     # .. do some housekeeping first
     if not do_cleanup:
         figlet('Cleanup skipped')
@@ -262,7 +262,7 @@ if __name__ == '__main__':
                          )]
 
             if len(files) > 0:
-                logger.debug('Delete previous upstream tarball(s)')
+                logger.info('Delete previous upstream tarball(s)')
                 cmd = [BIN_SUDO, BIN_RM, '-v']
                 cmd.extend(files)
                 ret = subprocess.Popen(
@@ -278,7 +278,6 @@ if __name__ == '__main__':
                     cmd = cmd, 
                     exitcode = ret
                     ))
-        figlet('Cleanup OK')
 
     # .. update changelog if we trust the package
     if do_autoincrement:
@@ -306,7 +305,6 @@ if __name__ == '__main__':
                 ),
             ]
 
-        logger.debug('Executing "%s" ...' %(' '.join(cmd)))
         dch = subprocess.Popen(
             cmd,
             shell=False,
@@ -325,19 +323,20 @@ if __name__ == '__main__':
         gitrepo.git.commit('-a', '-m', 'add new changelog entry')
 
         if ret:
-            raise Exception(
-                '"%s" returned with exitcode: %s' %(' '.join(cmd), ret))
+            logger.debug('"{cmd}" returns {exitcode}.'.format(
+                cmd = cmd, 
+                exitcode = ret
+                ))
+            raise Exception('Failed to update changelog.')
 
 
     # let me see the first two changelog entries:
-    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')))
-
-
+    # 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]])))
+    
     # ACT IV: preparations are set, let's build
     gbp = git_buildpackage.GitBuildPackage(
         upstream_branch = ENV['GIT_BRANCH'],