Magellan Linux

Contents of /trunk/mage-buildserver/buildserver-upload-smage.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2800 - (show annotations) (download) (as text)
Thu Aug 28 11:08:22 2014 UTC (9 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 2869 byte(s)
-respect all possible arches
1 #!/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 for arch in $(enum-build-arch-types)
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 if [ -f /etc/rc.d/init.d/functions ]
31 then
32 source /etc/rc.d/init.d/functions
33 else
34 die "/etc/rc.d/init.d/functions not found"
35 fi
36 if [ -f /etc/mage.rc.global ]
37 then
38 source /etc/mage.rc.global
39 else
40 die "/etc/mage.rc.global not found"
41 fi
42 if [ -f /etc/mage.rc ]
43 then
44 source /etc/mage.rc
45 else
46 die "/etc/mage.rc not found"
47 fi
48 if [ -f ${MLIBDIR}/mage4.functions.sh ]
49 then
50 source ${MLIBDIR}/mage4.functions.sh
51 else
52 die "${MLIBDIR}/mage4.functions.sh not found"
53 fi
54 if [ -f ${MLIBDIR}/smage2.functions.sh ]
55 then
56 source ${MLIBDIR}/smage2.functions.sh
57 else
58 die "${MLIBDIR}/smage2.functions.sh not found"
59 fi
60
61 env-rebuild
62 source /etc/profile
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 ${SMAGESCRIPTSDIR}/${SMAGEFILE} ]
75 then
76 # be silent
77 FVERBOSE=off \
78 SILENT=1 \
79 smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE}
80 else
81 die "smagefile '${SMAGESCRIPTSDIR}/${SMAGEFILE}' not found."
82 fi
83
84 if [[ ${BUILD_ARCH} = src ]]
85 then
86 TARGET_SRC_PKGFILE=( "/var/cache/mage/src-packages/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}" )
87 for i in ${TARGET_SRC_PKGFILE}
88 do
89 if [ ! -f ${i} ]
90 then
91 die "${i} is missing"
92 else
93 scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/
94 fi
95 done
96 else
97 # honor split packages
98 if [[ -n ${SPLIT_PACKAGES} ]]
99 then
100 split_save_variables
101 for subpackage in ${SPLIT_PACKAGES}
102 do
103 # get the right variables for the split
104 export PNAME="${subpackage}"
105 split_info_${PNAME}
106
107 TARGET_PKGFILE+=( "${PKGDIR}/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" )
108
109 # restore smage environment
110 split_restore_variables
111 done
112 # unset all saved smage variables
113 split_unset_variables
114 else
115 TARGET_PKGFILE=( "${PKGDIR}/${PNAME}-${PVER}-${BUILD_ARCH}$(print_distrotag)-${PBUILD}.${PKGSUFFIX}" )
116 fi
117
118 for i in ${TARGET_PKGFILE[*]}
119 do
120 if [ ! -f ${i} ]
121 then
122 die "${i} is missing"
123 else
124 scp "${i}" ${PKG_SCP_REPO}/${BUILD_ARCH}/
125 fi
126 done
127 fi
128
129 EOF
130 runarch-script ${arch} .runrc || die "${arch} package build failed"
131 done