Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2771 - (show annotations) (download) (as text)
Thu Aug 28 09:04:24 2014 UTC (9 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 2821 byte(s)
-use mage.rc settings
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 ${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 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 smagesource ${SMAGESCRIPTSDIR}/${SMAGEFILE}
77 else
78 die "smagefile '${SMAGESCRIPTSDIR}/${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+=( "${PKGDIR}/${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=( "${PKGDIR}/${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