-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathforcebuild
More file actions
executable file
·38 lines (33 loc) · 1.13 KB
/
forcebuild
File metadata and controls
executable file
·38 lines (33 loc) · 1.13 KB
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
#!/bin/bash
cd "$(dirname "$0")" ; here="$(pwd)"
source "$here/common"
[ ! $# = 2 ] && die "Usage: rebuild <project> <branch-widlcard> <build-wildcard>"
branches_pattern="$1"
builds_pattern="$2"
toclean=( )
pushd "$logs/branches" > /dev/null
eval "branches=( $branches_pattern )"
[ ${#branches[@]} = 0 ] && die "No matching branches for $branches_pattern!"
for branch in "${branches[@]}" ; do
[ -d "$branch" ] || continue
pushd "$branch" > /dev/null
eval "builds=( $builds_pattern.ref )"
for build in "${builds[@]}" ; do
[ -f "$build" ] || continue
commit="$(cat "$build")"
build="${build%.ref}"
# echo "Forcing rebuild for ${dim_cyan}$branch${reset}/${dim_green}$build${reset}"
toclean+=( "$commit/$build" )
done
popd > /dev/null
done
[ ${#toclean[@]} = 0 ] && die "No matching builds for $builds_pattern in $branches_pattern!"
popd > /dev/null
pushd "$logs/commits" > /dev/null
for commitbuild in "${toclean[@]}" ; do
commit="${commitbuild%%/*}"
build="${commitbuild#*/}"
echo "Forcing rebuild for ${dim_blue}$commit${reset}/${dim_green}$build${reset}"
touch "$commitbuild.force"
done
popd > /dev/null