-
Notifications
You must be signed in to change notification settings - Fork 3
/
arm_build_oss_fedora.sh
executable file
·73 lines (63 loc) · 1.72 KB
/
arm_build_oss_fedora.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
72
73
#!/bin/bash
#
# arm_build_oss_fedora.sh
#
# This script will build all opensource components using mock on a
# ARM device in order to create a "cleanly built" repository for arm.
# Attempting to mimic having an actual build system the best we can.
#
# Author: Adam Miller <[email protected]>
# Adam Miller <[email protected]>
f_ctrl_c() {
printf "\n*** Exiting ***\n"
exit $?
}
# trap int (ctrl-c)
trap f_ctrl_c SIGINT
# "Global" variables
mock_target="fedora-19-armhfp-custom"
declare -a failed_builds
f_usage() {
cat <<EOF
Usage: arm_build_oss_fedora.sh [Origin_Directory]
EOF
exit 1
}
mock_working_dir=/var/tmp/build_oss_arm/$2
# check mock stuff
if ! mock --version &> /dev/null; then
printf "ERROR: mock not installed or not in current \$PATH\n"
exit 2
fi
if [[ ! -f /etc/mock/${mock_target}.cfg ]]; then
printf "ERROR: $mock_target is an invalid mock build target\n"
printf "\tNo /etc/mock/${mock_target}.cfg found\n"
exit 3
fi
# clean the old build working dir
if [[ -d $mock_working_dir ]]; then
rm -fr $mock_working_dir
fi
mkdir -p $mock_working_dir
# Run through the SRPMS
for i in $(find $1 -name \*.src.rpm)
do
mock -r ${mock_target} $i
if [[ "$?" != "0" ]]; then
failed_builds+=( "$i" )
else
# NOTE: This is subject to failure if the config choses a different rootdir
# but all defaults don't do anything that silly
mv /var/lib/mock/${mock_target}/result/*.rpm $mock_working_dir
fi
done
if [[ -z $failed_builds ]]; then
printf "Build: SUCCESS\n"
else
printf "Build: FAILURE\nThe following packages failed to build:\n"
for f in ${failed_builds[@]}
do
printf "${f}\n"
done
fi
printf "All successfull builds can be found in $mock_working_dir\n"