tools/import_layer: fix errors in maintainer scraping code

* Fix "sre_constants.error: nothing to repeat" error due to .* inside
  group made optional with ? in regex
* Avoid error if maintainer responsibility is not specified

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
Paul Eggleton 2014-06-12 11:21:40 +01:00
parent 0ec1909051
commit 7a432108c0

View File

@ -383,7 +383,7 @@ def main():
layer.layer_type = 'A'
if maintainers:
maint_re = re.compile(r'^"?([^"@$<>]+)"? *<([^<> ]+)>[ -]*(.*)?$')
maint_re = re.compile(r'^"?([^"@$<>]+)"? *<([^<> ]+)>[ -]*(.+)?$')
for maintentry in maintainers:
res = maint_re.match(maintentry)
if res:
@ -391,7 +391,8 @@ def main():
maintainer.layerbranch = layerbranch
maintainer.name = res.group(1).strip()
maintainer.email = res.group(2)
maintainer.responsibility = res.group(3).strip()
if res.group(3):
maintainer.responsibility = res.group(3).strip()
maintainer.save()
layer.save()