-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vendor 0.21.2 #79
Vendor 0.21.2 #79
Conversation
I'm gonna go ahead and review/ACK this although strictly speaking the intermediate commits don't compile. I think this crate has historically had a lot of vendoring-related grief and bisection is probably already pretty busted, and this puts us on the start to fixing that. |
Yes, my bad I could have mentioned that - they explicitly do not compile, and I had exactly the same thoughts as you mention. It would be nice if we could start getting them all to compile from now. The do in secp so I think we should, I"ll try and keep that as a goal. |
contrib/vendor-bitcoin-core.sh
Outdated
# 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" . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In b83e1de:
In the rust-secp version of this it's a cp "$VENDOR_REPO" "$DIR"
. Why did you change $DIR
to .
? It causes the following chmod
to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the time I couldn't work out a sane way to call the script, I was using
CORE_VENDOR_CP_NOT_CLONE=yes CORE_VENDOR_REPO=/home/tobin/build/github.com/tcharding/bitcoin contrib/vendor-bitcoin-core.sh v0.21-final
But that results in bitcoin/bitcoin
. How do you call it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you using CORE_VENDOR_REPO=/path/to/bitcoin/*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just CORE_VENDOR_REPO=/path/to/bitcoin
. As in
CORE_VENDOR_CP_NOT_CLONE=yes \
CORE_VENDOR_GIT_ROOT=.. \
CORE_VENDOR_REPO=/nix/store/77qhrhjq230jh6zswzg2nfxirpw4zdd3-source \
CORE_VENDOR_DEPEND_DIR=./depend2/ \
./contrib/vendor-bitcoin-core.sh -f
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are not specifying CORE_VENDOR_DEPEND_DIR
then it will default to depend/
. And you'll get a directory depend/bitcoin
as expected. I'm not sure how you would get bitcoin/bitcoin
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooooo, TIL, if the destination directory exists already then the behaviour of cp
is different to if it does not exist - I have never realized this, wow, mind blown. If the directory does not exist it is as you say, it creates the directory correctly, but if it exists then it gets copied into the existing one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't know how this was happening though because we explicitly rm -rf $DIR
right above. Anyways, onwards and upwards!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have never realized this, wow, mind blown
FWIW I always use rsync
and never use cp -r
, its still surprising that I did not know the nuances of cp
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't be opposed to using rsync here, FWIW, though it would be an extra dependency I'd have to pull into my nix derivation and it's probably overkill here.
Agreed that cp
is nuts :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I didn't mean to use it here, I just meant on my machine I never use cp
for directories.
a8f4627
to
1419657
Compare
Force pushed the change discussed above, and tested with Thanks for you patience :) |
contrib/vendor-bitcoin-core.sh
Outdated
shift | ||
done | ||
|
||
echo "Vendoring Bitcoin Core version: $CORE_VENDOR_VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 902bc9c:
The rust-secp version of this allows you to leave the revision unset and just use whatever code is present in the directory you're copying. We should preserve this behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cracking the whip on me, I was too lazy to parse out the version number using regex - I'll do it now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, that wasn't so painful.
contrib/vendor-bitcoin-core.sh
Outdated
|
||
# Check out specified revision | ||
pushd "$DIR" > /dev/null | ||
git checkout "$CORE_VENDOR_VERSION" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In 902bc9c:
In particular, here you unconditionally do a git checkout
. This will not work if you are copying a source tree that is not in git.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now mimic's the secp script.
1419657
to
ab80dbb
Compare
Instead of using a subtree add a script to vendor Bitcoin Core. Based on the one in `rust-secp256k1`.
Run the vendoring script: `./vendor-bitcoin-core.sh v0.21.2`
Fix the build after vendoring new version of Core. Includes changes to the build script by Jake and update to the C++ toolchain suggested by Richard. Co-developed-by: Jake Rawsthorne <jake@jakerawsthorne.co.uk> Co-developed-by: Richard Ulrich <richard.ulrich@seba.swiss>
ab80dbb
to
12d7ec3
Compare
Now more like the secp script and includes $ contrib/vendor-bitcoin-core.sh -h
Usage: script OPTIONS [bitcoin-core-version]
OPTIONS:
-f Vendor even if there are local changes to the rust-bitcoinconsensus git index
-h Print this help an exit
Example:
vendor-bitcoin-core v0.21.2 |
Awesome :) we are super close. The vendoring script works now, but when I check the vendored code against the source I see
These two commit IDs are the tip of this PR in this repo and the commit from Bitcoin Core that we're vendoring. This is suuper weird. If you look at
How does Anyway I think I should just whitelist this specific file and forget about it. But let me know what you think. |
I don't really like the idea of having this change in there, could bite us down the track. A simple hack could be, at the end of the vendoring script, to just grep for |
I had a bit of a play and we are still doing something different, I don't get these lines in I tried using clone (and last time I pushed I was using copy)? |
I think you need to use I think this is a non-issue because:
|
Cool, so this is good to go in then, right? |
Yep. I'll tweak my scripts to ignore this line and ACK/merge it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 12d7ec3
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.