From a3b94a8c23b57e1064cd475bb5888325ff090bfc Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 17 Sep 2011 17:41:57 +0200 Subject: [PATCH] support building for staging too --- debian_build.py | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/debian_build.py b/debian_build.py index f493eed..ba2eebf 100755 --- a/debian_build.py +++ b/debian_build.py @@ -379,9 +379,7 @@ if __name__ == '__main__': cmd = ['/usr/bin/git', 'commit', '-a', '-m', 'add changelog'] subprocess.check_call(cmd) else: - # so we're in the master branch... - # (or maybe in other branches, but thats not specified _yet_) - # TODO errorchecking etc + # so we're in the master or release branches cmd = ['dpkg-parsechangelog'] parse_changelog = subprocess.Popen( cmd, @@ -398,12 +396,41 @@ if __name__ == '__main__': ) exit_error() - cmd = ['grep-dctrl', '-n', '-s', 'Version', ''] + changelog = parse_changelog.stdout + + cmd = ['grep-dctrl', '-n', '-s', 'Distribution', ''] + grep_dctrl = subprocess.Popen( + cmd, + shell=False, + close_fds=True, + stdin=changelog, + stdout=subprocess.PIPE, + stderr=sys.stderr, + cwd=os.getcwd() + ) + ret = grep_dctrl.wait() + if ret: + raise Exception( + '%s was not successfull, return code was %s ' % (' '.join(cmd), ret) + ) + exit_error() + + distribution = grep_dctrl.stdout.readline() + distribution = distribution.strip() + logger.info('Packet distribution is %s' % (distribution)) + if (options.distribution in ('testing', 'staging') and not distribution in ('testing', 'staging')) or (options.distribution in ('stable', 'stable-proposed-updates', 'production', 'production-proposed-updates') and distribution in ('stable', 'stable-proposed-updates', 'production', 'production-proposed-updates')): + raise Exception( + 'Distribution %s in debian/changelog did not match branch %s' % (distribution, GIT_UPSTREAM_BRANCH) + ) + exit_error() + + # FIXME this is code duplication, we should only rungrep-dctrl once here... (see above) + cmd = ['grep-dctrl', '-n', '-s', 'Version', ''] grep_dctrl = subprocess.Popen( cmd, shell=False, close_fds=True, - stdin=parse_changelog.stdout, + stdin=changelog, stdout=subprocess.PIPE, stderr=sys.stderr, cwd=os.getcwd() -- 2.39.5