]> git.pld-linux.org Git - packages/apache-mod_pagespeed.git/blob - get-source.sh
match numeric tags to exclude bogus tag 'fake_release_to_test_some_scripts'
[packages/apache-mod_pagespeed.git] / get-source.sh
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
9 pkg=modpagespeed
10 baseurl=http://modpagespeed.googlecode.com/svn
11 # leave empty to use latest tag, or "trunk" for trunk
12 version=
13 spec=apache-mod_pagespeed.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         tarball=$pkg-$(date +%Y%m%d).tar.xz
41 else
42         echo "Version: $version"
43         svnurl=$baseurl/tags/$version/src
44         tarball=$pkg-$version.tar.xz
45 fi
46
47 if [ -f $tarball -a $force != 1 ]; then
48         echo "Tarball $tarball already exists"
49         exit 0
50 fi
51
52 # gclient needs python 2.6
53 if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then
54         echo >&2 "Need python >= 2.6 for gclient"
55         exit 1
56 fi
57
58 # http://www.chromium.org/developers/how-tos/install-depot-tools
59 test -d depot_tools || {
60         # could also checkout:
61         # svn co http://src.chromium.org/svn/trunk/tools/depot_tools
62         wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip
63         unzip -qq depot_tools.zip
64 #       cd depot_tools
65 #       svn upgrade
66 #       cd ..
67         chmod a+x depot_tools/gclient depot_tools/update_depot_tools
68 }
69
70 topdir=${PWD:-($pwd)}
71 gclient=$topdir/gclient.conf
72 install -d $pkg
73 cd $pkg
74
75 if [ ! -f $gclient ]; then
76         # create initial config that can be later modified
77         ../depot_tools/gclient config $svnurl --gclientfile=$gclient
78 fi
79
80 cp $gclient .gclient
81
82 # emulate gclient config, preserving our deps
83 sed -i -re '/"url"/ s,"http[^"]+","'$svnurl'",' .gclient
84
85 ../depot_tools/gclient sync --nohooks -v
86
87 # Populate the LASTCHANGE file template as we will not include VCS info in tarball
88 (cd src && svnversion > LASTCHANGE.in)
89 cd ..
90
91 tar -cJf $tarball --exclude-vcs $pkg
92 ../md5 $spec
93 ../dropin $tarball &
This page took 0.05192 seconds and 3 git commands to generate.