Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2588 - (hide annotations) (download) (as text)
Thu Feb 6 13:07:22 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 1506 byte(s)
-initial version
1 niro 2588 die()
2     {
3     echo "ERROR: $@"
4     exit 1
5     }
6    
7     runarch-script()
8     {
9     local arch="$1"
10     local script="$2"
11     local buildroot
12    
13     # only allow the right arches
14     case ${arch} in
15     i*86|x86_64) buildroot="${BUILDROOT}/${arch}" ;;
16     src) arch="$(source ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/src/mage.rc; echo ${ARCH})"; buildroot="${BUILDROOT}/src" ;;
17     *) die "unknown architecture '${arch}'" ;;
18     esac
19    
20     [ -f ${buildroot}/${script} ] || die "'${buildroot}/${script}' does not exist."
21    
22     setarch "${arch}" systemd-nspawn \
23     --directory="${buildroot}" \
24     --bind=${BUILDROOT}/tmp/mage-tree:/usr/mage \
25     --bind=${BUILDROOT}/svn/mage/include:/usr/mage/include \
26     --bind=${BUILDROOT}/svn/mage/profiles:/usr/mage/profiles \
27     --bind=${BUILDROOT}/svn/smage:/var/cache/mage/smage \
28     --bind=${BUILDROOT}/packages/${arch}:/var/cache/mage/packages \
29     --bind=${BUILDROOT}/packages/src:/var/cache/mage/src-packages \
30     --bind=${BUILDROOT}/meta/${arch}:/var/cache/mage/meta \
31     bash --login "${script}" \
32     || die "runarch-script '${script}' for '${arch}' failed."
33     }
34    
35     runarch()
36     {
37     local arch="$1"
38     shift
39     local cmd="$@"
40     local buildroot
41     local runrc
42    
43     # only allow the right arches
44     case ${arch} in
45     i*86|x86_64|src) buildroot="${BUILDROOT}/${arch}"; runrc="${buildroot}/.runrc" ;;
46     *) die "unknown architecture '${arch}'" ;;
47     esac
48    
49     # create runrc
50     echo "${cmd}" > "${runrc}"
51     runarch-script "${arch}" .runrc || die "runarch script execition of '${runrc}' failed."
52    
53     if [ -f "${runrc}" ]
54     then
55     rm "${runrc}"
56     fi
57     }