]>
Commit | Line | Data |
---|---|---|
757b3ba5 ER |
1 | #!/bin/sh |
2 | # Usage: | |
3 | # ./get-source.sh | |
4 | # Author: Elan Ruusamäe <glen@pld-linux.org> | |
4623c72a ER |
5 | # |
6 | # To see release notes, see this page: | |
7 | # https://developers.google.com/speed/docs/mod_pagespeed/release_notes | |
757b3ba5 | 8 | |
5bdfa704 | 9 | package=modpagespeed |
757b3ba5 | 10 | baseurl=http://modpagespeed.googlecode.com/svn |
40de8a4b | 11 | # leave empty to use latest tag, or "trunk" for trunk |
ef0f87bf | 12 | version= |
757b3ba5 | 13 | spec=apache-mod_pagespeed.spec |
17e08f85 | 14 | force=0 |
757b3ba5 ER |
15 | |
16 | # abort on errors | |
17 | set -e | |
757b3ba5 ER |
18 | # work in package dir |
19 | dir=$(dirname "$0") | |
20 | cd "$dir" | |
21 | ||
17e08f85 ER |
22 | if [[ "$1" = *force ]]; then |
23 | force=1 | |
24 | shift | |
25 | fi | |
26 | ||
40de8a4b ER |
27 | if [ "$1" ]; then |
28 | version=$1 | |
29 | fi | |
30 | ||
31 | if [ -z "$version" ]; then | |
32 | echo "Looking for latest version..." | |
365e19f8 | 33 | version=$(svn ls $baseurl/tags/ | grep '^[0-9]' | sort -V | tail -n1) |
ef0f87bf | 34 | version=${version%/} |
40de8a4b ER |
35 | fi |
36 | ||
37 | if [ "$version" = "trunk" ]; then | |
38 | echo "Using trunk" | |
757b3ba5 | 39 | svnurl=$baseurl/trunk/src |
5bdfa704 | 40 | version=$(date +%Y%m%d) |
40de8a4b ER |
41 | else |
42 | echo "Version: $version" | |
43 | svnurl=$baseurl/tags/$version/src | |
757b3ba5 ER |
44 | fi |
45 | ||
5bdfa704 ER |
46 | release_dir=$package-$version |
47 | tarball=$release_dir.tar.xz | |
48 | ||
17e08f85 | 49 | if [ -f $tarball -a $force != 1 ]; then |
a8c42333 ER |
50 | echo "Tarball $tarball already exists" |
51 | exit 0 | |
52 | fi | |
53 | ||
ef0f87bf ER |
54 | # gclient needs python 2.6 |
55 | if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then | |
56 | echo >&2 "Need python >= 2.6 for gclient" | |
57 | exit 1 | |
58 | fi | |
59 | ||
e0ebbd5b | 60 | # http://www.chromium.org/developers/how-tos/install-depot-tools |
b74b29a5 | 61 | test -d depot_tools || { |
4623c72a ER |
62 | # could also checkout: |
63 | # svn co http://src.chromium.org/svn/trunk/tools/depot_tools | |
e0ebbd5b ER |
64 | wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip |
65 | unzip -qq depot_tools.zip | |
e0ebbd5b | 66 | chmod a+x depot_tools/gclient depot_tools/update_depot_tools |
b74b29a5 | 67 | } |
757b3ba5 | 68 | |
17e08f85 ER |
69 | topdir=${PWD:-($pwd)} |
70 | gclient=$topdir/gclient.conf | |
5bdfa704 ER |
71 | install -d $package |
72 | cd $package | |
757b3ba5 | 73 | |
7c93b354 ER |
74 | if [ ! -f $gclient ]; then |
75 | # create initial config that can be later modified | |
76 | ../depot_tools/gclient config $svnurl --gclientfile=$gclient | |
17e08f85 ER |
77 | fi |
78 | ||
5bdfa704 | 79 | cp -p $gclient .gclient |
7c93b354 | 80 | |
17e08f85 ER |
81 | # emulate gclient config, preserving our deps |
82 | sed -i -re '/"url"/ s,"http[^"]+","'$svnurl'",' .gclient | |
83 | ||
7c93b354 | 84 | ../depot_tools/gclient sync --nohooks -v |
757b3ba5 ER |
85 | |
86 | # Populate the LASTCHANGE file template as we will not include VCS info in tarball | |
ce5a7d18 | 87 | (cd src && ./build/lastchange.sh . -o LASTCHANGE.in) |
757b3ba5 ER |
88 | cd .. |
89 | ||
563e8b85 ER |
90 | XZ_OPT=-e9 \ |
91 | tar --transform="s:^$package/src:$release_dir:" \ | |
92 | -caf $tarball --exclude-vcs $package/src | |
5bdfa704 | 93 | |
757b3ba5 ER |
94 | ../md5 $spec |
95 | ../dropin $tarball & |