Magellan Linux

Diff of /trunk/mage/usr/lib/mage/smage2.sh

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

revision 881 by niro, Mon Jun 29 18:56:32 2009 UTC revision 941 by niro, Fri Nov 20 19:41:27 2009 UTC
# Line 20  SMAGENAME="$1" Line 20  SMAGENAME="$1"
20  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
21  MLIBDIR=/usr/lib/mage  MLIBDIR=/usr/lib/mage
22  SMAGEVERSION="$( < ${MLIBDIR}/version)"  SMAGEVERSION="$( < ${MLIBDIR}/version)"
 SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"  
   
23    
24  ## only for tests -> normally in /etc/rc.d/init.d/functions  ## only for tests -> normally in /etc/rc.d/init.d/functions
25  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
# Line 75  die() Line 73  die()
73   exit 1   exit 1
74  }  }
75    
76    die_pipestatus()
77    {
78     local pos="$1"
79     local comment="$2"
80    
81     [ ${PIPESTATUS[${pos}]} -gt 0 ] && die "${comment}"
82    }
83    
84  xtitle()  xtitle()
85  {  {
86   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 173  download_sources() Line 179  download_sources()
179   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
180   fi   fi
181    
182     # create the SOURCEDIR
183     install -d ${my_SOURCEDIR}
184    
185   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
186   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
187   then   then
# Line 188  download_sources() Line 197  download_sources()
197   --tries 3 \   --tries 3 \
198   --continue \   --continue \
199   --progress bar \   --progress bar \
200   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
201   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
202   if [[ $? = 0 ]]   if [[ $? = 0 ]]
203   then   then
# Line 213  download_sources() Line 221  download_sources()
221   --tries 3 \   --tries 3 \
222   --continue \   --continue \
223   --progress bar \   --progress bar \
224   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
225   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
226   if [[ $? = 0 ]]   if [[ $? = 0 ]]
227   then   then
# Line 238  download_sources() Line 245  download_sources()
245   --tries 3 \   --tries 3 \
246   --continue \   --continue \
247   --progress bar \   --progress bar \
248   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
249   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
250   if [[ $? = 0 ]]   if [[ $? = 0 ]]
251   then   then
# Line 263  download_sources() Line 269  download_sources()
269   --tries 3 \   --tries 3 \
270   --continue \   --continue \
271   --progress bar \   --progress bar \
272   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
273   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
274   if [[ $? = 0 ]]   if [[ $? = 0 ]]
275   then   then
# Line 288  download_sources() Line 293  download_sources()
293   --tries 3 \   --tries 3 \
294   --continue \   --continue \
295   --progress bar \   --progress bar \
296   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
297   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
298   if [[ $? = 0 ]]   if [[ $? = 0 ]]
299   then   then
# Line 308  download_sources() Line 312  download_sources()
312   --tries 3 \   --tries 3 \
313   --continue \   --continue \
314   --progress bar \   --progress bar \
315   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
  --output-document="$(basename ${my_SRC_URI_MIRROR})" \  
316   "${my_SRC_URI}"   "${my_SRC_URI}"
317   fi   fi
318   fi   fi
# Line 888  generate_package_md5sum() Line 891  generate_package_md5sum()
891   # fix target as it may be empty !   # fix target as it may be empty !
892   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
893    
894    
895   # build pkgname   # build pkgname
896   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
897    
# Line 907  generate_package_md5sum() Line 911  generate_package_md5sum()
911   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
912    
913   # setup md5 dir   # setup md5 dir
914   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
915   install -d ${dest}   install -d ${dest}
916    
917   # gen md5sum   # gen md5sum
# Line 1075  then Line 1079  then
1079    
1080   regen_mage_tree   regen_mage_tree
1081    
1082   # build md5sum for existing packages   # build several targets
1083   generate_package_md5sum \   if [ -n "${MAGE_TARGETS}" ]
1084   --pcat "${PCATEGORIE}" \   then
1085   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1086   --pver "${PVER}" \   do
1087   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1088   --parch "${ARCH}" \   generate_package_md5sum \
1089   --target "${target}"   --pcat "${PCATEGORIE}" \
1090     --pname "${PNAME}" \
1091     --pver "${PVER}" \
1092     --pbuild "${PBUILD}" \
1093     --parch "${ARCH}" \
1094     --target "${target}"
1095     done
1096     else
1097     # build md5sum for existing packages
1098     generate_package_md5sum \
1099     --pcat "${PCATEGORIE}" \
1100     --pname "${PNAME}" \
1101     --pver "${PVER}" \
1102     --pbuild "${PBUILD}" \
1103     --parch "${ARCH}" \
1104     --target "${target}"
1105     fi
1106    
1107   exit 0   exit 0
1108  fi  fi
# Line 1147  fi Line 1167  fi
1167  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1168  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1169  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1170    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1171    
1172  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1173  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1225  fi Line 1246  fi
1246  [[ ! -d /var/log/smage ]] && install -d /var/log/smage  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1247  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1248    
1249  src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD}  src_prepare | ${SMAGE_LOG_CMD}
1250    die_pipestatus 0 "src_prepare failed"
1251  step_by_step $_  step_by_step $_
1252  src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD}  
1253    src_compile | ${SMAGE_LOG_CMD}
1254    die_pipestatus 0 "src_compile failed"
1255  step_by_step $_  step_by_step $_
1256  src_install || die "src_install failed" | ${SMAGE_LOG_CMD}  
1257    src_install | ${SMAGE_LOG_CMD}
1258    die_pipestatus 0 "src_install failed"
1259  step_by_step $_  step_by_step $_
1260    
1261    

Legend:
Removed from v.881  
changed lines
  Added in v.941