Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2774 - (hide annotations) (download) (as text)
Thu Aug 28 09:08:32 2014 UTC (10 years, 2 months ago) by niro
File MIME type: application/x-sh
File size: 2115 byte(s)
-added runarch-pkg-install() function
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 niro 2748 local os_arch
13 niro 2588
14     # only allow the right arches
15     case ${arch} in
16 niro 2748 i*86|x86_64) buildroot="${BUILDROOT}/${arch}"; os_arch="${arch}" ;;
17     src) os_arch="$(source ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/src/mage.rc; echo ${ARCH})"; buildroot="${BUILDROOT}/src" ;;
18 niro 2588 *) die "unknown architecture '${arch}'" ;;
19     esac
20    
21     [ -f ${buildroot}/${script} ] || die "'${buildroot}/${script}' does not exist."
22    
23 niro 2748 setarch "${os_arch}" systemd-nspawn \
24 niro 2588 --directory="${buildroot}" \
25     --bind=${BUILDROOT}/tmp/mage-tree:/usr/mage \
26     --bind=${BUILDROOT}/svn/mage/include:/usr/mage/include \
27     --bind=${BUILDROOT}/svn/mage/profiles:/usr/mage/profiles \
28     --bind=${BUILDROOT}/svn/smage:/var/cache/mage/smage \
29     --bind=${BUILDROOT}/packages/${arch}:/var/cache/mage/packages \
30     --bind=${BUILDROOT}/packages/src:/var/cache/mage/src-packages \
31     --bind=${BUILDROOT}/meta/${arch}:/var/cache/mage/meta \
32 niro 2748 --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 niro 2588 bash --login "${script}" \
36     || die "runarch-script '${script}' for '${arch}' failed."
37 niro 2748
38     # wait for container to exit
39     sleep 1
40 niro 2588 }
41    
42     runarch()
43     {
44     local arch="$1"
45     shift
46     local cmd="$@"
47     local buildroot
48     local runrc
49    
50     # only allow the right arches
51     case ${arch} in
52     i*86|x86_64|src) buildroot="${BUILDROOT}/${arch}"; runrc="${buildroot}/.runrc" ;;
53     *) die "unknown architecture '${arch}'" ;;
54     esac
55    
56     # create runrc
57     echo "${cmd}" > "${runrc}"
58     runarch-script "${arch}" .runrc || die "runarch script execition of '${runrc}' failed."
59    
60     if [ -f "${runrc}" ]
61     then
62     rm "${runrc}"
63     fi
64     }
65 niro 2774
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     }