forked from griddynamics/openstack-rhel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trigger.conf
52 lines (34 loc) · 1.89 KB
/
trigger.conf
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
Debug="1"
jenkins="localhost:8080"
# Name of our project. Taken from spec by default
[ $prj ] || prj=$(grep '^Name:' $OurSpec | sed 's/^Name:\s\+//')
# Storage for our specs
[ $GithubUserProject ] || GithubUserProject="griddynamics/openstack-rhel"
# Source taken from here
[ $GithubSource ] || GithubSource=$GithubUserProject
## Where is tarballs?
[ $TarballsHome ] || TarballsHome="http://$prj.openstack.org/tarballs"
## Where is SPEC?
[ $OurSpec ] || OurSpec="openstack-$prj.spec"
# Added behind release.
ReleasePreSymbol="0."
## Get version of latest TarBall. Returns 2 value: Version and Release. You need to construct your own regexp for your source.
[ $CurTarballVer ] || CurTarballVer=(`curl -s $TarballsHome/?C=M\;O=D| grep -m 1 $prj-[0-9] | perl -p -e 's!^.*$prj-(\d+\.\d+)~(\w\d)~(\d+.\d+)\.tar\.gz.*$!\n$1 $2 $3 $4 $5\n!i'`)
[ $ActualVersion ] || ActualVersion=${CurTarballVer[0]}
[ $ActualRelease ] || ActualRelease=$ReleasePreSymbol${CurTarballVer[2]}
[ $DevMileStone ] || DevMileStone=${CurTarballVer[1]}
[ $ActualTarBall ] || ActualTarBall="$prj-$ActualVersion~$DevMileStone~${CurTarballVer[2]}.tar.gz"
SpecVersion=$(grep '^Version:' $OurSpec | sed 's/^Version:\s\+//')
SpecRelease=$(grep '^Release:' $OurSpec | sed 's/^Release:\s\+//' | sed 's/%{?dist}$//')
# Obtaining current branch name from our local git repo
[ $GitCurBranch ] || GitCurBranch="$(git branch|grep '*'|cut -f2 -d' ')"
[ $Debug ] && echo "Current branch $GitCurBranch"
[ $GitDevBranchName ] || GitDevBranchName="master"
abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
dirname="$(dirname $abspath)"
cd "$dirname" || exit -1
RpmTree=`grep topdir $HOME/.rpmmacros 2>/dev/null | awk '{print ($2)}'`
[ "$RpmTree" == "" ] && RpmTree="$HOME/rpmbuild/"
RepoPath="/home/build/repo/$GitCurBranch/openstack"
LocalSourcePath="/home/build/local-source"
JobName="$(echo $dirname | sed 's/^.*\/jobs\/\([^/]\+\)\/workspace$/\1/')"