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