fix Math_Stats autoload
[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
adbdb0e8
ER
13 version=${rev#eventum-}
14 version=${version%%-*}
d7403aef 15 rev=${rev#eventum-*-}
899100ff 16 rev=${rev%.tar.gz}
adbdb0e8 17 rev=${rev%.tar.xz}
899100ff
ER
18elif [ "$1" ]; then
19 rev=$1
2023f198
ER
20else
21 # use tarball from "snapshot" build
22 git fetch "$repo_url" refs/tags/snapshot
0ba58a58
ER
23 # save this under some local ref, so repeated calls don't have to fetch everything
24 git update-ref refs/keep-around/snapshot FETCH_HEAD
2023f198 25 out=$(git show FETCH_HEAD -s)
adbdb0e8 26 tarball=$(echo "$out" | grep -oE 'eventum-.*\.tar.(gz|xz)')
2023f198
ER
27 url="$repo_url/releases/download/snapshot/$tarball"
28 test -f "$tarball" || wget -c $url
29 exec "$0" "$tarball"
899100ff 30fi
858c6f2a 31
d7403aef
ER
32subver=${rev%-*}
33githash=${rev#*-g}
34
35echo "Using $rev (subver: $subver, githash: $githash)..."
36
37oldsubver=$(awk '/^%define[\t ]+subver[\t ]+/{print $NF}' $specfile)
38oldgithash=$(awk '/^%define[\t ]+githash[\t ]+/{print $NF}' $specfile)
39if [ "$oldsubver" = "$subver" -a "$oldgithash" = "$githash" ]; then
858c6f2a 40 echo "Already up to date"
d7403aef 41 exit 0
858c6f2a 42fi
d7403aef
ER
43
44echo "Updating $specfile for $rev (subver: $subver, githash: $githash)..."
2023f198
ER
45sed -i -re "
46 s/^[#%](define[ \t]+subver[ \t]+)[0-9]+\$/%\1$subver/
47 s/^[#%](define[ \t]+githash[ \t]+)[0-9a-fg]+\$/%\1$githash/
924a5a4b
ER
48 /^Source0:.*download\/v/ s/^/#/
49 /^#Source0:.*download\/snapshot/ s/^#//
d7403aef
ER
50" $specfile
51../builder -ncs -5 $specfile
adbdb0e8
ER
52
53git commit -am "up to $version-$rev"
This page took 1.299928 seconds and 4 git commands to generate.