forked from jvm-repo-rebuild/reproducible-central
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.sh
executable file
·52 lines (41 loc) · 1.5 KB
/
main.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
#!/bin/bash
export CI=true
success_count=0
failure_count=0
# Set the path to the result directory
RESULT_DIR="./results"
# Set the path to the rebuild_to_get_diffoscope.sh script
REBUILD_SCRIPT="./rebuild.sh"
# Check if the result directory exists
if [ ! -d "$RESULT_DIR" ]; then
echo "Error: Result directory not found: $RESULT_DIR"
exit 1
fi
# Check if the rebuild script exists and is executable
if [ ! -x "$REBUILD_SCRIPT" ]; then
echo "Error: Rebuild script not found or not executable: $REBUILD_SCRIPT"
exit 1
fi
# Find all buildspec files in the result directory and its subdirectories
while read -r buildspec; do
echo "Processing buildspec: $buildspec"
buildspec_dir=$(dirname "$buildspec")
if ls $buildspec_dir/*.buildcompare 1> /dev/null 2>&1;
then
echo "Skipping $buildspec as .buildcompare file exists"
continue
fi
# Call the rebuild_to_get_diffoscope.sh script with the buildspec file
"$REBUILD_SCRIPT" "$buildspec"
# Check the exit status of the rebuild script
if [ $? -ne 0 ]; then
echo "Warning: rebuild_to_get_diffoscope.sh failed for $buildspec" >> "$RESULT_DIR/failed_rebuilds.txt"
((failure_count++))
else
((success_count++))
fi
echo "Finished processing: $buildspec"
echo "----------------------------------------"
done < <(find "$RESULT_DIR" -type f -name "*.buildspec")
echo "All buildspec files have been processed."
echo "Summary: $success_count successes, $failure_count failures"