diff options
author | Guido Günther <agx@sigxcpu.org> | 2014-05-07 20:35:48 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2014-05-07 20:35:48 +0200 |
commit | 817976e1117228641e93b76e4aee350f51316caf (patch) | |
tree | 599f5b9af690237e5f2c566b94da15dd6c26868c | |
parent | 045e60755306716af245b0fc5fd9d7156d0faec3 (diff) |
Handle version format errors more gracefully
So far if a package claimed to be non native but the version number
didn't contain a '-' we failed like:
Traceback (most recent call last):
File "/usr/bin/gbp", line 9, in <module>
load_entry_point('gbp==0.6.13', 'console_scripts', 'gbp')()
File "/usr/lib/python2.7/dist-packages/gbp/scripts/supercommand.py", line 82, in supercommand
return module.main(args)
File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage.py", line 541, in main
output_dir)
File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage.py", line 96, in prepare_upstream_tarball
upstream_tree = git_archive_build_orig(repo, cp, output_dir, options)
File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage.py", line 270, in git_archive_build_orig
upstream_tree = get_upstream_tree(repo, cp, options)
File "/usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage.py", line 245, in get_upstream_tree
cp['Upstream-Version'])
File "/usr/lib/python2.7/dist-packages/gbp/deb/git.py", line 107, in version_to_tag
return format % dict(version=DebianGitRepository._sanitize_version(version))
File "/usr/lib/python2.7/dist-packages/gbp/deb/git.py", line 122, in _sanitize_version
return version.replace('~', '_').replace(':', '%')
It shouldn't be like that.
-rwxr-xr-x | gbp/scripts/buildpackage.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index c077b9e6..77a5b969 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -1,6 +1,6 @@ # vim: set fileencoding=utf-8 : # -# (C) 2006-2013 Guido Günther <agx@sigxcpu.org> +# (C) 2006-2014 Guido Günther <agx@sigxcpu.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or @@ -241,6 +241,8 @@ def pristine_tar_build_orig(repo, cp, output_dir, options): def get_upstream_tree(repo, cp, options): """Determine the upstream tree from the given options""" if options.upstream_tree.upper() == 'TAG': + if cp['Upstream-Version'] is None: + raise GitRepositoryError("Can't determine upstream version from changelog") upstream_tree = repo.version_to_tag(options.upstream_tag, cp['Upstream-Version']) elif options.upstream_tree.upper() == 'BRANCH': |