dch: Require EMAIL or DEBEMAIL to be set
authorGuido Günther <agx@sigxcpu.org>
Thu, 30 Sep 2021 14:06:39 +0000 (16:06 +0200)
committerGuido Günther <agx@sigxcpu.org>
Thu, 30 Sep 2021 14:06:39 +0000 (16:06 +0200)
The alternative would be to set a dummy address in case of
--git-author but that again can use $EMAIL so just fail if
both are unset.

Closes: #987611
gbp/scripts/dch.py

index 635a4544ea396ac626ee899787beb67b16c53747..4914b7784f20d853a1f59a3bc480c21731671c3a 100644 (file)
@@ -459,6 +459,12 @@ def main(argv):
 
     try:
         old_cwd = os.path.abspath(os.path.curdir)
+        for var in ['EMAIL', 'DEBEMAIL']:
+            if var in os.environ and os.environ[var]:
+                break
+        else:
+            raise GbpError("Either 'EMAIL' or 'DEBEMAIL' must be set in the environment for 'dch' to work")
+
         try:
             repo = DebianGitRepository('.', toplevel=False)
             os.chdir(repo.path)