Annotation of /trunk/mage-buildserver/buildserver-upload-smage.sh
Parent Directory | Revision Log
Revision 2733 -
(hide annotations)
(download)
(as text)
Sun Aug 10 19:38:18 2014 UTC (10 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 2860 byte(s)
Sun Aug 10 19:38:18 2014 UTC (10 years, 1 month ago) by niro
File MIME type: application/x-sh
File size: 2860 byte(s)
-added upload function
1 | niro | 2588 | #!/bin/bash |
2 | |||
3 | # get configuration | ||
4 | BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver" | ||
5 | source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf | ||
6 | |||
7 | source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh | ||
8 | |||
9 | # override | ||
10 | #BUILDROOT="/mnt/test-buildroot" | ||
11 | #BUILD_ARCH=( x86_64 i686 ) | ||
12 | #BUILDROOT_PROFILE="R11" | ||
13 | #SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk" | ||
14 | #MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk" | ||
15 | |||
16 | SMAGEFILE="$1" | ||
17 | |||
18 | if [[ -z ${SMAGEFILE} ]] | ||
19 | then | ||
20 | die "no smage file given. call '$(basename $0) with/relative/path/from/buildroot/svn/smage/to/smagefile'" | ||
21 | fi | ||
22 | |||
23 | niro | 2733 | for arch in ${BUILD_ARCH[*]} src |
24 | do | ||
25 | |||
26 | echo "SMAGEFILE=\"${SMAGEFILE}\"" > ${BUILDROOT}/${arch}/.runrc | ||
27 | echo "PKG_SCP_REPO=\"${PKG_SCP_REPO}\"" >> ${BUILDROOT}/${arch}/.runrc | ||
28 | echo "BUILD_ARCH=\"${arch}\"" >> ${BUILDROOT}/${arch}/.runrc | ||
29 | cat >> ${BUILDROOT}/${arch}/.runrc << "EOF" | ||
30 | env-rebuild | ||
31 | source /etc/profile | ||
32 | |||
33 | if [ -f /etc/rc.d/init.d/functions ] | ||
34 | then | ||
35 | source /etc/rc.d/init.d/functions | ||
36 | else | ||
37 | die "/etc/rc.d/init.d/functions not found" | ||
38 | fi | ||
39 | if [ -f /etc/mage.rc.global ] | ||
40 | then | ||
41 | source /etc/mage.rc.global | ||
42 | else | ||
43 | die "/etc/mage.rc.global not found" | ||
44 | fi | ||
45 | if [ -f /etc/mage.rc ] | ||
46 | then | ||
47 | source /etc/mage.rc | ||
48 | else | ||
49 | die "/etc/mage.rc not found" | ||
50 | fi | ||
51 | if [ -f ${MLIBDIR}/mage4.functions.sh ] | ||
52 | then | ||
53 | source ${MLIBDIR}/mage4.functions.sh | ||
54 | else | ||
55 | die "${MLIBDIR}/mage4.functions.sh not found" | ||
56 | fi | ||
57 | if [ -f ${MLIBDIR}/smage2.functions.sh ] | ||
58 | then | ||
59 | source ${MLIBDIR}/smage2.functions.sh | ||
60 | else | ||
61 | die "${MLIBDIR}/smage2.functions.sh not found" | ||
62 | fi | ||
63 | |||
64 | # override die function | ||
65 | die() | ||
66 | { | ||
67 | echo "ERROR: $@" | ||
68 | return 1 | ||
69 | } | ||
70 | |||
71 | load_mage_features | ||
72 | mage_setup | ||
73 | |||
74 | if [ -f /var/cache/mage/smage/${SMAGEFILE} ] | ||
75 | then | ||
76 | smagesource /var/cache/mage/smage/${SMAGEFILE} | ||
77 | else | ||
78 | die "smagefile '/var/cache/mage/smage/${SMAGEFILE}' not found." | ||
79 | fi | ||
80 | |||
81 | if [[ ${BUILD_ARCH} = src ]] | ||
82 | then | ||
83 | TARGET_SRC_PKGFILE=( "/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}" ) | ||
84 | for i in ${TARGET_SRC_PKGFILE} | ||
85 | do | ||
86 | if [ ! -f ${i} ] | ||
87 | then | ||
88 | die "${i} is missing" | ||
89 | else | ||
90 | scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/ | ||
91 | fi | ||
92 | done | ||
93 | else | ||
94 | # honor split packages | ||
95 | if [[ -n ${SPLIT_PACKAGES} ]] | ||
96 | then | ||
97 | split_save_variables | ||
98 | for subpackage in ${SPLIT_PACKAGES} | ||
99 | do | ||
100 | # get the right variables for the split | ||
101 | export PNAME="${subpackage}" | ||
102 | split_info_${PNAME} | ||
103 | |||
104 | TARGET_PKGFILE+=( "/var/cache/mage/packages/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" ) | ||
105 | |||
106 | # restore smage environment | ||
107 | split_restore_variables | ||
108 | done | ||
109 | # unset all saved smage variables | ||
110 | split_unset_variables | ||
111 | else | ||
112 | TARGET_PKGFILE=( "/var/cache/mage/packages/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" ) | ||
113 | fi | ||
114 | |||
115 | for i in ${TARGET_PKGFILE} | ||
116 | do | ||
117 | if [ ! -f ${i} ] | ||
118 | then | ||
119 | die "${i} is missing" | ||
120 | else | ||
121 | scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/ | ||
122 | fi | ||
123 | done | ||
124 | fi | ||
125 | |||
126 | EOF | ||
127 | runarch-script ${arch} .runrc || die "${arch} package build failed" | ||
128 | done |