--- trunk/mage/usr/lib/mage/smage2.sh 2007/11/05 16:47:10 597 +++ trunk/mage/usr/lib/mage/smage2.sh 2009/06/29 18:56:32 881 @@ -4,7 +4,7 @@ # needs pkgbuild_dir (mage) # SMAGE2 -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.59 2007-11-05 16:47:10 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $ #01.10.2004 # added ccache support @@ -20,6 +20,8 @@ SMAGESUFFIX="smage2" MLIBDIR=/usr/lib/mage SMAGEVERSION="$( < ${MLIBDIR}/version)" +SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" + ## only for tests -> normally in /etc/rc.d/init.d/functions COLRED="\033[1;6m\033[31m" @@ -187,6 +189,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI_MIRROR}" if [[ $? = 0 ]] then @@ -211,6 +214,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI_MIRROR}" if [[ $? = 0 ]] then @@ -235,6 +239,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI_MIRROR}" if [[ $? = 0 ]] then @@ -259,6 +264,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI_MIRROR}" if [[ $? = 0 ]] then @@ -283,6 +289,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI_MIRROR}" if [[ $? = 0 ]] then @@ -302,6 +309,7 @@ --continue \ --progress bar \ --directory-prefix="${my_SOURCEDIR}" \ + --output-document="$(basename ${my_SRC_URI_MIRROR})" \ "${my_SRC_URI}" fi fi @@ -362,6 +370,7 @@ ./configure \ --prefix=/usr \ --host=${CHOST} \ + --build=${CHOST} \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --datadir=/usr/share \ @@ -439,7 +448,7 @@ popd > /dev/null fi ;; - tbz2) + tbz2|mpks|mpk) tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed." ;; tgz) @@ -448,14 +457,17 @@ rar) unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." ;; - zip) + zip|xpi) unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." ;; rpm) - pushd ${BUILDDIR} > /dev/null + pushd ${DEST} > /dev/null rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." - tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz/} || die "tar: .rpm unpack failed." - [[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} + tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed." + if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]] + then + rm ${DEST}/${SRCFILE/.rpm/.tar.gz} + fi ;; *) die "munpack failed" @@ -647,7 +659,7 @@ # special tags: # PKGTYPE type of pkg # INHERITS which functions get included -# SPECIAL_FUNCTIONS special functions wich should also be added +# SPECIAL_FUNCTIONS special functions which should also be added # warning: they get killed before the build starts ! # # MAGE_TREE_DEST target destination of the generated tree @@ -683,7 +695,7 @@ > ${dest} # header - echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.59 2007-11-05 16:47:10 niro Exp $' >> ${dest} + echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest} echo >> ${dest} # pgkname and state @@ -933,6 +945,16 @@ echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}" } +step_by_step() +{ + if [[ ${STEP_BY_STEP} = true ]] + then + echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" + echo "Press [enter] to continue" + read + fi +} + # print out our version showversion @@ -1199,9 +1221,16 @@ mage rmstamp fi -src_prepare || die "src_prepare failed" -src_compile || die "src_compile failed" -src_install || die "src_install failed" +# setup build loggins +[[ ! -d /var/log/smage ]] && install -d /var/log/smage +echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log + +src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD} +step_by_step $_ +src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD} +step_by_step $_ +src_install || die "src_install failed" | ${SMAGE_LOG_CMD} +step_by_step $_ # compressing doc, info & man files @@ -1282,6 +1311,13 @@ ;; esac +if [[ ${SMAGE_BUILD_LOGGING} != false ]] +then + bzip2 -9f /var/log/smage/${PKGNAME}.log +else + [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log +fi + # for sure unset NOPKGBUILD unset NOSTRIP