Magellan Linux

Annotation of /trunk/mage-buildserver/buildserver-prepare.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2936 - (hide annotations) (download) (as text)
Wed Feb 3 11:58:39 2016 UTC (8 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 4791 byte(s)
-honor tmp-pkg cleanup and print more debug messages
1 niro 2588 #!/bin/bash
2    
3     # get configuration
4     BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver"
5 niro 2749 BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver"
6 niro 2588 source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf
7    
8     source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh
9    
10 niro 2859 NON_SRC_ARCH_PACKAGES+=( "${BOOTSTRAP_DEVUTILS}" )
11 niro 2793
12 niro 2792 # fallback
13     if [[ -z ${MAGE_PROFILE} ]]
14     then
15     echo "Warning: using '${BUILDROOT_PROFILE}' as MAGE_PROFILE. You should define MAGE_PROFILE in the profile.conf."
16     MAGE_PROFILE="${BUILDROOT_PROFILE}"
17     fi
18    
19 niro 2588 if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ]
20     then
21     die "svn checkout of mage required. run buildserver-svn first."
22     fi
23    
24     # create buildroot layout
25     install -d ${BUILDROOT}/.stamps
26 niro 2749 install -d ${BUILDROOT}/ssh
27 niro 2796 for arch in $(enum-all-arch-types)
28 niro 2588 do
29     install -d ${BUILDROOT}/${arch}
30 niro 2790 install -d ${BUILDROOT}/mage-tree/${arch}
31 niro 2588 install -d ${BUILDROOT}/packages/${arch}
32     install -d ${BUILDROOT}/meta/${arch}
33 niro 2749 install -d ${BUILDROOT}/build-info/${arch}
34 niro 2816 install -d ${BUILDROOT}/log/smage/${arch}
35 niro 2588 done
36    
37     #
38     # arch specific
39     #
40 niro 2795 for arch in $(enum-all-arch-types)
41 niro 2588 do
42     if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ]
43     then
44 niro 2936 echo "boostrapping system:"
45     echo " ARCH='${arch}'"
46     echo " ROOT='${BUILDROOT}/${arch}'"
47     echo " MAGERC='${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc'"
48     echo " PROFILE='${MAGE_PROFILE}'"
49     echo " BASESYSTEM='${BOOTSTRAP_BASESYSTEM}'"
50     echo
51 niro 2588 mage-bootstrap \
52     --root ${BUILDROOT}/${arch} \
53     --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \
54 niro 2791 --profile "${MAGE_PROFILE}" \
55 niro 2588 --basesystem "${BOOTSTRAP_BASESYSTEM}" \
56     || die "'${arch}' bootstrap"
57     touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok
58     else
59     echo "Warning: bootstrap already done for arch '${arch}'"
60     fi
61     done
62    
63     # create initial mage-tree for all arches
64     ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh
65    
66 niro 2795 for arch in $(enum-all-arch-types)
67 niro 2588 do
68     # honor any proxy settings
69     :> ${BUILDROOT}/${arch}/etc/env.d/01proxy
70     [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
71     [[ -n ${https_proxy} ]] && echo "https_proxy=\"${https_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
72     [[ -n ${ftp_proxy} ]] && echo "ftp_proxy=\"${ftp_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
73     [[ -n ${ftps_proxy} ]] && echo "ftps_proxy=\"${ftps_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
74     [[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
75 niro 2936 # honor tmp-pkg-cleanup
76     [[ -n ${CLEAN_TMP_PACKAGES} ]] && echo "CLEAN_TMP_PACKAGES=\"${CLEAN_TMP_PACKAGES}\"" >> ${BUILDROOT}/${arch}/etc/env.d/99-buildserver-clean-tmp-packages
77 niro 2588 runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup"
78    
79 niro 2749 # always enable bootstrap mode to supress the startups of any services
80     :> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver
81     echo "MAGE_BOOTSTRAP=\"true\"" >> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver
82    
83 niro 2793 for pkg in ${ALL_ARCH_PACKAGES[*]}
84     do
85     runarch-pkg-install "${arch}" "${pkg}"
86     done
87 niro 2588
88 niro 2793 # exclude these pkg from src chroot
89 niro 2588 if [[ ${arch} != src ]]
90     then
91 niro 2793 for pkg in ${NON_SRC_ARCH_PACKAGES[*]}
92     do
93     runarch-pkg-install "${arch}" "${pkg}"
94     done
95 niro 2588
96     # setup ccache
97     if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ]
98     then
99     runarch "${arch}" ccache -M 4G || die "${arch} setup ccache"
100     touch ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok
101     else
102     echo "Warning: ccache already configured for arch '${arch}'"
103     fi
104     fi
105 niro 2729
106     # update-ca-certificates
107 niro 2860 if [ -x ${BUILDROOT}/${arch}/usr/sbin/update-ca-certificates ]
108     then
109     runarch "${arch}" update-ca-certificates # no die here, cmd may missing
110     fi
111 niro 2729
112 niro 2730 # create list of protected packages
113 niro 2749 echo "BUILDSERVER_CACHE_DIR=\"${BUILDSERVER_CACHE_DIR}\"" > ${BUILDROOT}/${arch}/.runrc
114 niro 2730 cat >> ${BUILDROOT}/${arch}/.runrc << "EOF"
115     if [ -f /etc/rc.d/init.d/functions ]
116     then
117     source /etc/rc.d/init.d/functions
118     else
119     die "/etc/rc.d/init.d/functions not found"
120     fi
121     if [ -f /etc/mage.rc.global ]
122     then
123     source /etc/mage.rc.global
124     else
125     die "/etc/mage.rc.global not found"
126     fi
127     if [ -f /etc/mage.rc ]
128     then
129     source /etc/mage.rc
130     else
131     die "/etc/mage.rc not found"
132     fi
133    
134 niro 2749 env-rebuild
135     source /etc/profile
136    
137     echo "generate protected packages info data"
138     install -d ${BUILDSERVER_CACHE_DIR}/protected
139    
140 niro 2730 for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX})
141     do
142 niro 2749 pkgname=$(basename ${mage} .${MAGESUFFIX})
143 niro 2730 pkgname="${pkgname%-*-*}"
144 niro 2749 echo "${pkgname}" > ${BUILDSERVER_CACHE_DIR}/protected/"${pkgname}"
145 niro 2730 done
146     EOF
147 niro 2749 runarch-script ${arch} .runrc || die "${arch} protect-gen failed"
148     if [ -f ${BUILDROOT}/${arch}/.runrc ]
149     then
150     rm ${BUILDROOT}/${arch}/.runrc
151     fi
152 niro 2730
153 niro 2588 # cleanup
154     runarch "${arch}" mage clean || die "${arch} mage clean"
155    
156     echo "Buildroot for arch '${arch}' sucessfully created."; echo
157     done

Properties

Name Value
svn:executable *