-
Notifications
You must be signed in to change notification settings - Fork 29.1k
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
v8: update make-v8.sh to use git #9393
Changes from 6 commits
c3deb42
3c54a7e
73e7c69
7d8effd
fd9fd66
0171280
60bcadb
971ef91
8c995f4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,47 @@ | ||
#!/bin/bash | ||
|
||
|
||
git_origin=$(git config --get remote.origin.url | sed 's/.\+[\/:]\([^\/]\+\/[^\/]\+\)$/\1/') | ||
git_branch=$(git rev-parse --abbrev-ref HEAD) | ||
v8ver=${1:-v8} #default v8 | ||
svn_prefix=https://github.com | ||
svn_path="$svn_prefix/$git_origin/branches/$git_branch/deps/$v8ver" | ||
#svn_path="$git_origin/branches/$git_branch/deps/$v8ver" | ||
gclient_string="solutions = [{'name': 'v8', 'url': '$svn_path', 'managed': False}]" | ||
# Get V8 branch from v8/include/v8-version.h | ||
MAJOR=$(grep V8_MAJOR_VERSION deps/v8/include/v8-version.h | cut -d ' ' -f 3) | ||
MINOR=$(grep V8_MINOR_VERSION deps/v8/include/v8-version.h | cut -d ' ' -f 3) | ||
BRANCH=$MAJOR.$MINOR | ||
|
||
# clean up if someone presses ctrl-c | ||
trap cleanup INT | ||
|
||
function cleanup() { | ||
trap - INT | ||
|
||
rm .gclient || true | ||
rm .gclient_entries || true | ||
rm -rf _bad_scm/ || true | ||
|
||
#if v8ver isn't v8, move the v8 folders | ||
#back to what they were | ||
if [ "$v8ver" != "v8" ]; then | ||
mv v8 $v8ver | ||
mv .v8old v8 | ||
fi | ||
echo "git cleanup" | ||
git reset --hard HEAD | ||
git clean -e .v8old -ffdq | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are there subdirectories with .git directories in them? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the original code there are no directories with .git, but deps/v8 will have .git directory when this script is run more than once, because after the script is run, deps/v8 is the fetched copy from google which contains the .git directory. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although, the directory which would contain ".git" I'm excluding explicitly, so the extra -f option could be removed. I would personally keep it for completeness, such that no directory is skipped in case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Anyway, we are syncing every time. So removing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, every time the script is run, a new copy of v8 is fetched from google and old one with .git is removed ( which is only untracked directory with .git). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I am thinking is, why should we have the .git directory at all, during the cleanup we can remove that as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, git clean won't delete .git files since git won't track .git directory. I can manually delete deps/v8/.git before git clean and remove the extra -f option. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated. |
||
# Copy local files | ||
rsync -a .v8old/ v8/ | ||
rm -rf .v8old | ||
exit 0 | ||
} | ||
|
||
cd deps | ||
echo $gclient_string > .gclient | ||
if [ "$v8ver" != "v8" ]; then | ||
mv v8 .v8old | ||
mv $v8ver v8 | ||
# Preserve local changes | ||
mv v8 .v8old | ||
|
||
echo "Fetching v8 from chromium.googlesource.com" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: We may not have to mention the location. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for someone looking at the job's console log, this would be useful information? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: in the echo below, it is V8 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, thanks. |
||
fetch v8 | ||
if [ "$?" -ne 0 ]; then | ||
echo "V8 fetch failed" | ||
exit 1 | ||
fi | ||
echo "V8 fetched" | ||
|
||
cd v8 | ||
|
||
echo "Checking out branch:$BRANCH" | ||
git fetch | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I am not wrong, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, this fetch is not necessary, updated. Thanks. |
||
git checkout remotes/branch-heads/$BRANCH | ||
|
||
echo "Sync dependencies" | ||
gclient sync | ||
|
||
cd .. | ||
cleanup |
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.
This will only work if the cwd when running the script is the Node.js src root.
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.
which should be the case always, since this script is only run by make and the Makefile is in that directory.