From e62bc547a046a81a21f1394bc9b2f9b3fe9fb1ca Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 12 Dec 2013 18:38:25 +0100 Subject: [PATCH] Follow up commit to make the switch to gitpkg+pbuilder work. --- debian_build.py | 7 ++++--- gitpkg-exit-hook | 2 +- lib/gitpkg.py | 25 ++++++++++++++++++++----- lib/pbuilder.py | 4 ++-- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/debian_build.py b/debian_build.py index 4c1e2a5..53a33dd 100755 --- a/debian_build.py +++ b/debian_build.py @@ -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? diff --git a/gitpkg-exit-hook b/gitpkg-exit-hook index 8b41dec..43c39f1 100644 --- a/gitpkg-exit-hook +++ b/gitpkg-exit-hook @@ -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 diff --git a/lib/gitpkg.py b/lib/gitpkg.py index 8ef6c58..e602f80 100644 --- a/lib/gitpkg.py +++ b/lib/gitpkg.py @@ -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.") diff --git a/lib/pbuilder.py b/lib/pbuilder.py index a65d9c3..0f2a4d2 100644 --- a/lib/pbuilder.py +++ b/lib/pbuilder.py @@ -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, -- 2.39.5