]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
beautify
authorMathias Klette <mathias.klette@profitbricks.com>
Wed, 16 May 2012 16:22:33 +0000 (18:22 +0200)
committerMathias Klette <mathias.klette@profitbricks.com>
Wed, 16 May 2012 16:22:33 +0000 (18:22 +0200)
debian_build.py

index b0acaab04a61bf50e2171b2611fefb5320f9e423..1175995c8614e83ff2c19d2f8194ac7e9881f643 100755 (executable)
@@ -258,15 +258,60 @@ if __name__ == '__main__':
     try:
         logger.debug('Reset and clean repository first:')
         gitcmd = git.Git('.')
-        logger.debug('%s' %(gitcmd.reset('--hard','HEAD')))
-        logger.debug('%s' %(gitcmd.clean('-fdx')))
-        logger.debug('%s' %(gitcmd.branch('-D','%s' %(localname))))
-        logger.debug('%s' %(gitcmd.checkout('-b','%s' %(localname),'%s' %(remotename))))
+        logger.debug(
+            'git reset --hard HEAD:\n%s' 
+            %(gitcmd.reset('--hard','HEAD'))
+        )
+        logger.debug(
+            'git clean -fdx:\n%s' 
+            %(gitcmd.clean('-fdx'))
+        )
+        logger.debug(
+            'git branch -D %s\n%s' 
+            %(localname,gitcmd.branch('-D','%s' %(localname)))
+        )
+        logger.debug(
+            'git checkout -b %s %s %s' 
+            %(
+                localname,
+                remotename,
+                gitcmd.checkout('-b','%s' %(localname),'%s' %(remotename))
+            )
+        )
     except Exception, exception:
         raise Exception('Failure while managing Git clone:\n%s' %(exception))
     else:
         logger.debug('Status is now:\n%s' %( gitcmd.status() ))
 
+    # cleanup existing *orig.tar.gz
+    if os.path.isdir(BUILD_AREA):
+        files = [os.path.join(BUILD_AREA,file) for file in fnmatch.filter(os.listdir(BUILD_AREA),'*.orig.tar.gz')]
+        if len(files) > 0:
+            logger.debug('Previous upstream tarball(s) found: %s' %( files ))
+            cmd = [BIN_SUDO, BIN_RM, '-v', " ".join(files)]
+            cmdobj = subprocess.Popen(
+                    cmd,
+                    shell=False,
+                    cwd='/',
+                    close_fds=True,
+                    stdout=subprocess.PIPE,
+                    stderr=subprocess.STDOUT,
+                    env={'':''}
+            )
+
+            logger.debug('Calling "%s":' %(' '.join(cmd)))
+            ret = cmdobj.wait()
+            for line in cmdobj.stdout.readlines():
+                logger.debug('%s' %(line))
+
+            if ret:
+                _str = (
+                    'Cmd "%s" returned non-zero (exitcode: %s).'
+                    %(' '.join(cmd), ret)
+                )
+                logger.debug(_str)
+                raise Exception(_str)
+
     ## #if GIT_BRANCH_NAME != 'master':
     ## if not git_helper.git_new_branch_from(localname,remotename):
     ##     raise Exception('Checkout of %s was not successfull.' %( remotename ))
@@ -439,35 +484,6 @@ if __name__ == '__main__':
     else:
          raise Exception('unhandled branch, failing.')
 
-    # cleanup existing *orig.tar.gz
-    if os.path.isdir(BUILD_AREA):
-        files = [os.path.join(BUILD_AREA,file) for file in fnmatch.filter(os.listdir(BUILD_AREA),'*.orig.tar.gz')]
-        if len(files) > 0:
-            logger.debug('Previous upstream tarball(s) found: %s' %( files ))
-            cmd = [BIN_SUDO, BIN_RM, '-v', " ".join(files)]
-            cmdobj = subprocess.Popen(
-                    cmd,
-                    shell=False,
-                    cwd='/',
-                    close_fds=True,
-                    stdout=subprocess.PIPE,
-                    stderr=subprocess.STDOUT,
-                    env={'':''}
-            )
-
-            logger.debug('Calling "%s" ..' %(' '.join(cmd)))
-            ret = cmdobj.wait()
-            for line in cmdobj.stdout.readlines():
-                logger.debug('%s' %(line))
-
-            if ret:
-                _str = (
-                    'Cmd "%s" returned non-zero (exitcode: %s).'
-                    %(' '.join(cmd), ret)
-                )
-                logger.debug(_str)
-                raise Exception(_str)
-
 
     logger.info('dist: %s' %(pb_suite))
     cmd = ['figlet-figlet', '-t', 'dist: %s' %(pb_suite)]