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
|
#!/bin/bash
# Update a SVN branch and snapshot the latest revision
# Can also snapshot past revisions and add a per-user
# suffix
set -e
. ~/.config/cbuild/toolsrc
# Directory this script runs from
here=`dirname $0`
# Suffix for manual pulls
SUFFIX=${SUFFIX:-}
# Pull a branch and tarball it up
branch=$1
head=$2
svn up -q $branch
# Recent SVN adds a last changed revision field. Delete spaces to
# strip the space from the revno and, coincidentally, make the field
# easier to match.
latest=$(svn info $branch | tr -d ' ' | awk -F: '/LastChangedRev/ { print $2 }')
revno=${REVNO:-$latest}
if [ "x${head}" != "x" ]; then
name=${head}svn$revno$SUFFIX
tar=/tmp/$name.tar
xdelta=$snapshots/$name.tar.xdelta3.xz
if [ ! -f $xdelta ]; then
echo Exporting and stamping $revno
tmp=`mktemp -d`
rm -rf $tmp/$name
svn export $branch $tmp/$name
REVNO=$revno $here/stamp_branch.sh $branch $tmp/$name
# Create the tarball
echo Creating $tar
(cd $tmp && find "$name" -print0 | sort -z) | tar caf $tar -C $tmp --no-recursion --null -T -
rm -rf $tmp
# Create the delta
closest=`$here/closest.py $tar $snapshots/base/*.tar`
echo Making the delta relative to $closest
xdelta3 -fe -s $closest $tar $tar.xdelta3
rm -f $tar
xz -f $tar.xdelta3
mv $tar.xdelta3.xz $snapshots
echo New snapshot $head $revno created
$here/spawn.sh $tar
fi
fi
|