bundle symfony-ldap
[packages/eventum.git] / update-source.sh
CommitLineData
858c6f2a
ER
1#!/bin/sh
2set -e
3dropin=
2023f198 4repo_url=https://github.com/eventum/eventum
899100ff 5specfile=eventum.spec
858c6f2a
ER
6
7# Work in package dir
8dir=$(dirname "$0")
9cd "$dir"
10
899100ff 11if [ -f "$1" ]; then
858c6f2a 12 rev=$1
d7403aef 13 rev=${rev#eventum-*-}
899100ff 14 rev=${rev%.tar.gz}
899100ff
ER
15elif [ "$1" ]; then
16 rev=$1
2023f198
ER
17else
18 # use tarball from "snapshot" build
19 git fetch "$repo_url" refs/tags/snapshot
0ba58a58
ER
20 # save this under some local ref, so repeated calls don't have to fetch everything
21 git update-ref refs/keep-around/snapshot FETCH_HEAD
2023f198
ER
22 out=$(git show FETCH_HEAD -s)
23 tarball=$(echo "$out" | grep -o 'eventum-.*\.tar.gz')
24 url="$repo_url/releases/download/snapshot/$tarball"
25 test -f "$tarball" || wget -c $url
26 exec "$0" "$tarball"
899100ff 27fi
858c6f2a 28
d7403aef
ER
29subver=${rev%-*}
30githash=${rev#*-g}
31
32echo "Using $rev (subver: $subver, githash: $githash)..."
33
34oldsubver=$(awk '/^%define[\t ]+subver[\t ]+/{print $NF}' $specfile)
35oldgithash=$(awk '/^%define[\t ]+githash[\t ]+/{print $NF}' $specfile)
36if [ "$oldsubver" = "$subver" -a "$oldgithash" = "$githash" ]; then
858c6f2a 37 echo "Already up to date"
d7403aef 38 exit 0
858c6f2a 39fi
d7403aef
ER
40
41echo "Updating $specfile for $rev (subver: $subver, githash: $githash)..."
2023f198
ER
42sed -i -re "
43 s/^[#%](define[ \t]+subver[ \t]+)[0-9]+\$/%\1$subver/
44 s/^[#%](define[ \t]+githash[ \t]+)[0-9a-fg]+\$/%\1$githash/
d7403aef
ER
45" $specfile
46../builder -ncs -5 $specfile
This page took 0.265655 seconds and 4 git commands to generate.