-
Notifications
You must be signed in to change notification settings - Fork 1
/
busybox.sh
executable file
·62 lines (59 loc) · 3 KB
/
busybox.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
#!/bin/bash
add-busybox-kconfig-history(from=, to=) {
add-system --system busybox --url https://github.com/mirror/busybox
for revision in $(git-tag-revisions busybox | exclude-revision pre alpha rc | start-at-revision "$from" | stop-at-revision "$to"); do
add-revision --system busybox --revision "$revision"
add-kconfig \
--system busybox \
--revision "$revision" \
--kconfig-file Config.in \
--kconfig-binding-files scripts/kconfig/*.o
done
}
add-busybox-kconfig-history-full() {
add-system --system busybox --url https://github.com/mirror/busybox
for revision in $(git -C "$(input-directory)/busybox-models" log master --format="%h" | tac); do
local original_revision
original_revision=$(git -C "$(input-directory)/busybox-models" rev-list --max-count=1 --format=%B "$revision" | sed '/^commit [0-9a-f]\{40\}$/d')
add-revision --system busybox-models --revision "${revision}[$original_revision]"
add-kconfig \
--system busybox-models \
--revision "${revision}[$original_revision]" \
--kconfig-file Config.in \
--kconfig-binding-files scripts/kconfig/*.o
done
}
generate-busybox-models() {
git-checkout master "$(input-directory)/busybox" > /dev/null
git -C "$(output-directory)" init -q
echo "*.log" >> "$(output-directory)/.gitignore"
echo "*.err" >> "$(output-directory)/.gitignore"
local i n
i=0
n=$(git -C "$(input-directory)/busybox" log --format="%h" | wc -l)
git -C "$(input-directory)/busybox" log --format="%h" | tac | while read -r revision; do
((i+=1))
local timestamp
timestamp=$(git-timestamp busybox "$revision")
local dir
dir=$(output-directory)
rm -rf "${dir:?}/*"
git-checkout "$revision" "$(input-directory)/busybox" > /dev/null
if [[ -f "$(input-directory)/busybox/scripts/gen_build_files.sh" ]]; then
chmod +x "$(input-directory)/busybox/scripts/gen_build_files.sh"
make -C "$(input-directory)/busybox" gen_build_files >/dev/null 2>&1 || true
fi
(cd "$(input-directory)/busybox" || exit; find . -type f -name "*Config.in" -exec cp --parents {} "$(output-directory)" \;)
mkdir -p "$(output-directory)/scripts/"
cp -R "$(input-directory)/busybox/scripts/"* "$(output-directory)/scripts/" 2>/dev/null || true
cp "$(input-directory)/busybox/Makefile"* "$(output-directory)" 2>/dev/null || true
cp "$(input-directory)/busybox/Rules.mak" "$(output-directory)" 2>/dev/null || true
git -C "$(output-directory)" add -A
if [[ $i -eq 1 ]] || ! git -C "$(output-directory)" diff --staged --exit-code '*Config.in' >/dev/null 2>&1; then
log "[$i/$n] $revision"
log "" "$(echo-progress gen)"
GIT_COMMITTER_DATE=$timestamp git -C "$(output-directory)" commit -q -m "$revision" --date "$timestamp" >/dev/null || true
log "" "$(echo-done)"
fi
done
}