]>
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 | 18 | # work in package dir |
81c4dc24 | 19 | dir=$(readlink -f $(dirname "$0")) |
757b3ba5 ER |
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..." | |
8ff01c2d ER |
33 | # exclude 1.9.x beta |
34 | version=$(svn ls $baseurl/tags/ | grep '^[0-9]' | grep -vE '^1\.9\.' | sort -V | tail -n1) | |
ef0f87bf | 35 | version=${version%/} |
40de8a4b ER |
36 | fi |
37 | ||
38 | if [ "$version" = "trunk" ]; then | |
39 | echo "Using trunk" | |
757b3ba5 | 40 | svnurl=$baseurl/trunk/src |
5bdfa704 | 41 | version=$(date +%Y%m%d) |
40de8a4b ER |
42 | else |
43 | echo "Version: $version" | |
44 | svnurl=$baseurl/tags/$version/src | |
757b3ba5 ER |
45 | fi |
46 | ||
5bdfa704 ER |
47 | release_dir=$package-$version |
48 | tarball=$release_dir.tar.xz | |
49 | ||
17e08f85 | 50 | if [ -f $tarball -a $force != 1 ]; then |
a8c42333 ER |
51 | echo "Tarball $tarball already exists" |
52 | exit 0 | |
53 | fi | |
54 | ||
ef0f87bf ER |
55 | # gclient needs python 2.6 |
56 | if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then | |
57 | echo >&2 "Need python >= 2.6 for gclient" | |
58 | exit 1 | |
59 | fi | |
60 | ||
fbe26cab ER |
61 | gclient=$(which gclient 2>/dev/null) |
62 | if [ -z "$gclient" ]; then | |
63 | # http://www.chromium.org/developers/how-tos/install-depot-tools | |
64 | test -d depot_tools || { | |
65 | # could also checkout: | |
66 | # svn co http://src.chromium.org/svn/trunk/tools/depot_tools | |
67 | wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip | |
68 | unzip -qq depot_tools.zip | |
69 | chmod a+x depot_tools/gclient depot_tools/update_depot_tools | |
70 | } | |
71 | gclient=$topdir/depot_tools/gclient | |
72 | fi | |
757b3ba5 | 73 | |
17e08f85 | 74 | topdir=${PWD:-($pwd)} |
fbe26cab | 75 | gclientfile=$topdir/gclient.conf |
5bdfa704 ER |
76 | install -d $package |
77 | cd $package | |
757b3ba5 | 78 | |
fbe26cab | 79 | if [ ! -f $gclientfile ]; then |
7c93b354 | 80 | # create initial config that can be later modified |
fbe26cab | 81 | $gclient config $svnurl --gclientfile=$gclientfile |
17e08f85 ER |
82 | fi |
83 | ||
fbe26cab | 84 | cp -p $gclientfile .gclient |
7c93b354 | 85 | |
17e08f85 ER |
86 | # emulate gclient config, preserving our deps |
87 | sed -i -re '/"url"/ s,"http[^"]+","'$svnurl'",' .gclient | |
88 | ||
fbe26cab | 89 | $gclient sync --nohooks -v |
757b3ba5 | 90 | |
92bbc644 ER |
91 | cd src |
92 | ||
81c4dc24 | 93 | sh -x $dir/clean-source.sh |
5eafce75 | 94 | |
757b3ba5 | 95 | # Populate the LASTCHANGE file template as we will not include VCS info in tarball |
92bbc644 ER |
96 | ./build/lastchange.sh . -o LASTCHANGE.in |
97 | ||
98 | cd ../.. | |
757b3ba5 | 99 | |
563e8b85 ER |
100 | XZ_OPT=-e9 \ |
101 | tar --transform="s:^$package/src:$release_dir:" \ | |
102 | -caf $tarball --exclude-vcs $package/src | |
5bdfa704 | 103 | |
757b3ba5 ER |
104 | ../md5 $spec |
105 | ../dropin $tarball & |