Annotation of /trunk/mage-buildserver/helper/buildserver-lint.sh
Parent Directory | Revision Log
Revision 2761 -
(hide annotations)
(download)
(as text)
Thu Aug 28 08:16:21 2014 UTC (9 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 2393 byte(s)
Thu Aug 28 08:16:21 2014 UTC (9 years, 9 months ago) by niro
File MIME type: application/x-sh
File size: 2393 byte(s)
-adde rudimental lint checks
1 | niro | 2761 | #!/bin/bash |
2 | |||
3 | BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" | ||
4 | SMAGEFILE="$1" | ||
5 | |||
6 | if [ -f /etc/rc.d/init.d/functions ] | ||
7 | then | ||
8 | source /etc/rc.d/init.d/functions | ||
9 | else | ||
10 | die "/etc/rc.d/init.d/functions not found" | ||
11 | fi | ||
12 | if [ -f /etc/mage.rc.global ] | ||
13 | then | ||
14 | source /etc/mage.rc.global | ||
15 | else | ||
16 | die "/etc/mage.rc.global not found" | ||
17 | fi | ||
18 | if [ -f /etc/mage.rc ] | ||
19 | then | ||
20 | source /etc/mage.rc | ||
21 | else | ||
22 | die "/etc/mage.rc not found" | ||
23 | fi | ||
24 | if [ -f ${MLIBDIR}/mage4.functions.sh ] | ||
25 | then | ||
26 | source ${MLIBDIR}/mage4.functions.sh | ||
27 | else | ||
28 | die "${MLIBDIR}/mage4.functions.sh not found" | ||
29 | fi | ||
30 | if [ -f ${MLIBDIR}/smage2.functions.sh ] | ||
31 | then | ||
32 | source ${MLIBDIR}/smage2.functions.sh | ||
33 | else | ||
34 | die "${MLIBDIR}/smage2.functions.sh not found" | ||
35 | fi | ||
36 | |||
37 | # do this at least of all includes to prevent path overwrites | ||
38 | env-rebuild | ||
39 | source /etc/profile | ||
40 | |||
41 | # export default path | ||
42 | export PATH="${PATH}:${MLIBDIR}" | ||
43 | |||
44 | die() | ||
45 | { | ||
46 | echo "ERROR: $@" | ||
47 | exit 1 | ||
48 | } | ||
49 | |||
50 | is_split_target_magefile() | ||
51 | { | ||
52 | local mage="$1" | ||
53 | |||
54 | for target_mage in ${MY_SPLIT_TARGET_MAGEFILES} | ||
55 | do | ||
56 | if [[ ${mage} = ${target_mage} ]] | ||
57 | then | ||
58 | return 0 | ||
59 | fi | ||
60 | done | ||
61 | |||
62 | return 1 | ||
63 | } | ||
64 | |||
65 | lint_checks() | ||
66 | { | ||
67 | local dest="$1" | ||
68 | |||
69 | # check deps | ||
70 | echo | ||
71 | echo "Autodetect runtime soname dependencies for '${dest}':" | ||
72 | ${MLIBDIR}/autodepend.sh "${dest}" | ||
73 | echo | ||
74 | } | ||
75 | |||
76 | load_mage_features | ||
77 | mage_setup | ||
78 | |||
79 | if [[ -z ${SMAGEFILE} ]] | ||
80 | then | ||
81 | die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" | ||
82 | fi | ||
83 | |||
84 | if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ] | ||
85 | then | ||
86 | # be silent | ||
87 | FVERBOSE=off \ | ||
88 | SILENT=1 \ | ||
89 | smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE} | ||
90 | else | ||
91 | die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found." | ||
92 | fi | ||
93 | |||
94 | # create build info dir | ||
95 | install -d ${BUILDSERVER_CACHE_DIR}/build | ||
96 | |||
97 | # honor split packages | ||
98 | if [[ -n ${SPLIT_PACKAGES} ]] | ||
99 | then | ||
100 | split_save_variables | ||
101 | export SAVED_BINDIR="${BINDIR}" | ||
102 | for subpackage in ${SPLIT_PACKAGES} | ||
103 | do | ||
104 | # export subpackage bindir | ||
105 | export BINDIR="${SAVED_BINDIR}_${subpackage}" | ||
106 | # get the right variables for the split | ||
107 | export PNAME="${subpackage}" | ||
108 | split_info_${PNAME} | ||
109 | |||
110 | if [[ -z ${TARGETS} ]] | ||
111 | then | ||
112 | TARGETS="${BINDIR}" | ||
113 | else | ||
114 | TARGETS+=" ${BINDIR}" | ||
115 | fi | ||
116 | # restore smage environment | ||
117 | split_restore_variables | ||
118 | done | ||
119 | # unset all saved smage variables | ||
120 | split_unset_variables | ||
121 | else | ||
122 | TARGETS="${BINDIR}" | ||
123 | fi | ||
124 | |||
125 | echo "DEBUG: TARGETS='${TARGETS}'" | ||
126 | for dir in ${TARGETS} | ||
127 | do | ||
128 | #echo "DEBUG: running lint check for '${dir}'" | ||
129 | lint_checks "${dir}" | ||
130 | done | ||
131 | |||
132 | #echo "DEBUG lint: read"; read |