Commit d0b26b83379f4744f58f3c6e9ac85fdddb4c41ba
1 parent
3d03024a
oss-fuzz-build: support branch switching
Showing
2 changed files
with
19 additions
and
1 deletions
README-maintainer
| @@ -25,6 +25,9 @@ GOOGLE OSS-FUZZ | @@ -25,6 +25,9 @@ GOOGLE OSS-FUZZ | ||
| 25 | 25 | ||
| 26 | Clone the oss-fuzz project. From the root directory of the repository: | 26 | Clone the oss-fuzz project. From the root directory of the repository: |
| 27 | 27 | ||
| 28 | + Add `-e GITHUB_FORK=fork -e GITHUB_BRANCH=branch` to build_fuzzers | ||
| 29 | + to work off a fork/branch rather than qpdf/master. | ||
| 30 | + | ||
| 28 | python infra/helper.py build_image --pull qpdf | 31 | python infra/helper.py build_image --pull qpdf |
| 29 | python infra/helper.py build_fuzzers qpdf | 32 | python infra/helper.py build_fuzzers qpdf |
| 30 | python infra/helper.py check_build qpdf | 33 | python infra/helper.py check_build qpdf |
fuzz/oss-fuzz-build
| 1 | -#!/bin/bash -e | 1 | +#!/bin/bash -ex |
| 2 | 2 | ||
| 3 | # This is used invoked from | 3 | # This is used invoked from |
| 4 | # https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh | 4 | # https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh |
| @@ -6,6 +6,21 @@ | @@ -6,6 +6,21 @@ | ||
| 6 | # It should be run from the top level directory of a clean checkout of | 6 | # It should be run from the top level directory of a clean checkout of |
| 7 | # qpdf. It is also exercised in ../azure-pipelines/build-fuzzer | 7 | # qpdf. It is also exercised in ../azure-pipelines/build-fuzzer |
| 8 | 8 | ||
| 9 | +if [[ $GITHUB_FORK != "" ]]; then | ||
| 10 | + git remote add fork https://github.com/$GITHUB_FORK/qpdf | ||
| 11 | + git fetch fork --depth=1 | ||
| 12 | + CUR_BRANCH=$(git rev-parse --abbrev-ref @) | ||
| 13 | + if [[ $GITHUB_BRANCH == "" ]]; then | ||
| 14 | + GITHUB_BRANCH=$CUR_BRANCH | ||
| 15 | + fi | ||
| 16 | + if [[ $GITHUB_BRANCH == $CUR_BRANCH ]]; then | ||
| 17 | + git reset --hard fork/$CUR_BRANCH | ||
| 18 | + else | ||
| 19 | + git branch -f $GITHUB_BRANCH fork/$GITHUB_BRANCH | ||
| 20 | + git checkout $GITHUB_BRANCH | ||
| 21 | + fi | ||
| 22 | +fi | ||
| 23 | + | ||
| 9 | ./configure \ | 24 | ./configure \ |
| 10 | --enable-oss-fuzz \ | 25 | --enable-oss-fuzz \ |
| 11 | --enable-static \ | 26 | --enable-static \ |