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