forked from FactomProject/FactomCode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
all-travis.sh
executable file
·144 lines (135 loc) · 4.42 KB
/
all-travis.sh
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
# Copyright 2015 Factom Foundation
# Use of this source code is governed by the MIT
# license that can be found in the LICENSE file.
# To be run from within the FactomCode project.
#
# Factom has a pile of dependencies, and development requries that these be
# kept in sync with each other. This script allows you to check out a
# particular branch in many repositories, while specifying a default branch.
#
# So for example, if you want to check development, and default to master:
#
# ./all.sh development master
#
# Or if you have your own branch TerribleBug, building off development:
#
# ./all.sh TerribleBug development
#
# Any repository that doesn't have a development branch in this last case
# is going to default to master.
#
cd ..
if [[ -z $1 ]]; then
echo "
*********************************************************
* Defaulting... Checking out Master
*
* ./all.sh <branch> <default>
*
* Will try to check out <branch>, will default
* to <default>, and if neither exists, or are
* missing, will checkout the master branch.
*
*********************************************************"
branch=master
default=master
else
echo "
*********************************************************
* Checking out the" ${parameter[1]} "branch
*
* ./all.sh <branch> <default>
*
* Will try to check out <branch>, will default
* to <default>, and if neither exists, or are
* missing, will checkout the master branch.
*
*********************************************************"
branch=$1
if [[ -z $2 ]]; then
default=master
else
default=$2
fi
fi
checkout() {
current=`pwd`
cd $1 $2 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo $1 | awk "{printf(\"%15s\",\"$1\")}"
git pull 2>&1 | awk '/There is no tracking.*/{printf " Current branch is not tracking anything in Github\n\t\t"}'
git checkout -q $2 > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e -n " now on" $2 # checkout did not fail
else
git checkout -q $3 > /dev/null 2>&1
if [ $? -ne 0 ]; then
git checkout -q master > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e -n " ****checkout failed!!!"
else
echo -n " defaulting to master"
fi
else
echo -n " defaulting to" $3
fi
fi
git status | awk '/^Your branch is [ab]/ {$1="";$2="";FS=" ";printf(" and%s",$0)}; /Your branch and/{printf("\n\t\t%s",$0)}'
echo
git pull 2>&1 | awk '$1=="error:" {print "\t\t"$0};/\|/{print("\t\t"$0)}'
git status | awk '/:/ {if(!a[$0]){print"\t\t"$0}; a[$0]=1}'
git status | awk '/^Untracked files.*/ {g=1}; /^\t.*/ { if(g) print"\t\tUntracked: "$1 }'
cd $current
else
echo $1 | awk "{printf(\"%15s\",\"$1\")}"
echo " not found"
fi
}
compile() {
cerr=0
current=`pwd`
cd $1
echo "Compiling: " $1
go clean
go install || cerr=1
cd $current
return $cerr
}
checkout FactomCode $branch $default
checkout btcd $branch $default
checkout factoid $branch $default
checkout fctwallet $branch $default
checkout factom $branch $default
checkout factom-cli $branch $default
checkout Testing $branch $default
checkout btcrpcclient $branch $default
checkout btcutil $branch $default
checkout btcws $branch $default
checkout gobundle $branch $default
checkout goleveldb $branch $default
checkout FactomDocs master master
checkout gocoding master master
checkout btcjson $branch $default
checkout btclog $branch $default
checkout dynrsrc $branch $default
checkout ed25519 $branch $default
checkout fastsha256 $branch $default
checkout go-bip32 $branch $default
checkout go-bip39 $branch $default
checkout go-flags $branch $default
checkout go-socks $branch $default
checkout seelog $branch $default
checkout snappy-go $branch $default
checkout websocket $branch $default
checkout walletapp $branch $default
echo "
********************************************************
* Compiling fctwallet, the cli, and factomd
********************************************************
"
compile FactomCode/factomd || exit 1
compile fctwallet || exit 1
compile factom-cli || exit 1
compile walletapp || exit 1
cd FactomCode