aboutsummaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-01-12 15:27:13 +0200
committerGuido Günther <agx@sigxcpu.org>2012-01-23 23:11:37 +0100
commitb7d70164b9fa04e389d5ad03767eef04aad0f40a (patch)
tree59c606c81a593f8ff02f9d440bfcd0a4f0a99362 /gbp
parent28fc4acb60b4b63036faeaaea5afbe159859a133 (diff)
gbp-pq: don't crash in get_maintainer_from_control()
even if debian/control is missing.
Diffstat (limited to 'gbp')
-rw-r--r--gbp/scripts/pq.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/gbp/scripts/pq.py b/gbp/scripts/pq.py
index dafb6973..9193f2b6 100644
--- a/gbp/scripts/pq.py
+++ b/gbp/scripts/pq.py
@@ -151,13 +151,15 @@ def export_patches(repo, branch, options):
def get_maintainer_from_control():
"""Get the maintainer from the control file"""
cmd = 'sed -n -e \"s/Maintainer: \\+\\(.*\\)/\\1/p\" debian/control'
- maintainer = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.readlines()[0].strip()
+ cmdout = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.readlines()
- m = re.match('(?P<name>.*[^ ]) *<(?P<email>.*)>', maintainer)
- if m:
- return m.group('name'), m.group('email')
- else:
- return None, None
+ if len(cmdout) > 0:
+ maintainer = cmdout[0].strip()
+ m = re.match('(?P<name>.*[^ ]) *<(?P<email>.*)>', maintainer)
+ if m:
+ return m.group('name'), m.group('email')
+
+ return None, None
def safe_patches(series):