Skip to content

[update-checkout] Remove the symlink from update-checkout because we … #28305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions utils/swift_build_support/swift_build_support/products/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ def product_source_name(cls):
It provides a customization point for Product subclasses. It is set to
the value of product_name() by default for this reason.
"""

llvm_projects = ['clang',
'clang-tools-extra',
'compiler-rt',
'libcxx',
'lldb',
'llvm']

if cls.product_name() in llvm_projects:
return "llvm-project/{}".format(cls.product_name())
return cls.product_name()

@classmethod
Expand Down
49 changes: 0 additions & 49 deletions utils/update_checkout/update_checkout/update_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from __future__ import print_function

import argparse
import errno
import json
import os
import platform
Expand Down Expand Up @@ -400,53 +399,6 @@ def skip_list_for_platform(config):
return skip_list


# Python 2.7 in Windows doesn't support os.symlink
os_symlink = getattr(os, "symlink", None)
if callable(os_symlink):
pass
else:
def symlink_ms(source, link_name):
source = os.path.normpath(source)
link_name = os.path.normpath(link_name)
if os.path.isdir(link_name):
os.rmdir(link_name)
elif os.exists(link_name):
os.remove(link_name)
import ctypes
csl = ctypes.windll.kernel32.CreateSymbolicLinkW
csl.argtypes = (ctypes.c_wchar_p, ctypes.c_wchar_p, ctypes.c_uint32)
csl.restype = ctypes.c_ubyte
flags = 1 if os.path.isdir(source) else 0
if csl(link_name, source, flags) == 0:
raise ctypes.WinError()
os.symlink = symlink_ms


def symlink_llvm_monorepo(args):
print("Create symlink for LLVM Project")
llvm_projects = ['clang',
'llvm',
'lldb',
'compiler-rt',
'libcxx',
'clang-tools-extra']
for project in llvm_projects:
src_path = os.path.join(args.source_root,
'llvm-project',
project)
dst_path = os.path.join(args.source_root, project)
if not os.path.islink(dst_path):
try:
os.symlink(src_path, dst_path)
except OSError as e:
if e.errno == errno.EEXIST:
print("File '%s' already exists. Remove it, so "
"update-checkout can create the symlink to the "
"llvm-monorepo." % dst_path)
else:
raise e


def main():
freeze_support()
parser = argparse.ArgumentParser(
Expand Down Expand Up @@ -599,7 +551,6 @@ def main():
if fail_count > 0:
print("update-checkout failed, fix errors and try again")
else:
symlink_llvm_monorepo(args)
print("update-checkout succeeded")
print_repo_hashes(args, config)
sys.exit(fail_count)