-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
12d7ec3 Fix Bitcoin Core 0.21.2 upgrade (Tobin C. Harding) a4f30ef Vendor Bitcoin Core v0.21.2 (Tobin C. Harding) 8b3d23f Update README about vendoring (Tobin C. Harding) 3ca86b9 Remove the depend directory (Tobin C. Harding) 619611e Add Bitcoin Core vendor script (Tobin C. Harding) Pull request description: This is #77 without the version bump patch. Upgrade to a new way of vendoring Core and vendor version 0.21.2 - note please this will be directly followed by an upgrade to 0.21-final. Done separately to proof out the workflow of such an upgrade. ACKs for top commit: apoelstra: ACK 12d7ec3 Tree-SHA512: f708b4bda1a209afe7552ec0e691ed104847d4a4a5fae6cd13f2da8f3a205c0a652ced8883900b9ce312cb8f4f39f77f0abbdf3372016c5af7aeddc3e33984ba
- Loading branch information
Showing
1,180 changed files
with
91,997 additions
and
36,442 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
function usage() { | ||
echo | ||
echo "Usage: script OPTIONS [bitcoin-core-version]" | ||
echo | ||
echo "OPTIONS:" | ||
echo | ||
echo " -f Vendor even if there are local changes to the rust-bitcoinconsensus git index" | ||
echo " -h Print this help an exit" | ||
echo | ||
echo "Example:" | ||
echo | ||
echo " vendor-bitcoin-core v0.21.2" | ||
echo | ||
|
||
exit 0 | ||
} | ||
|
||
if (($# < 1)) || [ "$1" == '-h' ]; then | ||
usage | ||
fi | ||
|
||
# Set default variables | ||
|
||
if [ -z "$CORE_VENDOR_GIT_ROOT" ]; then | ||
CORE_VENDOR_GIT_ROOT="$(git rev-parse --show-toplevel)" | ||
else | ||
CORE_VENDOR_GIT_ROOT="$(realpath "$CORE_VENDOR_GIT_ROOT")" | ||
fi | ||
|
||
DEFAULT_DEPEND_DIR="depend" | ||
DEFAULT_CORE_REPO=https://github.com/bitcoin/bitcoin.git | ||
|
||
: "${CORE_VENDOR_DEPEND_DIR:=$DEFAULT_DEPEND_DIR}" | ||
: "${CORE_VENDOR_REPO:=$DEFAULT_CORE_REPO}" | ||
|
||
# CP_NOT_CLONE lets us just copy a directory rather than git cloning. | ||
# This is usually a bad idea, since it will bring in build artifacts or any other | ||
# junk from the source directory, but may be useful during development or CI. | ||
: "${CORE_VENDOR_CP_NOT_CLONE:=no}" | ||
|
||
echo "Using depend directory $CORE_VENDOR_DEPEND_DIR. Set CORE_VENDOR_DEPEND_DIR to override." | ||
echo "Using bitcoin repository $CORE_VENDOR_REPO. Set CORE_VENDOR_REPO to override." | ||
|
||
# Parse command-line options | ||
CORE_REV="" | ||
FORCE=no | ||
while (( "$#" )); do | ||
case "$1" in | ||
-h) | ||
echo "" | ||
usage | ||
;; | ||
-f) | ||
FORCE=yes | ||
;; | ||
*) | ||
if [ -z "$CORE_REV" ]; then | ||
CORE_REV="$1" | ||
else | ||
echo "WARNING: ignoring unknown command-line argument $1" | ||
fi | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
echo | ||
if [ "$CORE_REV" ]; then | ||
echo "Vendoring Bitcoin Core version: $CORE_REV" | ||
else | ||
echo "WARNING: No Bitcoin Core revision specified. Will use whatever we find at the git repo." | ||
fi | ||
echo | ||
|
||
# Check if we will do anything destructive. | ||
|
||
if [ "$FORCE" == "no" ]; then | ||
if ! git diff --quiet -- "*.rs"; then | ||
echo "ERROR: There appear to be modified source files. Check these in or pass -f (some source files will be modified to have symbols renamed)." | ||
exit 2 | ||
fi | ||
if ! git diff --quiet -- "$CORE_VENDOR_DEPEND_DIR"; then | ||
echo "ERROR: The depend directory appears to be modified. Check it in or pass -f (this directory will be deleted)." | ||
exit 2 | ||
fi | ||
fi | ||
|
||
DIR=./bitcoin | ||
|
||
pushd "$CORE_VENDOR_DEPEND_DIR" > /dev/null | ||
rm -rf "$DIR" || true | ||
|
||
# Clone the repo. As a special case, if the repo is a local path and we have | ||
# not specified a revision, just copy the directory rather than using 'git clone'. | ||
# This lets us use non-git repos or dirty source trees as secp sources. | ||
if [ "$CORE_VENDOR_CP_NOT_CLONE" == "yes" ]; then | ||
cp -r "$CORE_VENDOR_REPO" "$DIR" | ||
chmod -R +w "$DIR" # cp preserves write perms, which if missing will cause patch to fail | ||
else | ||
git clone "$CORE_VENDOR_REPO" "$DIR" | ||
fi | ||
|
||
# Check out specified revision | ||
pushd "$DIR" > /dev/null | ||
if [ -n "$CORE_REV" ]; then | ||
git checkout "$CORE_REV" | ||
fi | ||
SOURCE_REV=$(git rev-parse HEAD || echo "[unknown revision from $CORE_VENDOR_REPO]") | ||
rm -rf .git/ || true | ||
popd | ||
|
||
# Record revision | ||
echo "# This file was automatically created by $(basename "$0")" > ./bitcoin-HEAD-revision.txt | ||
echo "$SOURCE_REV" >> ./bitcoin-HEAD-revision.txt | ||
|
||
popd > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# This file was automatically created by vendor-bitcoin-core.sh | ||
af591f2068d0363c92d9756ca39c43db85e5804c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.