9 |
local arch="$1" |
local arch="$1" |
10 |
local script="$2" |
local script="$2" |
11 |
local buildroot |
local buildroot |
12 |
|
local os_arch |
13 |
|
|
14 |
# only allow the right arches |
# only allow the right arches |
15 |
case ${arch} in |
case ${arch} in |
16 |
i*86|x86_64) buildroot="${BUILDROOT}/${arch}" ;; |
i*86|x86_64) buildroot="${BUILDROOT}/${arch}"; os_arch="${arch}" ;; |
17 |
src) arch="$(source ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/src/mage.rc; echo ${ARCH})"; buildroot="${BUILDROOT}/src" ;; |
src) os_arch="$(source ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/src/mage.rc; echo ${ARCH})"; buildroot="${BUILDROOT}/src" ;; |
18 |
*) die "unknown architecture '${arch}'" ;; |
*) die "unknown architecture '${arch}'" ;; |
19 |
esac |
esac |
20 |
|
|
21 |
[ -f ${buildroot}/${script} ] || die "'${buildroot}/${script}' does not exist." |
[ -f ${buildroot}/${script} ] || die "'${buildroot}/${script}' does not exist." |
22 |
|
|
23 |
setarch "${arch}" systemd-nspawn \ |
setarch "${os_arch}" systemd-nspawn \ |
24 |
--directory="${buildroot}" \ |
--directory="${buildroot}" \ |
25 |
--bind=${BUILDROOT}/tmp/mage-tree:/usr/mage \ |
--bind=${BUILDROOT}/tmp/mage-tree:/usr/mage \ |
26 |
--bind=${BUILDROOT}/svn/mage/include:/usr/mage/include \ |
--bind=${BUILDROOT}/svn/mage/include:/usr/mage/include \ |
29 |
--bind=${BUILDROOT}/packages/${arch}:/var/cache/mage/packages \ |
--bind=${BUILDROOT}/packages/${arch}:/var/cache/mage/packages \ |
30 |
--bind=${BUILDROOT}/packages/src:/var/cache/mage/src-packages \ |
--bind=${BUILDROOT}/packages/src:/var/cache/mage/src-packages \ |
31 |
--bind=${BUILDROOT}/meta/${arch}:/var/cache/mage/meta \ |
--bind=${BUILDROOT}/meta/${arch}:/var/cache/mage/meta \ |
32 |
|
--bind=/usr/lib/mage-buildserver/helper:/usr/lib/mage-buildserver \ |
33 |
|
--bind=${BUILDROOT}/build-info/${arch}:/var/cache/mage-buildserver \ |
34 |
|
--bind=${BUILDROOT}/ssh:/root/.ssh \ |
35 |
bash --login "${script}" \ |
bash --login "${script}" \ |
36 |
|| die "runarch-script '${script}' for '${arch}' failed." |
|| die "runarch-script '${script}' for '${arch}' failed." |
37 |
|
|
38 |
|
# wait for container to exit |
39 |
|
sleep 1 |
40 |
} |
} |
41 |
|
|
42 |
runarch() |
runarch() |
62 |
rm "${runrc}" |
rm "${runrc}" |
63 |
fi |
fi |
64 |
} |
} |
65 |
|
|
66 |
|
runarch-pkg-install() |
67 |
|
{ |
68 |
|
local arch="$1" |
69 |
|
local pkg="$2" |
70 |
|
|
71 |
|
if [ ! -f ${BUILDROOT}/.stamps/"${arch}"_"${pkg}"-ok ] |
72 |
|
then |
73 |
|
runarch "${arch}" mage install "${pkg}" || die "${arch} install 'python'" |
74 |
|
touch ${BUILDROOT}/.stamps/"${arch}"_"${pkg}"-ok |
75 |
|
else |
76 |
|
echo "Warning: '${pkg}' already installed for arch '${arch}'" |
77 |
|
fi |
78 |
|
|
79 |
|
# never fail |
80 |
|
return 0 |
81 |
|
} |
82 |
|
|
83 |
|
enum-build-arch-types() |
84 |
|
{ |
85 |
|
echo "${BUILD_ARCH[*]}" |
86 |
|
} |
87 |
|
|
88 |
|
enum-all-arch-types() |
89 |
|
{ |
90 |
|
local arch |
91 |
|
local build_arch_types |
92 |
|
|
93 |
|
for arch in src ${BUILD_ARCH[*]} |
94 |
|
do |
95 |
|
if [ ! -e ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc ] |
96 |
|
then |
97 |
|
echo "Warning: mage.rc of '${arch}' not found. Arch '${arch}' ignored." >&2 |
98 |
|
else |
99 |
|
build_arch_types+=( "${arch}" ) |
100 |
|
fi |
101 |
|
done |
102 |
|
|
103 |
|
if [[ ${BUILD_PLAYGROUND} -eq 1 ]] |
104 |
|
then |
105 |
|
for arch in ${BUILD_ARCH[*]} |
106 |
|
do |
107 |
|
if [ ! -e ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/playground-${arch}/mage.rc ] |
108 |
|
then |
109 |
|
echo "Warning: mage.rc of 'playground-${arch}' not found. Arch 'playground-${arch}' ignored." >&2 |
110 |
|
else |
111 |
|
build_arch_types+=( "playground-${arch}" ) |
112 |
|
fi |
113 |
|
done |
114 |
|
fi |
115 |
|
|
116 |
|
echo "${build_arch_types[*]}" |
117 |
|
} |