aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra
diff options
context:
space:
mode:
authorGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2021-08-27 13:00:03 -0700
committerGravatar GitHub <noreply@github.com>2021-08-27 13:00:03 -0700
commit20858d392aded2451a0908e236f8fc0a9308f8bc (patch)
treebefd13ef575da79b0f9bc3ebc6eec401c08b21fb /infra
parentc8d4d35f57c5952f3b5ca7c5d2ffd819201bc6cd (diff)
[base-builder-new] Fix compile script. (#6340)
In https://github.com/google/oss-fuzz/pull/6322 compile was synced with the version in base-builder. However, base-builder's compile assumes that rust and go are installed. This change makes it possible to run compile without those installed.
Diffstat (limited to 'infra')
-rwxr-xr-xinfra/base-images/base-builder-new/compile13
-rwxr-xr-xinfra/base-images/base-builder/compile13
2 files changed, 18 insertions, 8 deletions
diff --git a/infra/base-images/base-builder-new/compile b/infra/base-images/base-builder-new/compile
index 85ccd693..7a269136 100755
--- a/infra/base-images/base-builder-new/compile
+++ b/infra/base-images/base-builder-new/compile
@@ -156,14 +156,19 @@ echo "---------------------------------------------------------------"
BUILD_CMD="bash -eux $SRC/build.sh"
+# Set +u temporarily to continue even if GOPATH and OSSFUZZ_RUSTPATH are undefined.
+set +u
# We need to preserve source code files for generating a code coverage report.
# We need exact files that were compiled, so copy both $SRC and $WORK dirs.
COPY_SOURCES_CMD="cp -rL --parents $SRC $WORK /usr/include /usr/local/include $GOPATH $OSSFUZZ_RUSTPATH /rustc $OUT"
+set -u
-# Copy rust std lib to its path with a hash
-export rustch=`rustc --version --verbose | grep commit-hash | cut -d' ' -f2`
-mkdir -p /rustc/$rustch/
-cp -r /rust/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/ /rustc/$rustch/
+if [ "$FUZZING_LANGUAGE" = "rust" ]; then
+ # Copy rust std lib to its path with a hash.
+ export rustch=`rustc --version --verbose | grep commit-hash | cut -d' ' -f2`
+ mkdir -p /rustc/$rustch/
+ cp -r /rust/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/ /rustc/$rustch/
+fi
if [ "${BUILD_UID-0}" -ne "0" ]; then
adduser -u $BUILD_UID --disabled-password --gecos '' builder
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile
index 85ccd693..7a269136 100755
--- a/infra/base-images/base-builder/compile
+++ b/infra/base-images/base-builder/compile
@@ -156,14 +156,19 @@ echo "---------------------------------------------------------------"
BUILD_CMD="bash -eux $SRC/build.sh"
+# Set +u temporarily to continue even if GOPATH and OSSFUZZ_RUSTPATH are undefined.
+set +u
# We need to preserve source code files for generating a code coverage report.
# We need exact files that were compiled, so copy both $SRC and $WORK dirs.
COPY_SOURCES_CMD="cp -rL --parents $SRC $WORK /usr/include /usr/local/include $GOPATH $OSSFUZZ_RUSTPATH /rustc $OUT"
+set -u
-# Copy rust std lib to its path with a hash
-export rustch=`rustc --version --verbose | grep commit-hash | cut -d' ' -f2`
-mkdir -p /rustc/$rustch/
-cp -r /rust/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/ /rustc/$rustch/
+if [ "$FUZZING_LANGUAGE" = "rust" ]; then
+ # Copy rust std lib to its path with a hash.
+ export rustch=`rustc --version --verbose | grep commit-hash | cut -d' ' -f2`
+ mkdir -p /rustc/$rustch/
+ cp -r /rust/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/ /rustc/$rustch/
+fi
if [ "${BUILD_UID-0}" -ne "0" ]; then
adduser -u $BUILD_UID --disabled-password --gecos '' builder