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