diff options
author | Oliver Chang <oliverchang@users.noreply.github.com> | 2021-09-21 10:10:06 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 10:10:06 +1000 |
commit | 77d6eb33bc462d19b719b11a90cd69819d638d6d (patch) | |
tree | 30814973beb6e94fc8ab845fae5899d8fa8d6695 /infra/helper.py | |
parent | 219af13b2b603ca36887bf3ef057b478b0bed6bf (diff) | |
download | oss-fuzz-77d6eb33bc462d19b719b11a90cd69819d638d6d.tar.gz |
Helper fixes for external projects. (#6458)
- Add ":v1" suffix to Dockerfile template.
- Support relative paths for external project directories.
Diffstat (limited to 'infra/helper.py')
-rwxr-xr-x | infra/helper.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/infra/helper.py b/infra/helper.py index ffadb17fb..db9f76b6a 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -86,8 +86,8 @@ class Project: build_integration_path=constants.DEFAULT_EXTERNAL_BUILD_INTEGRATION_PATH): self.is_external = is_external if self.is_external: - self.name = os.path.basename(os.path.abspath(project_name_or_path)) - self.path = project_name_or_path + self.path = os.path.abspath(project_name_or_path) + self.name = os.path.basename(self.path) self.build_integration_path = os.path.join(self.path, build_integration_path) else: @@ -137,15 +137,17 @@ class Project: def main(): # pylint: disable=too-many-branches,too-many-return-statements """Gets subcommand from program arguments and does it. Returns 0 on success 1 on error.""" - os.chdir(OSS_FUZZ_DIR) - if not os.path.exists(BUILD_DIR): - os.mkdir(BUILD_DIR) - logging.basicConfig(level=logging.INFO) parser = get_parser() args = parse_args(parser) + # Note: this has to happen after parse_args above as parse_args needs to know + # the original CWD for external projects. + os.chdir(OSS_FUZZ_DIR) + if not os.path.exists(BUILD_DIR): + os.mkdir(BUILD_DIR) + # We have different default values for `sanitizer` depending on the `engine`. # Some commands do not have `sanitizer` argument, so `hasattr` is necessary. if hasattr(args, 'sanitizer') and not args.sanitizer: |