File: mksnapbranches

package info (click to toggle)
mkgmap 0.0.0%2Bsvn4905-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 12,032 kB
  • sloc: java: 73,856; xml: 1,695; python: 713; sh: 240; makefile: 149; perl: 31
file content (59 lines) | stat: -rwxr-xr-x 1,193 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash

PROGDIR=$(dirname $(readlink -f $0))

export JAVA_HOME=/opt/java
export PATH="$JAVA_HOME/bin:$VIRTUAL_ENV/bin:/bin:/usr/bin:/usr/local/bin:$PROGDIR"
export LANG=en_GB.UTF-8

typeset -i VERSION
typeset -i MIN_VERSION

while getopts "d:" c
do
	case $c in
	d) SNAPDIR=$OPTARG;;
	esac
done
shift $[OPTIND-1]

PRODUCT=$1
if [ "$PRODUCT" = "" ]; then
	echo Usage: "mksnapbranches [-d dir] [-r vers] <product>"
	exit
fi

source mksnapfuncs

export LANG=en_GB.UTF-8

SVN=http://svn.mkgmap.org.uk/$PRODUCT
SNAPDIR=${SNAPDIR:-$HOME/www/mkgmap.org.uk/docroot/download}

# Get the commit time of the given path
svn_get_time() {
	typeset time
	time=$(svn log --xml --limit 1 $SVN/$1 2> /dev/null | sed \
		-n -e 's/<date>\(.*\)<\/date>/\1/;s/T/ /;s/Z/+0000/p'
		)
	date -d"$time" +%s
}

# We ignore all branches older than 90 days
MIN_TIME=$(svn_get_time trunk)
((MIN_TIME=MIN_TIME - 3600*24*90))

BRANCHES=$(svn ls $SVN/branches)
for branch in $BRANCHES
do
	BRANCH=${branch%/}
	BRANCH_TIME=$(svn_get_time branches/$BRANCH)

	if [ $BRANCH_TIME -lt $MIN_TIME ]; then
		echo Too old ignoring $BRANCH
		continue
	fi

	echo Building $BRANCH
	redis-cli lpush svn:build build:$PRODUCT:$BRANCH:
done