This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build_feed
executable file
·59 lines (52 loc) · 1.74 KB
/
build_feed
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
#!/bin/bash
set -ex
if [ "$1" == "incontainer" ]; then
INSTR_SET="$(ls build_dir | awk -F'-|(_musl)' '{print $2}')"
if [ -d "bin/packages/$INSTR_SET" ]
then
echo "$INSTR_SET was built before. Skip";
exit 0;
fi
echo "$FEED_LINE" >> feeds.conf.default
logfile="bin/packages/$INSTR_SET/$FEED_NAME/build.log"
mkdir -p "$(dirname "$logfile")"
# the grep pipes further down would otherwise be buffered
unbuf="stdbuf --output=0 --error=0"
{
./scripts/feeds update -a # alternatively: -p luci falter
./scripts/feeds install -a -p "$FEED_NAME"
make defconfig
for pkg in $(find feeds/$FEED_NAME -name Makefile | awk -F/ '{print $(NF - 1)}'); do
make -j8 V=s "package/$pkg/compile"
done
make package/index V=s
} |& $unbuf grep -v 'warning: ignoring type redefinition' \
| $unbuf grep -v 'warning: defaults for choice' \
| $unbuf grep -v "linux/Makefile' has a dependency" \
| tee "$logfile"
else
SDK_TAG="$1"
FEED_LINE="$2"
OUTPUT_DIR="$3"
FEED_NAME=$(echo $FEED_LINE | awk '{print $2}')
IMAGE="openwrtorg/sdk:$SDK_TAG"
docker pull "$IMAGE"
mkdir -p "$OUTPUT_DIR"
if [ -n "$4" ]; then # Parallel build on buildbot needs to be performed without -i. Otherwise it won't work.
docker run --rm \
-v "$(pwd)/build_feed:/home/build/openwrt/build_feed" \
-v "$OUTPUT_DIR/:/home/build/openwrt/bin" \
-e "FEED_LINE=$FEED_LINE" \
-e "FEED_NAME=$FEED_NAME" \
"$IMAGE" \
./build_feed incontainer
else
docker run -it --rm \
-v "$(pwd)/build_feed:/home/build/openwrt/build_feed" \
-v "$OUTPUT_DIR/:/home/build/openwrt/bin" \
-e "FEED_LINE=$FEED_LINE" \
-e "FEED_NAME=$FEED_NAME" \
"$IMAGE" \
./build_feed incontainer
fi
fi