oss-fuzz/infra/base-images/base-sanitizer-libs-builder/packages/openssl.py

43 lines
1.5 KiB
Python
Raw Normal View History

#!/usr/bin/env python
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
################################################################################
Clean up MemorySanitizer library warnings (#4694) * Update infra/base-images/all.sh Add build of base-sanitizer-libs-builder and msan-libs-builder to this shell script. * msan: Don't warn on un-instrumented standard libs These libraries do not need to be built with instrumentation, because MemorySanitizer includes interceptors for them. * Fix indentation * Add missing docstrings * Fix unused variable * Fix invalid names * Install python-apt on CI * Revert "Install python-apt on CI" This reverts commit d3da49cf90f138674c1a8bcbdca2f0dfe6c385d1. * Install and use python-apt in system directory * Revert "Install and use python-apt in system directory" This reverts commit e0ede101fbdfbf82da5f32d0a206da247e6dde98. * Build python-apt from source * Check out correct version of python-apt * Fix octal literals * More indentation fixes * Add more missing docstrings * Change variable names of opened files * Remove unused import * Ignore lints about package.Package API * Fix or ignore remaining invalid names * Fix apparent typo in compiler_wrapper_test.py -z should precede a keyword, not a long option * Fix use of xrange * Style fixes, compiler_wrapper * Fix apparent error in compiler_wrapper_test.py Similar to the previous error, the test case would pass "-z --no-undefined" to the linker. "-z" only has an effect when it is followed by a keyword, otherwise ld ignores it and prints a warning message. In this test case, "-z" and "--no-undefined" were passed in two separate "-Wl," compiler arguments, but they reflect a common issue. * Add missing license header * Rename more functions * Better name for global variable * Rename methods of Package * Rename functions in msan_builder.py * Fix invalid variable names * Fix useless-object-inheritance * pylint: Fixes for Package and its subclasses * Remove unused imports * Indentation fixes * Fix too-may-locals error in msan_build.py * Add missing docstrings
2020-12-02 20:52:36 +00:00
"""Custom configure options for openssl."""
import os
import shutil
import package
Clean up MemorySanitizer library warnings (#4694) * Update infra/base-images/all.sh Add build of base-sanitizer-libs-builder and msan-libs-builder to this shell script. * msan: Don't warn on un-instrumented standard libs These libraries do not need to be built with instrumentation, because MemorySanitizer includes interceptors for them. * Fix indentation * Add missing docstrings * Fix unused variable * Fix invalid names * Install python-apt on CI * Revert "Install python-apt on CI" This reverts commit d3da49cf90f138674c1a8bcbdca2f0dfe6c385d1. * Install and use python-apt in system directory * Revert "Install and use python-apt in system directory" This reverts commit e0ede101fbdfbf82da5f32d0a206da247e6dde98. * Build python-apt from source * Check out correct version of python-apt * Fix octal literals * More indentation fixes * Add more missing docstrings * Change variable names of opened files * Remove unused import * Ignore lints about package.Package API * Fix or ignore remaining invalid names * Fix apparent typo in compiler_wrapper_test.py -z should precede a keyword, not a long option * Fix use of xrange * Style fixes, compiler_wrapper * Fix apparent error in compiler_wrapper_test.py Similar to the previous error, the test case would pass "-z --no-undefined" to the linker. "-z" only has an effect when it is followed by a keyword, otherwise ld ignores it and prints a warning message. In this test case, "-z" and "--no-undefined" were passed in two separate "-Wl," compiler arguments, but they reflect a common issue. * Add missing license header * Rename more functions * Better name for global variable * Rename methods of Package * Rename functions in msan_builder.py * Fix invalid variable names * Fix useless-object-inheritance * pylint: Fixes for Package and its subclasses * Remove unused imports * Indentation fixes * Fix too-may-locals error in msan_build.py * Add missing docstrings
2020-12-02 20:52:36 +00:00
def add_no_asm_arg(config_path):
"""Add --no-asm to config scripts."""
shutil.move(config_path, config_path + '.real')
Clean up MemorySanitizer library warnings (#4694) * Update infra/base-images/all.sh Add build of base-sanitizer-libs-builder and msan-libs-builder to this shell script. * msan: Don't warn on un-instrumented standard libs These libraries do not need to be built with instrumentation, because MemorySanitizer includes interceptors for them. * Fix indentation * Add missing docstrings * Fix unused variable * Fix invalid names * Install python-apt on CI * Revert "Install python-apt on CI" This reverts commit d3da49cf90f138674c1a8bcbdca2f0dfe6c385d1. * Install and use python-apt in system directory * Revert "Install and use python-apt in system directory" This reverts commit e0ede101fbdfbf82da5f32d0a206da247e6dde98. * Build python-apt from source * Check out correct version of python-apt * Fix octal literals * More indentation fixes * Add more missing docstrings * Change variable names of opened files * Remove unused import * Ignore lints about package.Package API * Fix or ignore remaining invalid names * Fix apparent typo in compiler_wrapper_test.py -z should precede a keyword, not a long option * Fix use of xrange * Style fixes, compiler_wrapper * Fix apparent error in compiler_wrapper_test.py Similar to the previous error, the test case would pass "-z --no-undefined" to the linker. "-z" only has an effect when it is followed by a keyword, otherwise ld ignores it and prints a warning message. In this test case, "-z" and "--no-undefined" were passed in two separate "-Wl," compiler arguments, but they reflect a common issue. * Add missing license header * Rename more functions * Better name for global variable * Rename methods of Package * Rename functions in msan_builder.py * Fix invalid variable names * Fix useless-object-inheritance * pylint: Fixes for Package and its subclasses * Remove unused imports * Indentation fixes * Fix too-may-locals error in msan_build.py * Add missing docstrings
2020-12-02 20:52:36 +00:00
with open(config_path, 'w') as config_file:
config_file.write('#!/bin/sh\n' \
'%s.real no-asm "$@"\n' % config_path)
os.chmod(config_path, 0o755)
Clean up MemorySanitizer library warnings (#4694) * Update infra/base-images/all.sh Add build of base-sanitizer-libs-builder and msan-libs-builder to this shell script. * msan: Don't warn on un-instrumented standard libs These libraries do not need to be built with instrumentation, because MemorySanitizer includes interceptors for them. * Fix indentation * Add missing docstrings * Fix unused variable * Fix invalid names * Install python-apt on CI * Revert "Install python-apt on CI" This reverts commit d3da49cf90f138674c1a8bcbdca2f0dfe6c385d1. * Install and use python-apt in system directory * Revert "Install and use python-apt in system directory" This reverts commit e0ede101fbdfbf82da5f32d0a206da247e6dde98. * Build python-apt from source * Check out correct version of python-apt * Fix octal literals * More indentation fixes * Add more missing docstrings * Change variable names of opened files * Remove unused import * Ignore lints about package.Package API * Fix or ignore remaining invalid names * Fix apparent typo in compiler_wrapper_test.py -z should precede a keyword, not a long option * Fix use of xrange * Style fixes, compiler_wrapper * Fix apparent error in compiler_wrapper_test.py Similar to the previous error, the test case would pass "-z --no-undefined" to the linker. "-z" only has an effect when it is followed by a keyword, otherwise ld ignores it and prints a warning message. In this test case, "-z" and "--no-undefined" were passed in two separate "-Wl," compiler arguments, but they reflect a common issue. * Add missing license header * Rename more functions * Better name for global variable * Rename methods of Package * Rename functions in msan_builder.py * Fix invalid variable names * Fix useless-object-inheritance * pylint: Fixes for Package and its subclasses * Remove unused imports * Indentation fixes * Fix too-may-locals error in msan_build.py * Add missing docstrings
2020-12-02 20:52:36 +00:00
class Package(package.Package): # pylint: disable=too-few-public-methods
"""openssl package."""
def __init__(self, apt_version):
super(Package, self).__init__('openssl', apt_version)
Clean up MemorySanitizer library warnings (#4694) * Update infra/base-images/all.sh Add build of base-sanitizer-libs-builder and msan-libs-builder to this shell script. * msan: Don't warn on un-instrumented standard libs These libraries do not need to be built with instrumentation, because MemorySanitizer includes interceptors for them. * Fix indentation * Add missing docstrings * Fix unused variable * Fix invalid names * Install python-apt on CI * Revert "Install python-apt on CI" This reverts commit d3da49cf90f138674c1a8bcbdca2f0dfe6c385d1. * Install and use python-apt in system directory * Revert "Install and use python-apt in system directory" This reverts commit e0ede101fbdfbf82da5f32d0a206da247e6dde98. * Build python-apt from source * Check out correct version of python-apt * Fix octal literals * More indentation fixes * Add more missing docstrings * Change variable names of opened files * Remove unused import * Ignore lints about package.Package API * Fix or ignore remaining invalid names * Fix apparent typo in compiler_wrapper_test.py -z should precede a keyword, not a long option * Fix use of xrange * Style fixes, compiler_wrapper * Fix apparent error in compiler_wrapper_test.py Similar to the previous error, the test case would pass "-z --no-undefined" to the linker. "-z" only has an effect when it is followed by a keyword, otherwise ld ignores it and prints a warning message. In this test case, "-z" and "--no-undefined" were passed in two separate "-Wl," compiler arguments, but they reflect a common issue. * Add missing license header * Rename more functions * Better name for global variable * Rename methods of Package * Rename functions in msan_builder.py * Fix invalid variable names * Fix useless-object-inheritance * pylint: Fixes for Package and its subclasses * Remove unused imports * Indentation fixes * Fix too-may-locals error in msan_build.py * Add missing docstrings
2020-12-02 20:52:36 +00:00
def pre_build(self, source_directory, _env, _custom_bin_dir): # pylint: disable=no-self-use
"""Hook function to customize openssl's configuration before building."""
add_no_asm_arg(os.path.join(source_directory, 'Configure'))
add_no_asm_arg(os.path.join(source_directory, 'config'))