OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 # |
| 3 # Removes ./wpt/ directory containing the reduced web-platform-tests tree and |
| 4 # starts a new checkout. Only files in WPTWhiteList are retained. The revisions |
| 5 # getting checked out are defined in WPTHeads. |
| 6 |
| 7 DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) |
| 8 cd $DIR |
| 9 TARGET_DIR=$DIR/wpt |
| 10 REMOTE_REPO="https://chromium.googlesource.com/external/w3c/web-platform-tests.g
it" |
| 11 |
| 12 # First line is the main repo HEAD. |
| 13 WPT_HEAD=$(head -n 1 $DIR/WPTHeads) |
| 14 |
| 15 # Remove if already exists. |
| 16 [ -d "$TARGET_DIR" ] && rm -rf $TARGET_DIR |
| 17 |
| 18 # Clone the entire thingy. |
| 19 git clone $REMOTE_REPO $TARGET_DIR |
| 20 cd $TARGET_DIR && git checkout $WPT_HEAD |
| 21 |
| 22 # Grab all submodules. |
| 23 |
| 24 # First line is the main repo HEAD, so skip it to get the submodules only. |
| 25 tail -n+2 $DIR/WPTHeads | while read dir submodule commit; do |
| 26 echo |
| 27 echo "Working in $dir on submodule $submodule. Setting head to: $commit" |
| 28 cd $TARGET_DIR/$dir && \ |
| 29 git submodule update --init $submodule && \ |
| 30 cd $TARGET_DIR/$dir/$submodule && \ |
| 31 git checkout $commit |
| 32 done |
| 33 |
| 34 # Remove all except white-listed. |
| 35 cd $TARGET_DIR |
| 36 find . -type f | grep -Fxvf ../WPTWhiteList | xargs -n 1 rm |
| 37 find . -empty -type d -delete |
| 38 |
| 39 # Fix up mod_pywebsocket dependency. |
| 40 match_line="from mod_pywebsocket import standalone as pywebsocket" |
| 41 prepend_line="sys.path.insert(0, os.path.abspath(os.path.join('..', '..', '..',
'..', '..', 'webkitpy', 'thirdparty')))" |
| 42 sed -i "/$match_line/i $prepend_line" $TARGET_DIR/tools/serve/serve.py |
| 43 |
| 44 # Remove the .git dirs. |
| 45 rm -rf $TARGET_DIR/.git \ |
| 46 $TARGET_DIR/tools/.git \ |
| 47 $TARGET_DIR/tools/wptserve/.git \ |
| 48 $TARGET_DIR/tools/pywebsocket/.git \ |
| 49 |
| 50 # TODO(burnik): Handle the SSL certs. |
OLD | NEW |