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