]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
add git_buildpackage
authorRobin Wittler <robin.wittler@profitbricks.com>
Wed, 3 Aug 2011 14:00:10 +0000 (16:00 +0200)
committerRobin Wittler <robin.wittler@profitbricks.com>
Wed, 3 Aug 2011 14:00:10 +0000 (16:00 +0200)
testgit_build.py

index 8a4767d3a261591bff2ab05b6a37fc024045a82a..eaabc38c748733267378ceef774cd543bcb29ca3 100755 (executable)
@@ -147,17 +147,22 @@ if __name__ == '__main__':
     else:
         logger.info('git clone was not successfull')
         exit_error()
+
     atexit.register(remove_git_target_workspace)
     os.chdir(GIT_TARGET_DIR)
-    #git_helper.git_checkout_branch(GIT_DEBIAN_BRANCH)
-    git_helper.git_new_branch_from(
-            GIT_DEBIAN_BRANCH,
-            os.path.join('origin', GIT_DEBIAN_BRANCH)
-    )
+
+    if GIT_UPSTREAM_BRANCH != GIT_DEBIAN_BRANCH:
+        git_helper.git_new_branch_from(
+                GIT_DEBIAN_BRANCH,
+                os.path.join('origin', GIT_DEBIAN_BRANCH)
+        )
+
     repo = git.repo.Repo()
+
+    if repo.active_branch != 'master' and GIT_DEBIAN_BRANCH != 'master':
+        git_helper.git_checkout_branch(GIT_DEBIAN_BRANCH)
+
     if not GIT_COMMITTER_EMAIL:
-        # if the GIT_COMMIT_EMAIL is not set,
-        # get the email addi from the commit
         for commit in repo.commits():
             if commit.id == GIT_NEW_ID:
                 GIT_COMMITTER_EMAIL = commit.committer.email
@@ -167,7 +172,23 @@ if __name__ == '__main__':
                 )
         else:
             raise Exception('No git_committer_email found')
-    logger.info('Directory Listing: %s' %(os.listdir(GIT_TARGET_DIR)))
+    
+    gbp = git_buildpackage.GitBuildPackage(
+            upstream_branch=GIT_UPSTREAM_BRANCH,
+            debian_branch=GIT_DEBIAN_BRANCH,
+            dist='squeeze',
+            arch='amd64'
+    )
+
+    ret = gbp.build()
+    logger.debug(
+            'This is the return value of git-buildpackage: %s'
+            %(ret)
+    )
+
+#class GitBuildPackage(object):
+#        def __init__(self, upstream_branch=None,
+#                            debian_branch=None, dist=None, arch=None)
 
         #ftp = FTP(
         #        'alexandria.profitbricks.localdomain',