From: Markus Lehtonen Date: Fri, 9 Nov 2012 06:40:36 +0000 (+0200) Subject: import-srpm: return 2 if patch import fails X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=28b94e3cdf72688e2ebae27071ad8b8b2639b90a;p=tools%2Fgit-buildpackage.git import-srpm: return 2 if patch import fails A new return value for failed patch import. If the patch import fails the repo is left in clean and buildable state so one might want to distinguish that from other failures. Signed-off-by: Markus Lehtonen --- diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index 70a1da1f..8071ece9 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -58,6 +58,10 @@ class SkipImport(Exception): """Nothing imported""" pass +class PatchImportError(Exception): + """Patch import failed""" + pass + def download_source(pkg, dirs): """Download package from a remote location""" @@ -134,8 +138,8 @@ def import_spec_patches(repo, spec, dirs): apply_and_commit_patch(repo, patch, packager) except (GbpError, GitRepositoryError): repo.force_head(orig_head, hard=True) - raise GbpError, "Couldn't import patches, you need to apply and "\ - "commit manually" + raise PatchImportError("Patch(es) didn't apply, you need apply " + "and commit manually") # Remove patches from spec and packaging directory gbp.log.info("Removing imported patch files from spec and packaging dir") @@ -145,8 +149,8 @@ def import_spec_patches(repo, spec, dirs): spec.write_spec_file() except GbpError: repo.force_head('HEAD', hard=True) - raise GbpError("Unable to update spec file, you need to edit and " - "commit it manually") + raise PatchImportError("Unable to update spec file, you need to edit" + "and commit it manually") repo.commit_all(msg=PATCH_AUTODELETE_COMMIT_MSG % os.path.basename(spec.specfile)) @@ -480,6 +484,9 @@ def main(argv): except NoSpecError as err: gbp.log.err("Failed determine spec file: %s" % err) ret = 1 + except PatchImportError as err: + gbp.log.err(err) + ret = 2 except SkipImport: skipped = True finally: