From abf98bfadfc20587a97c6cf63656d081a9ead418 Mon Sep 17 00:00:00 2001 From: Holger Levsen Date: Sat, 17 Sep 2011 18:35:39 +0200 Subject: [PATCH] try to make it work with nice code --- debian_build.py | 36 ++++++++---------------------------- 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/debian_build.py b/debian_build.py index c8b4de3..9b51263 100755 --- a/debian_build.py +++ b/debian_build.py @@ -396,11 +396,9 @@ if __name__ == '__main__': ) exit_error() - # FIXME: aka make it work now changelog = parse_changelog.stdout - changelog2 = changelog - cmd = ['grep-dctrl', '-n', '-s', 'Distribution', ''] + cmd = ['grep-dctrl', '-n', '-s', 'Version,Distribution', ''] grep_dctrl = subprocess.Popen( cmd, shell=False, @@ -417,36 +415,18 @@ if __name__ == '__main__': ) exit_error() + version = grep_dctrl.stdout.readline() + version = version.strip() + logger.info('Packet version is %s' % (version)) + distribution = grep_dctrl.stdout.readline() - distribution = distribution.strip() - logger.info('Packet distribution is %s' % (distribution)) + 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=changelog2, - 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() - - version = grep_dctrl.stdout.readline() - version = version.strip() - logger.info('Packet version is %s' % (version)) + exit_error() if not GIT_COMMITTER_EMAIL: for commit in repo.commits(): -- 2.39.5