-
Notifications
You must be signed in to change notification settings - Fork 2
/
multibuild.sh
executable file
·71 lines (58 loc) · 1.67 KB
/
multibuild.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
#!/bin/bash
WORKDIR=${WORKDIR:=/home/arch/repos}
ZSTLOGDIR=${ZSTLOGDIR:=/home/arch/build}
max_retries=2
total_pkgs=$(wc -l < pkg)
current_pkg=0
DOUBLEDASH="--"
for para in "$@"; do
if [[ $para == "--" ]]; then
DOUBLEDASH=""
break
fi
done
umask 022
rm -f multistop
for i in $(cat pkg); do
retries=0
((current_pkg++))
# comment out
if [[ "$i" == --* ]]; then
continue
fi
if [[ "$i" == *:nocheck ]]; then
NOCHECK=--nocheck
i=${i%:nocheck}
else
NOCHECK=""
fi
# the pkg can have version info in it
if [[ "$i" == *:* ]]; then
VER="--ver ${i#*:}" # Extracts the version part after the first ":"
i=${i%%:*}; # Extracts the pkgbase part before the first ":"
else
VER=""
fi
while [[ $retries -lt $max_retries ]]; do
./loong-build.sh $i $VER "$@" $DOUBLEDASH $NOCHECK
((retries++))
if [[ -f all.log ]]; then
ALLLOGS=all.log
else
PKGVER=$(source $WORKDIR/$i/PKGBUILD; echo $epoch${epoch:+:}$pkgver-$pkgrel)
ALLLOGS=$ZSTLOGDIR/$i/$i-$PKGVER.log
fi
# restart to download the corrupted packages
grep "pkg.tar.zst is corrupted" $ALLLOGS >/dev/null 2>&1 && continue
# update config.{sub,guess} and retry
grep -q "unable to guess system type" $ALLLOGS && echo $i >> ~/loongarch-packages/update_config && continue
break
done
# tracking the soname changes
grep -A4 "WARNING.*Sonames differ" $ALLLOGS >> sonames.log
echo "$i - $current_pkg/$total_pkgs" > progress.log
if [[ -f "multistop" ]]; then
exit 0
fi
done
rm -f progress.log