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
|
## 2.c. Basic locale
unset $(locale | cut -f 1 -d =)
## 2.d. Sane umask
umask 022
# 3. Update the Fossil repository
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :
# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )
# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config
excludedBranches=()
includedBranches=('')
buildCommands=('./autogen.sh || :' ./configure make)
testCommands=()
releaseCommands=()
builderID=''
projectName="$(fossil info -R "${repository}" | awk '/^project-name:/{ sub(/^project-name: */, ""); gsub(/ /, ""); print; }')"
tagSuffix=''
tagPrefix=''
## 5.b. Read config
config="$(fossil cat -R "${repository}" -r trunk "${fossilCIDir}/config" 2>/dev/null)" || :
## 5.c Load config
if [ -f ~/.fossil-ci/config ]; then
. ~/.fossil-ci/config
fi
eval "${config}"
if [ -f ~/.fossil-ci/"${projectName}"/config ]; then
. ~/.fossil-ci/"${projectName}"/config
fi
## 5.d. Post-process config
if [ -z "${tagSuffix}" ]; then
if [ -n "${builderID}" ]; then
tagSuffix="-${builderID}"
fi
fi
# 6. Perform any configured initialization
|
>
>
|
>
|
>
|
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
|
## 2.c. Basic locale
unset $(locale | cut -f 1 -d =)
## 2.d. Sane umask
umask 022
# 3. Update the Fossil repository
fossil config -R "${repository}" pull all >/dev/null 2>/dev/null || :
fossil sync -R "${repository}" >/dev/null 2>/dev/null || :
# 4. Get a list of branches
branches=( $(fossil branch -R "${repository}" list) )
# 5. Get Fossil CI configuration from the trunk branch
## 5.a. Set default config
excludedBranches=()
includedBranches=('')
buildCommands=('./autogen.sh || :' ./configure make)
initCommands=()
postCommands=()
branchPostCommands=()
testCommands=()
builderID=''
projectName="$(fossil info -R "${repository}" | awk '/^project-name:/{ sub(/^project-name: */, ""); gsub(/ /, ""); print; }')"
tagSuffix=''
tagPrefix=''
## 5.b. Read config
config="$(fossil cat -R "${repository}" -r trunk "${fossilCIDir}/config" 2>/dev/null)" || :
## 5.c Load config
if [ -f ~/.fossil-ci/config ]; then
. ~/.fossil-ci/config
fi
eval "${config}"
if [ -f ~/.fossil-ci/"${projectName}"/config ]; then
. ~/.fossil-ci/"${projectName}"/config
fi
## 5.d. Post-process config
### 5.d.i. Add builderID as a tag suffix if none was given
if [ -z "${tagSuffix}" ]; then
if [ -n "${builderID}" ]; then
tagSuffix="-${builderID}"
fi
fi
# 6. Perform any configured initialization
|
178
179
180
181
182
183
184
185
186
187
188
|
fossil amend -R "${repository}" "${branch}" "${tagsToAddOpts[@]}" > "${builddir}/update.log" 2>&1
### 7.i. Upload the logs somewhere if requested
#### XXX:TODO
### 7.j. Upload build artifacts somewhere if requested
#### XXX:TODO
done
# 8. Clean up any branches that no longer exist
## XXX:TODO
|
>
>
>
>
>
>
>
>
>
|
>
>
|
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
fossil amend -R "${repository}" "${branch}" "${tagsToAddOpts[@]}" > "${builddir}/update.log" 2>&1
### 7.i. Upload the logs somewhere if requested
#### XXX:TODO
### 7.j. Upload build artifacts somewhere if requested
#### XXX:TODO
### 7.k. Get a list of tags
tags=( $(fossil tag -R "${repository}" list "${branch}") )
# 8. Perform post-build work (e.g., for release engineering)
(
cd "${branchdir}" || exit 1
for cmd in "${branchPostCommands[@]}"; do
( eval "set -x; ${cmd}" ) || exit 1
done
) > "${builddir}/post.log" 2>&1 || :
done
# 9. Clean up any branches that no longer exist
## XXX:TODO
|