Fix APKBUILD attribute parsing when opening quote is followed by line break (#415)
his adds a check to continue attribute parsing when end_char is found in the end of first line, but is present only once. Found in gtk+2.0 APKBUILD: https://git.alpinelinux.org/cgit/aports/plain/main/gtk+2.0/APKBUILD
This commit is contained in:
parent
795d41e058
commit
689eb5c3c9
|
@ -112,10 +112,15 @@ def apkbuild(args, path):
|
||||||
if line_value.startswith("\""):
|
if line_value.startswith("\""):
|
||||||
end_char = "\""
|
end_char = "\""
|
||||||
value = ""
|
value = ""
|
||||||
|
first_line = i
|
||||||
while i < len(lines) - 1:
|
while i < len(lines) - 1:
|
||||||
value += line_value.replace("\"", "").strip()
|
value += line_value.replace("\"", "").strip()
|
||||||
if not end_char or line_value.endswith(end_char):
|
if not end_char:
|
||||||
break
|
break
|
||||||
|
elif line_value.endswith(end_char):
|
||||||
|
# This check is needed to allow line break directly after opening quote
|
||||||
|
if i != first_line or line_value.count(end_char) > 1:
|
||||||
|
break
|
||||||
value += " "
|
value += " "
|
||||||
i += 1
|
i += 1
|
||||||
line_value = lines[i][:-1]
|
line_value = lines[i][:-1]
|
||||||
|
|
Loading…
Reference in New Issue