From 170bde0fd472de545dc10e92ad5135fb3ff2a361 Mon Sep 17 00:00:00 2001 From: Chris Sosa Date: Thu, 4 Nov 2010 20:49:30 -0700 Subject: [PATCH] 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 --- prebuilt.py | 4 ++-- prebuilt_unittest.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) 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)