aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper
diff options
context:
space:
mode:
authorTobias Bosch <tbosch@google.com>2019-08-14 10:10:12 -0700
committerTobias Bosch <tbosch@google.com>2019-08-15 16:03:30 +0000
commit36c4a51a1c0e02be020cb1bb636169eea8a7ae92 (patch)
treef672d13d46aaa4e7bc8fa15bf21abf0bf1468545 /compiler_wrapper
parent8063d4edff8eeaeb40f6d1a9a808a607629ceade (diff)
downloadtoolchain-utils-36c4a51a1c0e02be020cb1bb636169eea8a7ae92.tar.gz
Minor adjustments to bundle.py and build.py
Make sure to copy build.py Pass path of bundle.py to git log call, so that bundle.py can be called from any path. Also adds missing copyright header to bundle.README (this is checked when copying the readme into sys-devel/llvm/files) Removes pie from build.py as that doesn't work with gcc as linker. BUG=chromium:773875 TEST=unit test and comparison to old wrapper Change-Id: Iee28ebcb4bed59cc9e91d3bd29eefd04f76b196a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1754127 Tested-by: Tobias Bosch <tbosch@google.com> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'compiler_wrapper')
-rwxr-xr-xcompiler_wrapper/build.py6
-rw-r--r--compiler_wrapper/bundle.README4
-rwxr-xr-xcompiler_wrapper/bundle.py13
3 files changed, 14 insertions, 9 deletions
diff --git a/compiler_wrapper/build.py b/compiler_wrapper/build.py
index dae18314..33259281 100755
--- a/compiler_wrapper/build.py
+++ b/compiler_wrapper/build.py
@@ -30,12 +30,12 @@ def calc_go_args(args):
# build a fully static binary in go.
ldFlags = [
'-X', 'main.ConfigName=' + args.config, '-X',
- 'main.UseCCache=' + args.use_ccache, '-extldflags \'-fno-PIC -static\''
+ 'main.UseCCache=' + args.use_ccache, "-extldflags '-static'"
]
return [
'go', 'build', '-o',
- os.path.abspath(args.output_file), '-ldflags', ' '.join(ldFlags),
- '-buildmode', 'pie', '-tags', 'osusergo netgo static_build'
+ os.path.abspath(args.output_file), '-ldflags', ' '.join(ldFlags), '-tags',
+ 'osusergo netgo static_build'
]
diff --git a/compiler_wrapper/bundle.README b/compiler_wrapper/bundle.README
index cf796d44..a969d934 100644
--- a/compiler_wrapper/bundle.README
+++ b/compiler_wrapper/bundle.README
@@ -1,3 +1,7 @@
+Copyright 2019 The Chromium OS Authors. All rights reserved.
+Use of this source code is governed by a BSD-style license that can be
+found in the LICENSE file.
+
Toolchain utils compiler wrapper sources.
Build the wrapper:
diff --git a/compiler_wrapper/bundle.py b/compiler_wrapper/bundle.py
index 44799b6f..0a32669e 100755
--- a/compiler_wrapper/bundle.py
+++ b/compiler_wrapper/bundle.py
@@ -25,16 +25,17 @@ def parse_args():
def copy_files(input_dir, output_dir):
for filename in os.listdir(input_dir):
if ((filename.endswith('.go') and not filename.endswith('_test.go')) or
- filename == 'build'):
+ filename == 'build.py'):
shutil.copy(
os.path.join(input_dir, filename), os.path.join(output_dir, filename))
-def read_change_id():
- last_commit_msg = subprocess.check_output(['git', 'log', '-1', '--pretty=%B'])
+def read_change_id(input_dir):
+ last_commit_msg = subprocess.check_output(
+ ['git', '-C', input_dir, 'log', '-1', '--pretty=%B'])
match = re.search('Change-Id: (\\w+)', last_commit_msg)
if not match:
- sys.exit('Couldn\'t find Change-Id in last commit message.')
+ sys.exit("Couldn't find Change-Id in last commit message.")
return match.group(1)
@@ -47,10 +48,10 @@ def write_readme(input_dir, output_dir, change_id):
def main():
args = parse_args()
- change_id = read_change_id()
+ input_dir = os.path.dirname(__file__)
+ change_id = read_change_id(input_dir)
shutil.rmtree(args.output_dir, ignore_errors=True)
os.makedirs(args.output_dir)
- input_dir = os.path.dirname(__file__)
copy_files(input_dir, args.output_dir)
write_readme(input_dir, args.output_dir, change_id)