deps.sh: support hash checkouts
This commit is contained in:
parent
2022a03bd2
commit
b1e895b40b
29
deps.sh
29
deps.sh
|
@ -86,20 +86,27 @@ nuke () {
|
|||
}
|
||||
|
||||
checkout_repo () {
|
||||
local BRANCH_OR_CHECKOUT_TARGET="$3"
|
||||
# Skip if dir already exists
|
||||
if [[ -d ./opt/git/"$1" ]]; then
|
||||
echo "[~] Skipping $1 fetch as \"$(pwd)/opt/git/$1\" already exists"
|
||||
else
|
||||
echo "[+] Cloning $1 from $2"
|
||||
git -c advice.detachedHead=false clone "$2" "./opt/git/$1" --branch "$3" --depth=1
|
||||
if [[ "$3" == "hash:"* ]] ;
|
||||
then
|
||||
BRANCH_OR_CHECKOUT_TARGET="${3:5:45}" # skip the 'hash:' prefix
|
||||
git -c advice.detachedHead=false clone "$2" "./opt/git/$1" --depth=1
|
||||
else
|
||||
git -c advice.detachedHead=false clone "$2" "./opt/git/$1" --branch "$BRANCH_OR_CHECKOUT_TARGET" --depth=1
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
|
||||
echo "[~] Checking out $1 $3"
|
||||
echo "[~] Checking out $1 $BRANCH_OR_CHECKOUT_TARGET"
|
||||
(
|
||||
cd ./opt/git/"$1"
|
||||
git fetch origin "$3" --depth=1
|
||||
git -c advice.detachedHead=false checkout "$3"
|
||||
git fetch origin "$BRANCH_OR_CHECKOUT_TARGET" --depth=1
|
||||
git -c advice.detachedHead=false checkout "$BRANCH_OR_CHECKOUT_TARGET"
|
||||
)
|
||||
echo
|
||||
}
|
||||
|
@ -109,20 +116,10 @@ fetch () {
|
|||
|
||||
checkout_repo zlib https://github.com/madler/zlib "v1.2.13"
|
||||
checkout_repo zstd https://github.com/facebook/zstd "v1.5.4"
|
||||
checkout_repo snappy https://github.com/google/snappy "1.1.10"
|
||||
checkout_repo snappy https://github.com/google/snappy "hash:c9f9edf6d75bb065fa47468bf035e051a57bec7c"
|
||||
checkout_repo lz4 https://github.com/lz4/lz4 "v1.9.4"
|
||||
checkout_repo rocksdb https://github.com/facebook/rocksdb "v8.1.1"
|
||||
checkout_repo libpcap https://github.com/the-tcpdump-group/libpcap "libpcap-1.10.4"
|
||||
|
||||
# Fix: Tagged snappy release doesn't compile on macOS
|
||||
# https://github.com/google/snappy/commit/00aa9ac61d37194cffb0913d9b7d71611eb05a4b
|
||||
if [[ "$OS" == "Darwin" ]]; then
|
||||
( cd ./opt/git/snappy
|
||||
SNAPPY_COMMIT=c9f9edf6d75bb065fa47468bf035e051a57bec7c
|
||||
echo "[~] FIX: Switching to snappy c9f9edf6d75bb065fa47468bf035e051a57bec7c"
|
||||
git fetch origin $SNAPPY_COMMIT --depth=1
|
||||
git -c advice.detachedHead=false checkout $SNAPPY_COMMIT )
|
||||
fi
|
||||
}
|
||||
|
||||
check_fedora_pkgs () {
|
||||
|
@ -475,4 +472,4 @@ while [[ $# -gt 0 ]]; do
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
done
|
Loading…
Reference in New Issue