oss-fuzz-build: support branch switching

This commit is contained in:
Jay Berkenbilt 2019-06-14 10:48:59 -04:00
parent 3d03024ab2
commit d0b26b8337
2 changed files with 19 additions and 1 deletions

View File

@ -25,6 +25,9 @@ GOOGLE OSS-FUZZ
Clone the oss-fuzz project. From the root directory of the repository:
Add `-e GITHUB_FORK=fork -e GITHUB_BRANCH=branch` to build_fuzzers
to work off a fork/branch rather than qpdf/master.
python infra/helper.py build_image --pull qpdf
python infra/helper.py build_fuzzers qpdf
python infra/helper.py check_build qpdf

View File

@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -ex
# This is used invoked from
# https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh
@ -6,6 +6,21 @@
# It should be run from the top level directory of a clean checkout of
# qpdf. It is also exercised in ../azure-pipelines/build-fuzzer
if [[ $GITHUB_FORK != "" ]]; then
git remote add fork https://github.com/$GITHUB_FORK/qpdf
git fetch fork --depth=1
CUR_BRANCH=$(git rev-parse --abbrev-ref @)
if [[ $GITHUB_BRANCH == "" ]]; then
GITHUB_BRANCH=$CUR_BRANCH
fi
if [[ $GITHUB_BRANCH == $CUR_BRANCH ]]; then
git reset --hard fork/$CUR_BRANCH
else
git branch -f $GITHUB_BRANCH fork/$GITHUB_BRANCH
git checkout $GITHUB_BRANCH
fi
fi
./configure \
--enable-oss-fuzz \
--enable-static \