Skip to content

Commit

Permalink
clang: Install blacklist files to the correct location.
Browse files Browse the repository at this point in the history
LLVM r322451 moved these files to a share/ directory in the
installation directory, so we must do the same in our package.

Amazingly, the move didn't cause breakage in our packaging script
because of a combination of two bugs: 1) the filter regular expression
for blacklist files also matched paths beginning with share/ and 2)
a bug in the CopyDirectoryContents function meant that we ended
up copying the blacklist files to the directory where the files
previously lived.

The bug revealed that we only ever use this function to copy
directories that only contain files, so I removed the tree walking
code from this function. I also removed the filtering feature because
it was only being used to copy blacklists and we can now simply copy
the entire share/ directory (which just contains blacklist files).

Change-Id: I78dca1a6d4cb94d9a8a929f26c0e159d2794efbb
Reviewed-on: https://chromium-review.googlesource.com/1036450
Reviewed-by: Nico Weber <thakis@chromium.org>
Commit-Queue: Peter Collingbourne <pcc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555000}
  • Loading branch information
Peter Collingbourne authored and Commit Bot committed May 1, 2018
1 parent 11ab394 commit 82fd023
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
6 changes: 3 additions & 3 deletions tools/clang/scripts/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ def main():
exe_ext = '.exe' if sys.platform == 'win32' else ''
want = ['bin/llvm-symbolizer' + exe_ext,
'bin/sancov' + exe_ext,
'lib/clang/*/asan_blacklist.txt',
'lib/clang/*/cfi_blacklist.txt',
# Copy built-in headers (lib/clang/3.x.y/include).
'lib/clang/*/include/*',
'lib/clang/*/share/asan_blacklist.txt',
'lib/clang/*/share/cfi_blacklist.txt',
]
if sys.platform == 'win32':
want.append('bin/clang-cl.exe')
Expand Down Expand Up @@ -270,7 +270,7 @@ def main():
'lib/clang/*/lib/linux/*libclang_rt.fuzzer*',
'lib/clang/*/lib/linux/*libclang_rt.san*',
'lib/clang/*/lib/linux/*profile*',
'lib/clang/*/msan_blacklist.txt',
'lib/clang/*/share/msan_blacklist.txt',
])
elif sys.platform == 'win32':
want.extend(['lib/clang/*/lib/windows/clang_rt.asan*.dll',
Expand Down
19 changes: 7 additions & 12 deletions tools/clang/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
CLANG_REVISION = 'HEAD'

# This is incremented when pushing a new build of Clang at the same revision.
CLANG_SUB_REVISION=1
CLANG_SUB_REVISION=2

PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION)

Expand Down Expand Up @@ -236,16 +236,12 @@ def CopyFile(src, dst):
shutil.copy(src, dst)


def CopyDirectoryContents(src, dst, filename_filter=None):
"""Copy the files from directory src to dst
with an optional filename filter."""
def CopyDirectoryContents(src, dst):
"""Copy the files from directory src to dst."""
dst = os.path.realpath(dst) # realpath() in case dst ends in /..
EnsureDirExists(dst)
for root, _, files in os.walk(src):
for f in files:
if filename_filter and not re.match(filename_filter, f):
continue
CopyFile(os.path.join(root, f), dst)
for f in os.listdir(src):
CopyFile(os.path.join(src, f), dst)


def Checkout(name, url, dir):
Expand Down Expand Up @@ -751,9 +747,8 @@ def UpdateClang(args):
asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang',
VERSION, 'lib', platform)
# Blacklists:
CopyDirectoryContents(os.path.join(asan_rt_lib_src_dir, '..', '..'),
os.path.join(asan_rt_lib_dst_dir, '..', '..'),
r'^.*blacklist\.txt$')
CopyDirectoryContents(os.path.join(asan_rt_lib_src_dir, '..', '..', 'share'),
os.path.join(asan_rt_lib_dst_dir, '..', '..', 'share'))
# Headers:
if sys.platform != 'win32':
CopyDirectoryContents(
Expand Down

0 comments on commit 82fd023

Please sign in to comment.