diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2012-09-21 08:38:57 +0300 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2013-04-03 10:10:30 +0300 |
commit | 603d73e3f45efba172f9e242a30ee92eb8949785 (patch) | |
tree | 8c163f6bdcd3c8d4ac73b59d7487f8ebacdc3a71 | |
parent | 7742c71b2389c55b68c9e16c9baa5dc0a2fbe65c (diff) | |
download | git-buildpackage-603d73e3f45efba172f9e242a30ee92eb8949785.tar.gz git-buildpackage-603d73e3f45efba172f9e242a30ee92eb8949785.tar.bz2 git-buildpackage-603d73e3f45efba172f9e242a30ee92eb8949785.zip |
buildpackage-rpm: return 2 for patch-export or tarball generation errors
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rwxr-xr-x | gbp/scripts/buildpackage_rpm.py | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index 4d6d8681..baee59e0 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -44,6 +44,9 @@ from gbp.scripts.common.buildpackage import (index_name, wc_names, from gbp.pkg import (compressor_opts, compressor_aliases) from gbp.scripts.pq_rpm import update_patch_series +class GbpAutoGenerateError(GbpError): + pass + def git_archive(repo, spec, output_dir, tmpdir_base, treeish, prefix, comp_level, with_submodules): "create a compressed orig tarball in output_dir using git_archive" @@ -199,26 +202,33 @@ def git_archive_build_orig(repo, spec, output_dir, options): @return: the tree we built the tarball from @rtype: C{str} """ - upstream_tree = get_upstream_tree(repo, spec, options) - gbp.log.info("%s does not exist, creating from '%s'" % (spec.orig_src['filename'], - upstream_tree)) - if spec.orig_src['compression']: - gbp.log.debug("Building upstream source archive with compression '%s -%s'" % - (spec.orig_src['compression'], options.comp_level)) - if not git_archive(repo, spec, output_dir, options.tmp_dir, upstream_tree, - options.orig_prefix, - options.comp_level, - options.with_submodules): - raise GbpError("Cannot create upstream tarball at '%s'" % output_dir) - return upstream_tree + try: + upstream_tree = get_upstream_tree(repo, spec, options) + gbp.log.info("%s does not exist, creating from '%s'" % \ + (spec.orig_src['filename'], upstream_tree)) + if spec.orig_src['compression']: + gbp.log.debug("Building upstream source archive with compression "\ + "'%s -%s'" % (spec.orig_src['compression'], + options.comp_level)) + if not git_archive(repo, spec, output_dir, options.tmp_dir, + upstream_tree, options.orig_prefix, + options.comp_level, options.with_submodules): + raise GbpError("Cannot create upstream tarball at '%s'" % \ + output_dir) + return upstream_tree + except (GitRepositoryError, GbpError) as err: + raise GbpAutoGenerateError(str(err)) def export_patches(repo, spec, export_treeish, options): """ Generate patches and update spec file """ - upstream_tree = get_upstream_tree(repo, spec, options) - update_patch_series(repo, spec, upstream_tree, export_treeish, options) + try: + upstream_tree = get_upstream_tree(repo, spec, options) + update_patch_series(repo, spec, upstream_tree, export_treeish, options) + except (GitRepositoryError, GbpError) as err: + raise GbpAutoGenerateError(str(err)) def is_native(repo, options): @@ -572,6 +582,10 @@ def main(argv): except GitRepositoryError as err: gbp.log.err("Git command failed: %s" % err) ret = 1 + except GbpAutoGenerateError as err: + if len(err.__str__()): + gbp.log.err(err) + retval = 2 except GbpError, err: if len(err.__str__()): gbp.log.err(err) |