blob: 4b47cbab52165573cc77d34f8de88a86fa07a4c9 (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
#!/bin/bash
set -e
usage ()
{
cat <<EOF
Usage: $0 --dir-abe ABE/SNAPSHOTS --dir-llvm LLVM/REFERENCE [--OPT true/false]
This script generates source caches.
"--OPT true/false" options specify what to do:
--generate-abe true/false Generate ABE snapshots; default "true"
--generate-llvm true/false Generate LLVM reference repos; default "true"
--generate-misc true/false Generate misc repo and file caches; default "true"
--update-abe-git true/false Update ABE git repos; default "true"
--update-llvm-git true/false Update LLVM git repos; default "true"
--verbose true/false Be verbose; default "false"
EOF
exit 1
}
snapshots_dir=$HOME/snapshots-ref
generate_abe=true
generate_llvm=true
generate_misc=true
update_git=true
verbose=false
OPTS="`getopt -l generate-abe:,generate-llvm:,generate-misc:,update-git:,verbose: -- "$@"`"
while test $# -gt 0; do
case $1 in
--generate-abe) generate_abe="$2"; shift ;;
--generate-llvm) generate_llvm="$2"; shift ;;
--generate-misc) generate_misc="$2"; shift ;;
--update-git) update_git="$2"; shift ;;
--verbose) verbose="$2"; shift ;;
esac
shift
done
if $verbose; then
verbose="set -x"
else
verbose="set +x"
fi
# Checkout into $snapshots_dir using ABE
generate_snapshots ()
{
set -e
$verbose
local abe_temp="$(dirname "$0")/abe"
rm -rf $abe_temp
git clone --branch stable --depth 1 https://git-us.linaro.org/toolchain/abe $abe_temp
cd $abe_temp
./configure --with-local-snapshots=${snapshots_dir}-new
if [ -e $HOME/.aberc ]; then
echo "ERROR: $HOME/.aberc detected and it might override ABE's behavior"
exit 1
fi
targets=(
aarch64-linux-gnu
aarch64-none-elf
arm-linux-gnueabihf
arm-none-eabi
i686-linux-gnu
x86_64-linux-gnu
)
for t in "${targets[@]}"; do
for c in gcc5 gcc6 gcc7; do
./abe.sh --target $t --extraconfigdir config/$c --checkout all
done
done
# Remove checked-out branch directories
rm -rf ${snapshots_dir}-new/*~*
# Remove md5sums to force ABE to fetch canonical version via http://.
rm -f ${snapshots_dir}-new/md5sums
}
generate_misc_files ()
{
set -e
$verbose
# Distribute Foundation Model to the builders so that containers
# running there can access Foundation Model via a bind-mount for
# bare-metal testing.
tar xf $HOME/public_html/infrastructure/FM000-KT-00035-r9p5-41rel0.tgz -C $HOME/${snapshots_dir}-new
chmod -R ugo+rx $HOME/${snapshots_dir}-new/Foundation_Platformpkg
# Clone the Linux kernel if not already
# present. Subsequent calls will update it.
linux_git=$HOME/${snapshots_dir}-new/linux.git
if [ ! -d ${linux_git} ]; then
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ${linux_git}
fi
# Add a 'next' remote for linux-next, if not already present
count=$(git -C ${linux_git} remote | grep -c next || true)
if [ $count -eq 0 ]; then
git -C ${linux_git} remote add next git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
fi
}
update_git_repos () {
set -e
$verbose
for repo in `ls ${snapshots_dir}-new/ | grep "\.git\$"`; do
(
cd ${snapshots_dir}-new/$repo
# Update and prune local clone
git remote update -p
# Cleanup stale branches
git branch | grep -v \* | xargs -r git branch -D
)
done
}
if $generate_abe; then
mkdir -p ${snapshots_dir}-new
# Remove *.asc files to fix cached incorrect md5sum files
rm -f ${snapshots_dir}-new/*.asc
update_git_repos
generate_snapshots
fi
if $generate_llvm; then
:
fi
if $generate_misc; then
generate_misc_files
fi
if $update_git; then
update_git_repos
fi
echo "Snapshots status:"
du -hs $snapshots_dir-new/*
|