From b1eba728d48985e64596acfe881b8e97578a5b3c Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Mon, 27 Nov 2017 19:59:32 +0100 Subject: dch: allow to reraise exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This eases debugging since we can do GBP_DEBUG=raise gbp dch … and get the exception trace without modifying the source --- gbp/scripts/common/__init__.py | 5 +++++ gbp/scripts/dch.py | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gbp/scripts/common/__init__.py b/gbp/scripts/common/__init__.py index 5a8223fa..e49930e4 100644 --- a/gbp/scripts/common/__init__.py +++ b/gbp/scripts/common/__init__.py @@ -31,6 +31,11 @@ class ExitCodes(object): uscan_up_to_date = 4 # Uscan up to date (import-orig only) +def maybe_debug_raise(): + if 'raise' in os.getenv("GBP_DEBUG", '').split(','): + raise + + def is_download(args): """ >>> is_download(["http://foo.example.com"]) diff --git a/gbp/scripts/dch.py b/gbp/scripts/dch.py index 9aea564d..9db1a233 100644 --- a/gbp/scripts/dch.py +++ b/gbp/scripts/dch.py @@ -30,7 +30,7 @@ from gbp.deb import compare_versions from gbp.deb.source import DebianSource, DebianSourceError from gbp.deb.git import GitRepositoryError, DebianGitRepository from gbp.deb.changelog import ChangeLog, NoChangeLogError -from gbp.scripts.common import ExitCodes +from gbp.scripts.common import ExitCodes, maybe_debug_raise user_customizations = {} snapshot_re = re.compile("\s*\*\* SNAPSHOT build @(?P[a-z0-9]+)\s+\*\*") @@ -570,6 +570,7 @@ def main(argv): if str(err): gbp.log.err(err) ret = 1 + maybe_debug_raise() finally: os.chdir(old_cwd) return ret -- cgit v1.2.3