Magellan Linux

Diff of /trunk/mage-buildserver/buildserver-prepare.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2728 by niro, Sun Aug 10 19:32:13 2014 UTC revision 2860 by niro, Wed Feb 11 12:36:56 2015 UTC
# Line 2  Line 2 
2    
3  # get configuration  # get configuration
4  BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver"  BUILDSERVER_CONFIG_DIR="/etc/mage-buildserver"
5    BUILDSERVER_CACHE_DIR="/var/cache/mage-buildserver"
6  source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf  source ${BUILDSERVER_CONFIG_DIR}/buildserver.conf
7    
8  source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh  source ${BUILDSERVER_LIB_DIR}/buildserver-functions.sh
9    
10  # override  NON_SRC_ARCH_PACKAGES+=( "${BOOTSTRAP_DEVUTILS}" )
11  #BUILDROOT="/mnt/test-buildroot"  
12  #BUILD_ARCH=( x86_64 i686 )  # fallback
13  #BUILDROOT_PROFILE="R11"  if [[ -z ${MAGE_PROFILE} ]]
14  #SMAGE_SVN_REPO="svn://cvs.magellan-linux.de/smage/trunk"  then
15  #MAGE_SVN_REPO="svn://cvs.magellan-linux.de/mage/trunk"   echo "Warning: using '${BUILDROOT_PROFILE}' as MAGE_PROFILE. You should define MAGE_PROFILE in the profile.conf."
16     MAGE_PROFILE="${BUILDROOT_PROFILE}"
17    fi
18    
19  if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ]  if [ ! -f ${BUILDROOT}/.stamps/mage_svn-checkout-ok ]
20  then  then
# Line 20  fi Line 23  fi
23    
24  # create buildroot layout  # create buildroot layout
25  install -d ${BUILDROOT}/.stamps  install -d ${BUILDROOT}/.stamps
26  install -d ${BUILDROOT}/tmp/mage-tree  install -d ${BUILDROOT}/ssh
27  for arch in ${BUILD_ARCH[*]} src  for arch in $(enum-all-arch-types)
28  do  do
29   install -d ${BUILDROOT}/${arch}   install -d ${BUILDROOT}/${arch}
30     install -d ${BUILDROOT}/mage-tree/${arch}
31   install -d ${BUILDROOT}/packages/${arch}   install -d ${BUILDROOT}/packages/${arch}
32   install -d ${BUILDROOT}/meta/${arch}   install -d ${BUILDROOT}/meta/${arch}
33     install -d ${BUILDROOT}/build-info/${arch}
34     install -d ${BUILDROOT}/log/smage/${arch}
35  done  done
36    
37  #  #
38  # arch specific  # arch specific
39  #  #
40  for arch in src ${BUILD_ARCH[*]}  for arch in $(enum-all-arch-types)
41  do  do
42   if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ]   if [ ! -f ${BUILDROOT}/.stamps/${arch}_bootstrap-ok ]
43   then   then
44   mage-bootstrap \   mage-bootstrap \
45   --root ${BUILDROOT}/${arch} \   --root ${BUILDROOT}/${arch} \
46   --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \   --magerc ${BUILDSERVER_CONFIG_DIR}/profiles/${BUILDROOT_PROFILE}/${arch}/mage.rc \
47   --profile "${BUILDROOT_PROFILE}" \   --profile "${MAGE_PROFILE}" \
48   --basesystem "${BOOTSTRAP_BASESYSTEM}" \   --basesystem "${BOOTSTRAP_BASESYSTEM}" \
49   || die "'${arch}' bootstrap"   || die "'${arch}' bootstrap"
50   touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok   touch ${BUILDROOT}/.stamps/${arch}_bootstrap-ok
# Line 50  done Line 56  done
56  # create initial mage-tree for all arches  # create initial mage-tree for all arches
57  ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh  ${BUILDSERVER_LIB_DIR}/buildserver-setup-mage-tree.sh
58    
59  for arch in src ${BUILD_ARCH[*]}  for arch in $(enum-all-arch-types)
60  do  do
   
  echo "DEBUG: arch='${arch}' BUILD_ARCH[*]='${BUILD_ARCH[*]}'"  
   
61   # honor any proxy settings   # honor any proxy settings
62   :> ${BUILDROOT}/${arch}/etc/env.d/01proxy   :> ${BUILDROOT}/${arch}/etc/env.d/01proxy
63   [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy   [[ -n ${http_proxy} ]] && echo "http_proxy=\"${http_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
# Line 64  do Line 67  do
67   [[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy   [[ -n ${no_proxy} ]] && echo "no_proxy=\"${no_proxy}\"" >> ${BUILDROOT}/${arch}/etc/env.d/01proxy
68   runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup"   runarch ${arch} env-rebuild || die "${arch} environment rebuild for proxy setup"
69    
70   # install subversion   # always enable bootstrap mode to supress the startups of any services
71   if [ ! -f ${BUILDROOT}/.stamps/${arch}_subversion-ok ]   :> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver
72   then   echo "MAGE_BOOTSTRAP=\"true\"" >> ${BUILDROOT}/${arch}/etc/env.d/00mage-buildserver
73   runarch "${arch}" mage install subversion || die "${arch} install subversion"  
74   touch ${BUILDROOT}/.stamps/${arch}_subversion-ok   for pkg in ${ALL_ARCH_PACKAGES[*]}
75   else   do
76   echo "Warning: subversion already installed for arch '${arch}'"   runarch-pkg-install "${arch}" "${pkg}"
77   fi   done
   
  # install openssh  
  if [ ! -f ${BUILDROOT}/.stamps/${arch}_openssh-ok ]  
  then  
  runarch "${arch}" mage install openssh || die "${arch} install openssh"  
  touch ${BUILDROOT}/.stamps/${arch}_openssh-ok  
  else  
  echo "Warning: openssh already installed for arch '${arch}'"  
  fi  
78    
79     # exclude these pkg from src chroot
80   if [[ ${arch} != src ]]   if [[ ${arch} != src ]]
81   then   then
82   if [ ! -f ${BUILDROOT}/.stamps/${arch}_common-devutils-ok ]   for pkg in ${NON_SRC_ARCH_PACKAGES[*]}
83   then   do
84   runarch "${arch}" mage install "${BOOTSTRAP_DEVUTILS}" || die "${arch} install '${BOOTSTRAP_DEVUTILS}'"   runarch-pkg-install "${arch}" "${pkg}"
85   touch ${BUILDROOT}/.stamps/${arch}_common-devutils-ok   done
  else  
  echo "Warning: '${BOOTSTRAP_DEVUTILS}' already installed for arch '${arch}'"  
  fi  
86    
  # install ccache  
  if [ ! -f ${BUILDROOT}/.stamps/${arch}_ccache-ok ]  
  then  
  runarch "${arch}" mage install ccache || die "${arch} install ccache"  
  touch ${BUILDROOT}/.stamps/${arch}_ccache-ok  
  else  
  echo "Warning: ccache already installed for arch '${arch}'"  
  fi  
87   # setup ccache   # setup ccache
88   if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ]   if [ ! -f ${BUILDROOT}/.stamps/${arch}_setup-ccache-ok ]
89   then   then
# Line 109  do Line 93  do
93   echo "Warning: ccache already configured for arch '${arch}'"   echo "Warning: ccache already configured for arch '${arch}'"
94   fi   fi
95   fi   fi
96    
97     # update-ca-certificates
98     if [ -x ${BUILDROOT}/${arch}/usr/sbin/update-ca-certificates ]
99     then
100     runarch "${arch}" update-ca-certificates # no die here, cmd may missing
101     fi
102    
103     # create list of protected packages
104     echo "BUILDSERVER_CACHE_DIR=\"${BUILDSERVER_CACHE_DIR}\"" > ${BUILDROOT}/${arch}/.runrc
105     cat >> ${BUILDROOT}/${arch}/.runrc << "EOF"
106    if [ -f /etc/rc.d/init.d/functions ]
107    then
108     source /etc/rc.d/init.d/functions
109    else
110     die "/etc/rc.d/init.d/functions not found"
111    fi
112    if [ -f /etc/mage.rc.global ]
113    then
114     source /etc/mage.rc.global
115    else
116     die "/etc/mage.rc.global not found"
117    fi
118    if [ -f /etc/mage.rc ]
119    then
120     source /etc/mage.rc
121    else
122     die "/etc/mage.rc not found"
123    fi
124    
125    env-rebuild
126    source /etc/profile
127    
128    echo "generate protected packages info data"
129    install -d ${BUILDSERVER_CACHE_DIR}/protected
130    
131    for mage in $(find ${INSTALLDB} -name \*.${MAGESUFFIX})
132    do
133     pkgname=$(basename ${mage} .${MAGESUFFIX})
134     pkgname="${pkgname%-*-*}"
135     echo "${pkgname}" > ${BUILDSERVER_CACHE_DIR}/protected/"${pkgname}"
136    done
137    EOF
138     runarch-script ${arch} .runrc  || die "${arch} protect-gen failed"
139     if [ -f ${BUILDROOT}/${arch}/.runrc ]
140     then
141     rm ${BUILDROOT}/${arch}/.runrc
142     fi
143    
144   # cleanup   # cleanup
145   runarch "${arch}" mage clean || die "${arch} mage clean"   runarch "${arch}" mage clean || die "${arch} mage clean"
146    

Legend:
Removed from v.2728  
changed lines
  Added in v.2860