diff --git a/prebuilt.py b/prebuilt.py index df7f6e36dc..a029159ed4 100755 --- a/prebuilt.py +++ b/prebuilt.py @@ -92,8 +92,8 @@ def UpdateLocalFile(filename, value, key='PORTAGE_BINHOST'): # Strip newlines from end of line. We already add newlines below. line = line.rstrip("\n") - if '=' not in line: - # Skip any line without an equal in it and just write it out. + if len(line.split('=')) != 2: + # Skip any line that doesn't fit key=val. file_lines.append(line) continue diff --git a/prebuilt_unittest.py b/prebuilt_unittest.py index 37d24afde1..fe2387fbf7 100755 --- a/prebuilt_unittest.py +++ b/prebuilt_unittest.py @@ -17,7 +17,9 @@ class TestUpdateFile(unittest.TestCase): self.contents_str = ['# comment that should be skipped', 'PKGDIR="/var/lib/portage/pkgs"', 'PORTAGE_BINHOST="http://no.thanks.com"', - 'portage portage-20100310.tar.bz2'] + 'portage portage-20100310.tar.bz2', + 'COMPILE_FLAGS="some_value=some_other"', + ] temp_fd, self.version_file = tempfile.mkstemp() os.write(temp_fd, '\n'.join(self.contents_str)) os.close(temp_fd)