Magellan Linux

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

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

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

Legend:
Removed from v.2588  
changed lines
  Added in v.2816