Skip to content

Commit

Permalink
Fix parsing of %dump output
Browse files Browse the repository at this point in the history
Macros can have (and do have) multiline bodies. Account for that.

Signed-off-by: Nikola Forró <nforro@redhat.com>
  • Loading branch information
nforro committed Jan 17, 2022
1 parent 2947e75 commit 8e78522
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion rebasehelper/helpers/macro_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,20 @@ def add_macro(properties):
else:
macros.append(macro)

for line in capturer.stderr.split('\n'):
lines = capturer.stderr.strip().split('\n')
# last line contains only summary
lines.pop()
while lines:
line = lines.pop(0)
# squash lines ending with \
while line.endswith('\\'):
line = line[:-1] + lines.pop(0)
match = macro_re.match(line)
if match:
add_macro(match.groupdict())
elif macros:
# part of the value of the last parsed macro
macros[-1]['value'] += '\n' + line

return macros

Expand Down

0 comments on commit 8e78522

Please sign in to comment.