Skip to content

Commit

Permalink
Rewrite update-libfuzzer.sh to vendor a specific commit
Browse files Browse the repository at this point in the history
Also do a shallow and sparse clone to make running the script faster.
  • Loading branch information
fitzgen committed Nov 7, 2024
1 parent c8275d1 commit bc6ce26
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions update-libfuzzer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@

# Usage:
#
# ./update-libfuzzer $commit_hash
#
# Where `$commit_hash` is a commit hash from
# https://github.com/llvm-mirror/llvm-project
# $ ./update-libfuzzer.sh

set -ex

# The LLVM commit from which we are vendoring libfuzzer. This must be a commit
# hash from https://github.com/llvm/llvm-project
COMMIT=3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff

cd "$(dirname $0)"
project_dir="$(pwd)"

tmp_dir="$(mktemp -d)"

git clone https://github.com/llvm/llvm-project.git "$tmp_dir"
cd "$tmp_dir"
git checkout "$1"

git init
git remote add llvm https://github.com/llvm/llvm-project.git
git sparse-checkout set compiler-rt/lib/fuzzer

git fetch --depth 1 llvm "$COMMIT" --filter=blob:none
git checkout "$COMMIT"

rm -rf "$project_dir/libfuzzer/"
mv "$tmp_dir/compiler-rt/lib/fuzzer/" "$project_dir/libfuzzer/"

0 comments on commit bc6ce26

Please sign in to comment.