Skip to content

Commit

Permalink
Update parse_and_expand_globlist for Windows
Browse files Browse the repository at this point in the history
crrev.com/c/4220405 updated filelist handling but caused presubmit
failures on Windows due to slash/backslash differences. This change
replaces backslashes with slashes in two critical places so that the
presubmit works correctly.

This was found by the Windows presubmit --all builder:
  https://ci.chromium.org/ui/p/chromium/builders/ci/win-presubmit/198/blamelist

This was tested with:
  git cl presubmit --force --files components\history\core\browser\unit_tests_bundle_data.filelist -v

This change also fixes the writing of filelists on Windows, which was
previously writing \r\n line endings.

Bug: 698042
Change-Id: I5a0daba1ab0a6590288adde5202b619eab2c4c5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4222293
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Bruce Dawson <brucedawson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1101274}
  • Loading branch information
randomascii authored and Chromium LUCI CQ committed Feb 4, 2023
1 parent 6d0aa83 commit 29955b0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/ios/update_bundle_filelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,12 @@ def parse_and_expand_globlist(globlist_name, glob_root):
expansion = [f[prefix_size:] for f in expansion]

if is_exclusion:
files = [f for f in files if f not in expansion]
files = [f for f in files if f.replace('\\', '/') not in expansion]
else:
files += expansion

# Handle Windows backslashes
files = [f.replace('\\', '/') for f in files]
files.sort()
return files

Expand All @@ -137,7 +139,7 @@ def compare_lists(a, b, verbose):

def write_filelist(filelist_name, files, header):
try:
with open(filelist_name, 'w') as filelist:
with open(filelist_name, 'w', encoding='utf-8', newline='') as filelist:
if not _HEADER_PATTERN.search(header):
header = _HEADER
filelist.write(header)
Expand Down

0 comments on commit 29955b0

Please sign in to comment.