mirror of
https://github.com/flatcar/scripts.git
synced 2026-02-04 07:12:14 +01:00
Fix for bug 8764 that breaks prebuilts for files with more than just keyword pairs.
I've also modified the unit test so it actually tests for this case. Change-Id: I6688d3be7bf1d8962031fcf1d684ddcaab43ba9f BUG=8764 TEST=Unittests Review URL: http://codereview.chromium.org/4566001
This commit is contained in:
parent
137eab6129
commit
170bde0fd4
@ -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
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user