From c287b0f4a49f6845545277ffb6ceaf8a38dfe6b9 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Thu, 24 Jul 2014 02:24:46 +0200 Subject: [PATCH] debian_build.py: Add additional repos for develop and feature branches. --- debian_build.py | 26 ++++++++++++++++++++++++-- lib/sbuild.py | 9 +++++---- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/debian_build.py b/debian_build.py index ed2dc95..f1398dd 100755 --- a/debian_build.py +++ b/debian_build.py @@ -281,6 +281,7 @@ if __name__ == '__main__': new_version = curr_version + options.version_suffix reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian" + additional_repos = [] # replace valid debian version chars that are invalid for git tagging new_tag = curr_version.replace('~', '_').replace(':', ',') @@ -336,6 +337,11 @@ if __name__ == '__main__': new_version = version_substitution(logger, pattern, curr_commit) reprepro_base = '/srv/pb-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian-dev" + additional_repos = [ + "deb http://repo.pb.local/pb-debian-dev {dist} main non-free contrib".format( + dist=new_dist + ) + ] # reset actions # .. always include successful build packages into CIDB if curr_dist == 'squeeze': @@ -361,6 +367,21 @@ if __name__ == '__main__': new_version = version_substitution(logger, pattern, curr_commit) reprepro_base = '/srv/dev-{dist}'.format(dist=curr_dist) apt_target = "repo01-debian-dev" + additional_repos = [ + "deb http://repo.pb.local/pb-debian-dev {dist} main non-free contrib".format( + dist=curr_dist+'-dev' + ), + ] + release_file = "http://repo.pb.local/pb-debian-dev/dists/" + new_dist + "/Release" + check_cmd = ['wget', '-q', '--spider', release_file] + if subprocess.call(check_cmd) == 0: + logger.info('Distribution {dist} found in http://repo.pb.local/pb-debian-dev' + .format(dist=new_dist)) + additional_repos.append("deb http://repo.pb.local/pb-debian-dev " + "{dist} main non-free contrib".format(dist=new_dist)) + else: + logger.info('Distribution {dist} not found in http://repo.pb.local/pb-debian-dev' + .format(dist=new_dist)) else: logger.error('Don\'t know how to handle branch "{branch}".'.format( @@ -601,7 +622,8 @@ if __name__ == '__main__': dsc_file=source_builder.dsc_file, dist=new_dist, chroot='pb-'+curr_dist, - arch='amd64' + arch='amd64', + additional_repos=additional_repos, ) if ret == 0: logger.info('Current environment:\n\n{env}\n'.format(env=builder.env)) @@ -634,7 +656,7 @@ export {builder_env} FORCE_SHELL=TRUE ### '''.format(hostname=socket.gethostname(), jenkins_user=ENV['USER'], - jenkins_workspace=ENV['WORKSPACE'], + jenkins_workspace=builder.dsc_dir, builder_env=' '.join(['{k}="{v}"'.format(k=key, v=builder.env[key],) for key in builder.env.keys()]), command=' '.join(builder.command), diff --git a/lib/sbuild.py b/lib/sbuild.py index 60de654..4a2674b 100644 --- a/lib/sbuild.py +++ b/lib/sbuild.py @@ -11,7 +11,7 @@ SBUILD = 'sbuild' class Sbuild(object): - def __init__(self, dsc_file=None, dist=None, chroot=None, arch=None): + def __init__(self, dsc_file=None, dist=None, chroot=None, arch=None, additional_repos=None): ''' TODO ''' @@ -20,6 +20,7 @@ class Sbuild(object): self.arch = arch self.chroot = chroot self.dist = dist + self.additional_repos = additional_repos @property def env(self): @@ -39,9 +40,9 @@ class Sbuild(object): '-n', '--arch=' + self.arch, '-d', self.dist, - '-c', self.chroot, - self.dsc_file, - ] + '-c', self.chroot + ] + ['--extra-repository="' + repo + '"' for repo in self.additional_repos] + \ + [self.dsc_file] return result @property -- 2.39.5