Contents of /trunk/mage-buildserver/buildserver-prepare.sh
Parent Directory | Revision Log
Revision 2859 -
(show annotations)
(download)
(as text)
Wed Feb 11 12:35:17 2015 UTC (9 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 4257 byte(s)
Wed Feb 11 12:35:17 2015 UTC (9 years, 7 months ago) by niro
File MIME type: application/x-sh
File size: 4257 byte(s)
-moved ALL_ARCH_PACKAGES and NON_SRC_ARCH_PACKAGES vars to buildserver.conf
1 | #!/bin/bash |
2 | |
3 | # get configuration |
4 | BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" |
5 | BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver" |
6 | source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf |
7 | |
8 | source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh |
9 | |
10 | NON_SRC_ARCH_PACKAGES+=( "${BOOTSTRAP_DEVUTILS}" ) |
11 | |
12 | # 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 | 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 | install -d ${BUILDROOT}/ssh |
27 | for arch in $(enum-all-arch-types) |
28 | do |
29 | install -d ${BUILDROOT}/${arch} |
30 | install -d ${BUILDROOT}/mage-tree/${arch} |
31 | install -d ${BUILDROOT}/packages/${arch} |
32 | install -d ${BUILDROOT}/meta/${arch} |
33 | install -d ${BUILDROOT}/build-info/${arch} |
34 | install -d ${BUILDROOT}/log/smage/${arch} |
35 | done |
36 | |
37 | # |
38 | # arch specific |
39 | # |
40 | for arch in $(enum-all-arch-types) |
41 | do |
42 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ] |
43 | then |
44 | mage-bootstrap \ |
45 | --root ${BUILDROOT}/${arch} \ |
46 | --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \ |
47 | --profile "${MAGE_PROFILE}" \ |
48 | --basesystem "${BOOTSTRAP_BASESYSTEM}" \ |
49 | || die "'${arch}' bootstrap" |
50 | touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok |
51 | else |
52 | echo "Warning: bootstrap already done for arch '${arch}'" |
53 | fi |
54 | done |
55 | |
56 | # create initial mage-tree for all arches |
57 | ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh |
58 | |
59 | for arch in $(enum-all-arch-types) |
60 | do |
61 | # honor any proxy settings |
62 | :> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
63 | [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
64 | [[ -n ${https_proxy} ]] && echo "https_proxy=\"${https_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
65 | [[ -n ${ftp_proxy} ]] && echo "ftp_proxy=\"${ftp_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
66 | [[ -n ${ftps_proxy} ]] && echo "ftps_proxy=\"${ftps_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
67 | [[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy |
68 | runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup" |
69 | |
70 | # always enable bootstrap mode to supress the startups of any services |
71 | :> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
72 | echo "MAGE_BOOTSTRAP=\"true\"" >> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver |
73 | |
74 | for pkg in ${ALL_ARCH_PACKAGES[*]} |
75 | do |
76 | runarch-pkg-install "${arch}" "${pkg}" |
77 | done |
78 | |
79 | # exclude these pkg from src chroot |
80 | if [[ ${arch} != src ]] |
81 | then |
82 | for pkg in ${NON_SRC_ARCH_PACKAGES[*]} |
83 | do |
84 | runarch-pkg-install "${arch}" "${pkg}" |
85 | done |
86 | |
87 | # setup ccache |
88 | if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ] |
89 | then |
90 | runarch "${arch}" ccache -M 4G || die "${arch} setup ccache" |
91 | touch ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok |
92 | else |
93 | echo "Warning: ccache already configured for arch '${arch}'" |
94 | fi |
95 | fi |
96 | |
97 | # update-ca-certificates |
98 | runarch "${arch}" update-ca-certificates # no die here, cmd may missing |
99 | |
100 | # create list of protected packages |
101 | echo "BUILDSERVER_CACHE_DIR=\"${BUILDSERVER_CACHE_DIR}\"" > ${BUILDROOT}/${arch}/.runrc |
102 | cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" |
103 | if [ -f /etc/rc.d/init.d/functions ] |
104 | then |
105 | source /etc/rc.d/init.d/functions |
106 | else |
107 | die "/etc/rc.d/init.d/functions not found" |
108 | fi |
109 | if [ -f /etc/mage.rc.global ] |
110 | then |
111 | source /etc/mage.rc.global |
112 | else |
113 | die "/etc/mage.rc.global not found" |
114 | fi |
115 | if [ -f /etc/mage.rc ] |
116 | then |
117 | source /etc/mage.rc |
118 | else |
119 | die "/etc/mage.rc not found" |
120 | fi |
121 | |
122 | env-rebuild |
123 | source /etc/profile |
124 | |
125 | echo "generate protected packages info data" |
126 | install -d ${BUILDSERVER_CACHE_DIR}/protected |
127 | |
128 | for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX}) |
129 | do |
130 | pkgname=$(basename ${mage} .${MAGESUFFIX}) |
131 | pkgname="${pkgname%-*-*}" |
132 | echo "${pkgname}" > ${BUILDSERVER_CACHE_DIR}/protected/"${pkgname}" |
133 | done |
134 | EOF |
135 | runarch-script ${arch} .runrc || die "${arch} protect-gen failed" |
136 | if [ -f ${BUILDROOT}/${arch}/.runrc ] |
137 | then |
138 | rm ${BUILDROOT}/${arch}/.runrc |
139 | fi |
140 | |
141 | # cleanup |
142 | runarch "${arch}" mage clean || die "${arch} mage clean" |
143 | |
144 | echo "Buildroot for arch '${arch}' sucessfully created."; echo |
145 | done |
Properties
Name | Value |
---|---|
svn:executable | * |