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,
)
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()