Commit d0b26b83379f4744f58f3c6e9ac85fdddb4c41ba

Authored by Jay Berkenbilt
1 parent 3d03024a

oss-fuzz-build: support branch switching

README-maintainer
... ... @@ -25,6 +25,9 @@ GOOGLE OSS-FUZZ
25 25  
26 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 31 python infra/helper.py build_image --pull qpdf
29 32 python infra/helper.py build_fuzzers qpdf
30 33 python infra/helper.py check_build qpdf
... ...
fuzz/oss-fuzz-build
1   -#!/bin/bash -e
  1 +#!/bin/bash -ex
2 2  
3 3 # This is used invoked from
4 4 # https://github.com/google/oss-fuzz/blob/master/projects/qpdf/build.sh
... ... @@ -6,6 +6,21 @@
6 6 # It should be run from the top level directory of a clean checkout of
7 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 24 ./configure \
10 25 --enable-oss-fuzz \
11 26 --enable-static \
... ...