]> git.pld-linux.org Git - packages/apache-mod_pagespeed.git/blobdiff - get-source.sh
- added format patch (fix size_t vs uint64_t format string)
[packages/apache-mod_pagespeed.git] / get-source.sh
index b39e0aa542fcb04ddd7fccf94874544b2306691f..3ef72e8ad7564068c9cce5a92770cdf70a58118a 100755 (executable)
@@ -5,18 +5,23 @@
 #
 # To see release notes, see this page:
 # https://developers.google.com/speed/docs/mod_pagespeed/release_notes
+# Bulding from source notes:
+# https://developers.google.com/speed/pagespeed/module/build_mod_pagespeed_from_source
 
-pkg=modpagespeed
-baseurl=http://modpagespeed.googlecode.com/svn
+package=modpagespeed
+repo_url=https://github.com/pagespeed/mod_pagespeed.git
 # leave empty to use latest tag, or "trunk" for trunk
-version=
+# specific version, "latest-stable" or "master" (bleeding edge version)
+version=latest-stable
 spec=apache-mod_pagespeed.spec
+# depth to clone, do not use this as ./build/lastchange.sh uses 'git rev-list --all --count' to count revision
+depth=
 force=0
 
 # abort on errors
 set -e
 # work in package dir
-dir=$(dirname "$0")
+dir=$(readlink -f $(dirname "$0"))
 cd "$dir"
 
 if [[ "$1" = *force ]]; then
@@ -28,21 +33,30 @@ if [ "$1" ]; then
        version=$1
 fi
 
-if [ -z "$version" ]; then
-       echo "Looking for latest version..."
-       version=$(svn ls $baseurl/tags/ | grep '^[0-9]' | sort -V | tail -n1)
-       version=${version%/}
-fi
+export GIT_DIR=$package/src/.git
+
+# refs to fetch: master and latest-stable
+refs="refs/heads/master:refs/remotes/origin/master refs/heads/latest-stable:refs/remotes/origin/latest-stable"
 
-if [ "$version" = "trunk" ]; then
-       echo "Using trunk"
-       svnurl=$baseurl/trunk/src
-       tarball=$pkg-$(date +%Y%m%d).tar.xz
+if [ ! -d $GIT_DIR ]; then
+       install -d $GIT_DIR
+#      git init --bare
+       git init
+       git remote add origin $repo_url
+       git fetch ${depth:+--depth $depth} origin $refs
 else
-       echo "Version: $version"
-       svnurl=$baseurl/tags/$version/src
-       tarball=$pkg-$version.tar.xz
+       git fetch origin $refs
 fi
+unset GIT_DIR
+
+cd $package/src
+git checkout $version
+
+version=$(git describe --tags)
+echo "Version: $version"
+
+release_dir=$package-$version
+tarball=$dir/$release_dir.tar.xz
 
 if [ -f $tarball -a $force != 1 ]; then
        echo "Tarball $tarball already exists"
@@ -55,39 +69,51 @@ if python -c "import sys; sys.exit(sys.version[:3] > '2.6')"; then
        exit 1
 fi
 
-# http://www.chromium.org/developers/how-tos/install-depot-tools
-test -d depot_tools || {
-       # could also checkout:
-       # svn co http://src.chromium.org/svn/trunk/tools/depot_tools
-       wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip
-       unzip -qq depot_tools.zip
-#      cd depot_tools
-#      svn upgrade
-#      cd ..
-       chmod a+x depot_tools/gclient depot_tools/update_depot_tools
-}
-
-topdir=${PWD:-($pwd)}
-gclient=$topdir/gclient.conf
-install -d $pkg
-cd $pkg
-
-if [ ! -f $gclient ]; then
+gclient=$(which gclient 2>/dev/null)
+if [ -z "$gclient" ]; then
+       # http://www.chromium.org/developers/how-tos/install-depot-tools
+       test -d depot_tools || {
+               # could also checkout:
+               # svn co http://src.chromium.org/svn/trunk/tools/depot_tools
+               wget -c https://src.chromium.org/svn/trunk/tools/depot_tools.zip
+               unzip -qq depot_tools.zip
+               chmod a+x depot_tools/gclient depot_tools/update_depot_tools
+       }
+       gclient=$dir/depot_tools/gclient
+fi
+
+gclientfile=$dir/gclient.conf
+cd $dir/$package
+
+if [ ! -f $gclientfile ]; then
        # create initial config that can be later modified
-       ../depot_tools/gclient config $svnurl --gclientfile=$gclient
+       $gclient config $repo_url --gclientfile=$gclientfile --unmanaged --name=src
 fi
 
-cp $gclient .gclient
+cp -p $gclientfile .gclient
 
 # emulate gclient config, preserving our deps
-sed -i -re '/"url"/ s,"http[^"]+","'$svnurl'",' .gclient
+sed -i -re '/"url"/ s,"http[^"]+","'$repo_url'",' .gclient
 
-../depot_tools/gclient sync --nohooks -v
+$gclient sync --nohooks -v
+
+rm -rf $release_dir
+cp -al src $release_dir
+cd $release_dir
+
+sh -x $dir/clean-source.sh
 
 # Populate the LASTCHANGE file template as we will not include VCS info in tarball
-(cd src && svnversion > LASTCHANGE.in)
+./build/lastchange.sh . -o LASTCHANGE.in
+
+cd ..
+
+XZ_OPT=-e9 \
+tar -caf $tarball --exclude-vcs $release_dir
+
+rm -rf $release_dir
+
 cd ..
 
-tar -cJf $tarball --exclude-vcs $pkg
 ../md5 $spec
 ../dropin $tarball &
This page took 0.026793 seconds and 4 git commands to generate.