Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3113 - (hide annotations) (download) (as text)
Tue Mar 19 16:12:08 2019 UTC (5 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 4949 byte(s)
-place build infos in a subdir named '${PNAME}'
1 niro 2747 #!/bin/bash
2    
3     BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver"
4     SMAGEFILE="$1"
5 niro 2766 LINT_CHECKS=1
6 niro 2747
7     if [ -f /etc/rc.d/init.d/functions ]
8     then
9     source /etc/rc.d/init.d/functions
10     else
11     die "/etc/rc.d/init.d/functions not found"
12     fi
13     if [ -f /etc/mage.rc.global ]
14     then
15     source /etc/mage.rc.global
16     else
17     die "/etc/mage.rc.global not found"
18     fi
19     if [ -f /etc/mage.rc ]
20     then
21     source /etc/mage.rc
22     else
23     die "/etc/mage.rc not found"
24     fi
25     if [ -f ${MLIBDIR}/mage4.functions.sh ]
26     then
27     source ${MLIBDIR}/mage4.functions.sh
28     else
29     die "${MLIBDIR}/mage4.functions.sh not found"
30     fi
31     if [ -f ${MLIBDIR}/smage2.functions.sh ]
32     then
33     source ${MLIBDIR}/smage2.functions.sh
34     else
35     die "${MLIBDIR}/smage2.functions.sh not found"
36     fi
37    
38     # do this at least of all includes to prevent path overwrites
39     env-rebuild
40     source /etc/profile
41    
42     # export default path
43     export PATH="${PATH}:${MLIBDIR}"
44    
45     die()
46     {
47     echo "ERROR: $@"
48     exit 1
49     }
50    
51     is_split_target_magefile()
52     {
53     local mage="$1"
54    
55     for target_mage in ${MY_SPLIT_TARGET_MAGEFILES}
56     do
57     if [[ ${mage} = ${target_mage} ]]
58     then
59     return 0
60     fi
61     done
62    
63     return 1
64     }
65    
66     load_mage_features
67     mage_setup
68    
69     if [[ -z ${SMAGEFILE} ]]
70     then
71     die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'"
72     fi
73    
74     if [ -f ${SMAGESCRIPTSDIR}/${SMAGEFILE} ]
75     then
76 niro 2765 # be silent
77     FVERBOSE=off \
78     SILENT=1 \
79     smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE}
80 niro 2747 else
81     die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found."
82     fi
83    
84     # create build info dir
85 niro 3113 install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME}
86 niro 2747
87 niro 3113 if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS ]
88 niro 2747 then
89 niro 3113 die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS missing. run 'buildserver-build-depends first"
90 niro 2747 fi
91    
92 niro 3113 SRC_INSTALL_DEPS="$(< ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/SRC_INSTALL_DEPS)"
93 niro 2747
94     if [[ -z ${SRC_INSTALL_DEPS} ]]
95     then
96     die "buildserver-build: SRC_INSTALL_DEPS are empty, aborting."
97     fi
98    
99     # save STATE, gets deleted by regen_mage_tree
100     BUILDSERVER_SAVED_STATE="${STATE}"
101    
102     #regen_mage_tree # do this after dep install
103     TARGET_MAGEFILE="${MAGEDIR}/${PCAT}/${PNAME}/${PNAME}-${PVER}-${PBUILD}.${MAGESUFFIX}"
104     TARGET_SRC_TARBALL="/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}"
105    
106     if [ ! -f ${TARGET_SRC_TARBALL} ]
107     then
108     die "${TARGET_SRC_TARBALL} is missing"
109     fi
110    
111     if is_installed ${PCAT}/${PNAME}-${PVER}-${PBUILD}
112     then
113     echo -en "Package "
114     echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
115     echo -e " already installed. try a revup."
116     exit 3
117     fi
118    
119 niro 3113 if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_OK ]
120 niro 2747 then
121     echo -en "Package "
122     echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
123     echo -e " already build successfully. try a revup."
124     exit 3
125     fi
126    
127 niro 3113 #if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED ]
128 niro 2747 #then
129     # echo -en "Package "
130     # echo -en "${COLRED}${PCAT}/${PNAME}-${PVER}-${PBUILD}${COLDEFAULT}"
131     # echo -e " build has failed already. try to fix build and revup or enforce rebuild."
132     # exit 3
133     #fi
134    
135     # create build info dir
136 niro 3113 install -d ${BUILDSERVER_CACHE_DIR}/build/${PNAME}
137 niro 2747
138     echo
139     echo "---- environment -----"
140     echo "MROOT: ${FAKE_MROOT}"
141     echo "PKGDIR: ${PKGDIR}"
142     echo "BUILDDIR: ${BUILDDIR}"
143     echo "BINDIR: ${BINDIR}"
144     echo "$(mprintfeatures)"
145     echo "----------------------"
146     echo
147     #echo "DEBUG: paused"; read
148    
149 niro 3113 if [ ! -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES ]
150 niro 2747 then
151 niro 3113 die "${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALLED_PREREQUISITES missing. run 'buildserver-build-prerequisites first"
152 niro 2747 fi
153    
154     #### building target package from src-pkg tarball####
155     if smage2 --src-tarball ${TARGET_SRC_TARBALL}
156     then
157     build_retval=0
158 niro 3113 echo 0 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_OK
159 niro 2767 # remove maybe existing failed file
160 niro 3113 if [ -f ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED ]
161 niro 2767 then
162 niro 3113 rm ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED
163 niro 2767 fi
164 niro 2747 echo "Build successfull!"
165     regen_mage_tree
166     # restore STATE
167     STATE="${BUILDSERVER_SAVED_STATE}"
168 niro 2766 if [[ ${LINT_CHECKS} = 1 ]]
169     then
170     /usr/lib/mage-buildserver/buildserver-lint.sh ${SMAGEFILE}
171     fi
172 niro 2747 if install_packages ${SRC_INSTALL_DEPS} || die "installing packages"
173     then
174     install_retval=0
175 niro 3113 echo 0 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_OK
176 niro 2747 echo "Install successfull!"
177     else
178     install_retval=1
179 niro 3113 echo 1 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/INSTALL_FAILED
180 niro 2747 echo "Installation *not* successfull!"
181     fi
182     else
183     build_retval=1
184 niro 3113 echo 1 > ${BUILDSERVER_CACHE_DIR}/build/${PNAME}/${PNAME}-${PVER}-${PBUILD}/BUILD_FAILED
185 niro 2747 echo "Build failed"
186     echo "DEBUG: read"
187     read
188     fi
189    
190     ## always run auto etc-update
191     echo "running etc-update"
192     echo "-5" | etc-update
193    
194     exit ${build_retval}

Properties

Name Value
svn:executable *