From 58e4e86b6b87e6cf6faa656893cf270f9fac34df Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Sun, 12 Dec 2021 01:00:32 -0800 Subject: [PATCH] pmb.parse.parse_attribute: strip off trailing comment on attrib line (MR 2149) The apkbuild parser could not handle cases where a line ends in a comment but the value is not quoted. E.g. this: pkgver=1.0 # I'm a comment, look at me was being parsed to a value like this: 1.0 # I'm a comment, look at me ... which is obviously wrong. This strips off any trailing comment on the line, so it's parsed to the correct value. fixes #2087 --- pmb/parse/_apkbuild.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pmb/parse/_apkbuild.py b/pmb/parse/_apkbuild.py index 40140bb6..fe499e5e 100644 --- a/pmb/parse/_apkbuild.py +++ b/pmb/parse/_apkbuild.py @@ -159,6 +159,7 @@ def parse_attribute(attribute, lines, i, path): # Single line if not end_char: + value = value.split("#")[0].rstrip() return (True, value, i) if end_char in value: value = value.split(end_char, 1)[0]