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> | 2014-01-14 13:48:22 +0200 |
commit | dd10956733729da836cb7f694943ff6c5a4699e5 (patch) | |
tree | 83676364995b0f39a1e5d02bff55fcfe077b159f | |
parent | f4723fb649decbdc9c80c785bf66af877cabb4e7 (diff) | |
download | git-buildpackage-dd10956733729da836cb7f694943ff6c5a4699e5.tar.gz git-buildpackage-dd10956733729da836cb7f694943ff6c5a4699e5.tar.bz2 git-buildpackage-dd10956733729da836cb7f694943ff6c5a4699e5.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 | 43 |
1 files changed, 29 insertions, 14 deletions
diff --git a/gbp/scripts/buildpackage_rpm.py b/gbp/scripts/buildpackage_rpm.py index e7e1759f..13e4d1a9 100755 --- a/gbp/scripts/buildpackage_rpm.py +++ b/gbp/scripts/buildpackage_rpm.py @@ -46,6 +46,10 @@ 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" @@ -201,26 +205,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): @@ -573,6 +584,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) |