Magellan Linux

Contents of /trunk/mage-buildserver/helper/buildserver-lint.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2830 - (show annotations) (download) (as text)
Fri Sep 19 10:27:49 2014 UTC (9 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 2593 byte(s)
-log into LINT_CHECKS
1 #!/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 # set up LINT log
97 logdir="${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}"
98 logfile="${logdir}/LINT_CHECKS"
99
100 [ -d ${logdir} ] || install -d "${logdir}"
101 :> "${logfile}"
102
103 # honor split packages
104 if [[ -n ${SPLIT_PACKAGES} ]]
105 then
106 split_save_variables
107 export SAVED_BINDIR="${BINDIR}"
108 for subpackage in ${SPLIT_PACKAGES}
109 do
110 # export subpackage bindir
111 export BINDIR="${SAVED_BINDIR}_${subpackage}"
112 # get the right variables for the split
113 export PNAME="${subpackage}"
114 split_info_${PNAME}
115
116 if [[ -z ${TARGETS} ]]
117 then
118 TARGETS="${BINDIR}"
119 else
120 TARGETS+=" ${BINDIR}"
121 fi
122 # restore smage environment
123 split_restore_variables
124 done
125 # unset all saved smage variables
126 split_unset_variables
127 else
128 TARGETS="${BINDIR}"
129 fi
130
131 echo "DEBUG: TARGETS='${TARGETS}'"
132 for dir in ${TARGETS}
133 do
134 #echo "DEBUG: running lint check for '${dir}'"
135 lint_checks "${dir}" | tee -a "${logfile}"
136 done
137
138 #echo "DEBUG lint: read"; read