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