don't fail if changelog cannot be generated

This commit is contained in:
Frédéric Péters 2015-08-19 18:59:17 +02:00
parent 5f94893a85
commit caf4fc3187
1 changed files with 15 additions and 10 deletions

View File

@ -201,15 +201,20 @@ def prepare_build(dist, project, cmd_options, new):
call("git checkout %s" % build_branch)
changelog = '\n'.join(changelog_from_git(package['source_name'],
version_suffix, project['git_path'], package['repository']))
if not os.path.isdir(debian_folder):
call("git checkout %s" % debian_branch)
debian_generated_changelog_filename = debian_changelog + '.generated'
with open(debian_generated_changelog_filename, 'w+') as f:
f.write(changelog)
package['version'] = re.search(r"^Version:\s(.*?)$",
output("dpkg-parsechangelog -l%s" % debian_generated_changelog_filename),
re.MULTILINE).group(1)
os.unlink(debian_generated_changelog_filename)
if changelog:
if not os.path.isdir(debian_folder):
call("git checkout %s" % debian_branch)
debian_generated_changelog_filename = debian_changelog + '.generated'
with open(debian_generated_changelog_filename, 'w+') as f:
f.write(changelog)
package['version'] = re.search(r"^Version:\s(.*?)$",
output("dpkg-parsechangelog -l%s" % debian_generated_changelog_filename),
re.MULTILINE).group(1)
os.unlink(debian_generated_changelog_filename)
else:
# changelog couldn't be generated, this happens with checkouts from
# dgit, at least.
package['version'] = ''
if os.path.exists(project['build_dir']):
shutil.rmtree(project['build_dir'])
@ -223,7 +228,7 @@ def prepare_build(dist, project, cmd_options, new):
# to the existing changelog
package['version'] = '%s%s' % (project['version'], version_suffix)
call('dch "Eobuilder version" -v %s --distribution %s \
--force-distribution --changelog %s' % \
--force-bad-version --force-distribution --changelog %s' % \
(package['version'], package["repository"], debian_changelog))
good_changelog_contents = open(debian_changelog).read()