Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3113 - (show annotations) (download) (as text)
Tue Mar 19 16:12:08 2019 UTC (5 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 4060 byte(s)
-place build infos in a subdir named '${PNAME}'
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 # create build info dir
84 install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME}
85
86 # save STATE, gets deleted by regen_mage_tree
87 BUILDSERVER_SAVED_STATE="${STATE}"
88
89 #regen_mage_tree # do this after dep install
90 TARGET_MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
91 TARGET_SRC_TARBALL="/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}"
92
93 if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
94 then
95 echo -en "Package "
96 echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
97 echo -e " already installed. try a revup."
98 exit 3
99 fi
100
101 if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_OK ]
102 then
103 echo -en "Package "
104 echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
105 echo -e " already build successfully. try a revup."
106 exit 3
107 fi
108
109 #if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED ]
110 #then
111 # echo -en "Package "
112 # echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
113 # echo -e " build has failed already. try to fix build and revup or enforce rebuild."
114 # exit 3
115 #fi
116
117 # get all dependencies of this package
118 echo
119 echo -n "Calculating dependencies ... "
120 INSTALL_DEPS="$(${MLIBDIR}/depwalker.sh \
121 --method install-build-prerequisites \
122 --smage ${SMAGESCRIPTSDIR}/${SMAGEFILE})"
123
124 # honor split packages
125 if [[ -n ${SPLIT_PACKAGES} ]]
126 then
127 split_save_variables
128 for subpackage in ${SPLIT_PACKAGES}
129 do
130 # get the right variables for the split
131 export PNAME="${subpackage}"
132 split_info_${PNAME}
133
134 if [[ -z ${SRC_INSTALL_DEPS} ]]
135 then
136 SRC_INSTALL_DEPS="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
137 else
138 SRC_INSTALL_DEPS+=" ${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
139 fi
140 # restore smage environment
141 split_restore_variables
142 done
143 # unset all saved smage variables
144 split_unset_variables
145 else
146 SRC_INSTALL_DEPS="${TARGET_MAGEFILE}"
147 fi
148 echo "done"
149
150 echo
151 echo "---- dependencies ----"
152 install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}
153 echo "INSTALL_DEPS:"
154 : > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS
155 for i in ${INSTALL_DEPS}
156 do
157 echo " * ${i}"
158 echo "${i}" >> ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_DEPS
159 done
160 echo "SRC_INSTALL_DEPS:"
161 : > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS
162 for i in ${SRC_INSTALL_DEPS}
163 do
164 echo " * ${i}"
165 echo "${i}" >> ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS
166 done
167 echo "----------------------"

Properties

Name Value
svn:executable *