0
|
1 |
#!/bin/bash
|
|
2 |
|
|
3 |
die() {
|
|
4 |
echo $*
|
|
5 |
exit 1
|
|
6 |
}
|
|
7 |
|
|
8 |
default_tag="javascriptcore-4.6-snapshot-29072009"
|
|
9 |
|
|
10 |
if [ $# -eq 0 ]; then
|
|
11 |
tag="$default_tag"
|
|
12 |
elif [ $# -eq 1 ]; then
|
|
13 |
tag=$1
|
|
14 |
else
|
|
15 |
die "usage: $0 [commit (defaults to $default_tag)]"
|
|
16 |
fi
|
|
17 |
|
|
18 |
repository=`git config qtwebkit.url`
|
|
19 |
if [ -z "$repository" ]; then
|
|
20 |
die "error: cannot locate webkit git repository. please run git config --global qtwebkit.url /path-or-url/to/webkit/repo"
|
|
21 |
fi
|
|
22 |
|
|
23 |
excluded_directories="$excluded_directories JavaScriptCore/Makefile"
|
|
24 |
excluded_directories="$excluded_directories JavaScriptCore/GNUmakefile.am"
|
|
25 |
excluded_directories="$excluded_directories JavaScriptCore/Configurations"
|
|
26 |
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.exp"
|
|
27 |
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.xcodeproj"
|
|
28 |
excluded_directories="$excluded_directories JavaScriptCore/tests"
|
|
29 |
excluded_directories="$excluded_directories JavaScriptCore/API/tests"
|
|
30 |
excluded_directories="$excluded_directories JavaScriptCore/JavaScriptCore.vcproj"
|
|
31 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/wx"
|
|
32 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/gtk"
|
|
33 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/mac"
|
|
34 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/win"
|
|
35 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/chromium"
|
|
36 |
excluded_directories="$excluded_directories JavaScriptCore/wtf/haiku"
|
|
37 |
excluded_directories="$excluded_directories JavaScriptCore/icu"
|
|
38 |
|
|
39 |
|
|
40 |
files_to_remove=""
|
|
41 |
files_to_remove="$files_to_remove JavaScriptCore/AllInOneFile.cpp"
|
|
42 |
files_to_remove="$files_to_remove JavaScriptCore/JavaScriptCoreSources.bkl"
|
|
43 |
files_to_remove="$files_to_remove JavaScriptCore/jscore.bkl"
|
|
44 |
files_to_remove="$files_to_remove JavaScriptCore/jsc.pro"
|
|
45 |
|
|
46 |
require_clean_work_tree() {
|
|
47 |
# test if working tree is dirty
|
|
48 |
git rev-parse --verify HEAD > /dev/null &&
|
|
49 |
git update-index --refresh &&
|
|
50 |
git diff-files --quiet &&
|
|
51 |
git diff-index --cached --quiet HEAD ||
|
|
52 |
die "Working tree is dirty"
|
|
53 |
}
|
|
54 |
|
|
55 |
which qmake >/dev/null 2>/dev/null
|
|
56 |
if [ "$?" != 0 ]; then
|
|
57 |
die "abort: Could not locate qmake in your PATH"
|
|
58 |
fi
|
|
59 |
|
|
60 |
test -z "$(git rev-parse --show-cdup)" || {
|
|
61 |
exit=$?
|
|
62 |
echo >&2 "You need to run this command from the toplevel of the working tree."
|
|
63 |
exit $exit
|
|
64 |
}
|
|
65 |
|
|
66 |
echo "checking working tree"
|
|
67 |
require_clean_work_tree
|
|
68 |
|
|
69 |
revCount=`git ls-remote $repository | grep $tag | awk '{print $1}' | wc -l`
|
|
70 |
if [ "$revCount" != 1 ]; then
|
|
71 |
die "Cannot parse $tag into a revision. It seems ambiguous".
|
|
72 |
fi
|
|
73 |
|
|
74 |
rev=`git ls-remote $repository | grep -E "^.+$tag$" | awk '{print $1}'`
|
|
75 |
|
|
76 |
tarball=`mktemp /tmp/webkit-snapshot.tar.XXXXXX` || exit 1
|
|
77 |
echo "creating $tarball"
|
|
78 |
|
|
79 |
echo "archiving webkit from $repository $tag ( $rev )"
|
|
80 |
|
|
81 |
git archive --remote=$repository $rev JavaScriptCore WebKit.pri > $tarball || exit 1
|
|
82 |
|
|
83 |
echo "removing unwanted files and directories"
|
|
84 |
for dir in $excluded_directories; do
|
|
85 |
echo " removing $dir"
|
|
86 |
tar --delete --file=$tarball $dir
|
|
87 |
done
|
|
88 |
|
|
89 |
for item in $exclude_with_exceptions_list; do
|
|
90 |
dir=`echo $item | awk -F : '{print $1}'`
|
|
91 |
include=`echo $item | awk -F : '{print $2}'`
|
|
92 |
echo " removing $dir except $include"
|
|
93 |
files=`tar --list --file=$tarball $dir | grep -v -E "^$dir\$" | grep -v $include`
|
|
94 |
tar --delete --file=$tarball $files
|
|
95 |
done
|
|
96 |
|
|
97 |
for file in $files_to_remove; do
|
|
98 |
echo " removing $file"
|
|
99 |
tar --delete --file=$tarball $file
|
|
100 |
done
|
|
101 |
|
|
102 |
echo "done!"
|
|
103 |
|
|
104 |
srcdir=src/3rdparty/javascriptcore
|
|
105 |
absSrcDir=$PWD/$srcdir
|
|
106 |
localDiff=
|
|
107 |
lastImportRevison=
|
|
108 |
|
|
109 |
echo "replacing $srcdir"
|
|
110 |
if [ -d $srcdir ]; then
|
|
111 |
git ls-files $srcdir | xargs rm
|
|
112 |
git ls-files -z src/3rdparty/javascriptcore | git update-index --force-remove -z --stdin
|
|
113 |
else
|
|
114 |
mkdir -p $srcdir
|
|
115 |
fi
|
|
116 |
|
|
117 |
(cd $srcdir && tar xf $tarball)
|
|
118 |
git add $srcdir
|
|
119 |
|
|
120 |
echo "generating extra sources"
|
|
121 |
(
|
|
122 |
for proj in JavaScriptCore; do
|
|
123 |
cd $absSrcDir/$proj &&
|
|
124 |
rm -rf tmp &&
|
|
125 |
mkdir tmp &&
|
|
126 |
cd tmp &&
|
|
127 |
mkdir -p ../generated &&
|
|
128 |
qmake -o Makefile CONFIG-=QTDIR_build QT_CONFIG+=phonon GENERATED_SOURCES_DIR=`pwd`/../generated OUTPUT_DIR=`pwd` ../$proj.pro &&
|
|
129 |
make generated_files &&
|
|
130 |
perl -pi -e "s,$absSrcDir/,,g" ../generated/*.cpp ../generated/*.h &&
|
|
131 |
git add ../generated &&
|
|
132 |
cd .. &&
|
|
133 |
rm -rf tmp &&
|
|
134 |
cd ..
|
|
135 |
done
|
|
136 |
)
|
|
137 |
rm -rf $srcdir/WebKitBuild
|
|
138 |
|
|
139 |
cat >$srcdir/VERSION <<EOT
|
|
140 |
This is a snapshot of JavaScriptCore from
|
|
141 |
|
|
142 |
git://gitorious.org/qtwebkit/qtwebkit.git
|
|
143 |
|
|
144 |
The commit imported was from the
|
|
145 |
|
|
146 |
$tag branch/tag
|
|
147 |
|
|
148 |
and has the sha1 checksum
|
|
149 |
|
|
150 |
$rev
|
|
151 |
EOT
|
|
152 |
git add $srcdir/VERSION
|
|
153 |
|
|
154 |
git diff-files --name-only -z | git update-index --remove -z --stdin
|
|
155 |
|
|
156 |
echo "removing $tarball"
|
|
157 |
rm -f $tarball
|
|
158 |
|
|
159 |
cat >commitlog.txt <<EOT
|
|
160 |
Updated JavaScriptCore from $repository to $tag ( $rev )
|
|
161 |
EOT
|
|
162 |
|
|
163 |
if [ -d "$repository/.git" -a -n "$lastImportRevison" ]; then
|
|
164 |
echo >>commitlog.txt
|
|
165 |
echo "Changes in WebKit/qt since the last update:" >>commitlog.txt
|
|
166 |
echo >>commitlog.txt
|
|
167 |
git --git-dir=$repository/.git diff $lastImportRevison $rev -- WebKit/qt/ChangeLog | sed -n -e "s,^\+\(.*\),\1,p" >>commitlog.txt
|
|
168 |
fi
|
|
169 |
|
|
170 |
echo "Changes:"
|
|
171 |
echo
|
|
172 |
git --no-pager diff --name-status --cached $srcdir
|
|
173 |
|
|
174 |
echo
|
|
175 |
echo "Wrote commitlog.txt. Use with"
|
|
176 |
echo
|
|
177 |
echo " git commit -e -F commitlog.txt"
|
|
178 |
echo
|
|
179 |
echo "to commit your changes"
|
|
180 |
|
|
181 |
if [ -n "$localDiff" ]; then
|
|
182 |
echo
|
|
183 |
echo "The changes that were locally stored in Perforce are now stored as a git patch in $localDiff"
|
|
184 |
echo "You may want to appy them with"
|
|
185 |
echo
|
|
186 |
echo " git am -3 $localDiff"
|
|
187 |
echo
|
|
188 |
fi
|