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:
Chris Sosa 2010-11-04 20:49:30 -07:00
parent 137eab6129
commit 170bde0fd4
2 changed files with 5 additions and 3 deletions

View File

@ -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

View File

@ -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)