Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2765 - (show annotations) (download) (as text)
Thu Aug 28 08:20:03 2014 UTC (9 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 4803 byte(s)
-be more silent
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 load_mage_features
66 mage_setup
67
68 if [[ -z ${SMAGEFILE} ]]
69 then
70 die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'"
71 fi
72
73 if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ]
74 then
75 # be silent
76 FVERBOSE=off \
77 SILENT=1 \
78 smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE}
79 else
80 die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found."
81 fi
82
83 # save STATE, gets deleted by regen_mage_tree
84 BUILDSERVER_SAVED_STATE="${STATE}"
85
86 #regen_mage_tree # do this after dep install
87 TARGET_MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
88 TARGET_SRC_TARBALL="/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}"
89
90 # create build info dir
91 install -d ${BUILDSERVER_CACHE_DIR}/build
92
93 if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS ]
94 then
95 die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS missing. run 'buildserver-build-depends first"
96 fi
97
98 SRC_INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS)"
99
100 if [[ -z ${SRC_INSTALL_DEPS} ]]
101 then
102 die "buildserver-build: SRC_INSTALL_DEPS are empty, aborting."
103 fi
104
105 # save STATE, gets deleted by regen_mage_tree
106 BUILDSERVER_SAVED_STATE="${STATE}"
107
108 #regen_mage_tree # do this after dep install
109 TARGET_MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
110 TARGET_SRC_TARBALL="/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}"
111
112 if [ ! -f ${TARGET_SRC_TARBALL} ]
113 then
114 die "${TARGET_SRC_TARBALL} is missing"
115 fi
116
117 if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
118 then
119 echo -en "Package "
120 echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
121 echo -e " already installed. try a revup."
122 exit 3
123 fi
124
125 if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/BUILD_OK ]
126 then
127 echo -en "Package "
128 echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
129 echo -e " already build successfully. try a revup."
130 exit 3
131 fi
132
133 #if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED ]
134 #then
135 # echo -en "Package "
136 # echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
137 # echo -e " build has failed already. try to fix build and revup or enforce rebuild."
138 # exit 3
139 #fi
140
141 # create build info dir
142 install -d ${BUILDSERVER_CACHE_DIR}/build
143
144 echo
145 echo "---- environment -----"
146 echo "MROOT: ${FAKE_MROOT}"
147 echo "PKGDIR: ${PKGDIR}"
148 echo "BUILDDIR: ${BUILDDIR}"
149 echo "BINDIR: ${BINDIR}"
150 echo "$(mprintfeatures)"
151 echo "----------------------"
152 echo
153 #echo "DEBUG: paused"; read
154
155 if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES ]
156 then
157 die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES missing. run 'buildserver-build-prerequisites first"
158 fi
159
160 #### building target package from src-pkg tarball####
161 if smage2 --src-tarball ${TARGET_SRC_TARBALL}
162 then
163 build_retval=0
164 echo 0 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/BUILD_OK
165 echo "Build successfull!"
166 regen_mage_tree
167 # restore STATE
168 STATE="${BUILDSERVER_SAVED_STATE}"
169 if install_packages ${SRC_INSTALL_DEPS} || die "installing packages"
170 then
171 install_retval=0
172 echo 0 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_OK
173 echo "Install successfull!"
174 else
175 install_retval=1
176 echo 1 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/INSTALL_FAILED
177 echo "Installation *not* successfull!"
178 fi
179 else
180 build_retval=1
181 echo 1 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED
182 echo "Build failed"
183 echo "DEBUG: read"
184 read
185 fi
186
187 ## always run auto etc-update
188 echo "running etc-update"
189 echo "-5" | etc-update
190
191 exit ${build_retval}

Properties

Name Value
svn:executable *