]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
Follow up commit to make the switch to gitpkg+pbuilder work.
authorBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 12 Dec 2013 17:38:25 +0000 (18:38 +0100)
committerBenjamin Drung <benjamin.drung@profitbricks.com>
Thu, 12 Dec 2013 17:38:25 +0000 (18:38 +0100)
debian_build.py
gitpkg-exit-hook
lib/gitpkg.py
lib/pbuilder.py

index 4c1e2a51e0fdb603315bae70289d21a2b9e85909..53a33dd412181eccf6e9e8be69070e65d7972161 100755 (executable)
@@ -487,9 +487,10 @@ if __name__ == '__main__':
         pb_suite=pb_suite,
         git_commit_id=curr_commit_id[0:7],
     )
-    logger.info('Current environment:\n\n{env}\n'.format(env=builder.env))
-    logger.info('Start building the binary package with pbuilder...\n')
-    ret = builder.build()
+    if ret == 0:
+        logger.info('Current environment:\n\n{env}\n'.format(env=builder.env))
+        logger.info('Start building the binary package with pbuilder...\n')
+        ret = builder.build()
 
     # .. remove last commit (the one where we added the changelog entry)
     # FIXME: when 'merge': reset only on original branch?
index 8b41decdde83e891367dcb79a22ca45309b5c630..43c39f17f0202f66001e8a80b387d0aba02c0f31 100644 (file)
@@ -1,4 +1,4 @@
 #!/bin/sh
 set -e
 
-echo $DEB_DSC > $REPO_DIR/../debian_dsc
+echo "$DEB_DIR/$DEB_SOURCE/$DEB_DSC" > $REPO_DIR/../debian_dsc
index 8ef6c5841f2ff12647ec6ca47581e876a42e1262..e602f80da9e3176d2d155aba8cfa69b730e693df 100644 (file)
@@ -55,10 +55,25 @@ class GitPkg(object):
         # gitpkg-exit-hook is stored in the same directory than the
         # debian_build.py script.
         base_dir = os.path.dirname(os.path.realpath(sys.argv[0]))
-        config_writer = self.gitrepo.config_writer()
-        config_writer.set_value('gitpkg', 'create-fake-orig', 'true')
-        config_writer.set_value('gitpkg', 'gitpkg.exit-hook',
-                                os.path.join(base_dir, 'gitpkg-exit-hook'))
+
+        if hasattr(self.gitrepo,'config_writer'):
+            # this requires python-git >= 0.2
+            config_writer = self.gitrepo.config_writer()
+            config_writer.set_value('gitpkg', 'create-fake-orig', 'true')
+            config_writer.set_value('gitpkg', 'exit-hook',
+                                    os.path.join(base_dir, 'gitpkg-exit-hook'))
+            # unset prebuild target for gitpkg < 0.18
+            config_writer.set_value('gitpkg', 'prebuild-target', '')
+        else:
+            # FIXME: upgrade python-git or make me fail safe
+            cmd = ['git', 'config', 'gitpkg.create-fake-orig', 'true']
+            subprocess.check_call(cmd)
+            cmd = ['git', 'config', 'gitpkg.exit-hook',
+                   os.path.join(base_dir, 'gitpkg-exit-hook')]
+            subprocess.check_call(cmd)
+            # unset prebuild target for gitpkg < 0.18
+            cmd = ['git', 'config', 'gitpkg.prebuild-target', '']
+            subprocess.check_call(cmd)
 
         cmdobj = subprocess.Popen(
                 self.command,
@@ -80,7 +95,7 @@ class GitPkg(object):
         dsc_file = None
         debian_dsc = os.path.join(os.getcwd(), "../debian_dsc")
         if os.path.isfile(debian_dsc):
-            dsc_file = open(debian_dsc).read()
+            dsc_file = open(debian_dsc).read().strip()
             if not os.path.isfile(dsc_file):
                 logger.error("Generated source package " + dsc_file +
                              " not found.")
index a65d9c314ce7703f516dc3db622eb4f76a782339..0f2a4d2352835346c01cf52629c3aa36b5928aab 100644 (file)
@@ -9,7 +9,7 @@ import os
 import sys
 import subprocess
 
-BIN_PBUILDER = '/usr/bin/pbuilder'
+BIN_PBUILDER = '/usr/sbin/pbuilder'
 BIN_SUDO = '/usr/bin/sudo'
 
 class Pbuilder(object):
@@ -50,7 +50,7 @@ class Pbuilder(object):
                 BIN_SUDO,
                 BIN_PBUILDER,
                 '--build',
-                '--buildresult=../build-area/result/',
+                '--buildresult', '../build-area/result/',
                 '--debbuildopts', '-b',   # don't build source packages...
                                           # see directly below
                 self.dsc_file,