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