--- trunk/mage/usr/lib/mage/mage4.functions.sh 2009/11/20 21:53:33 942 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2010/06/28 18:08:15 1084 @@ -1225,16 +1225,20 @@ # clean up backup files (foo~) find ${MAGEDIR} -name *~ -exec rm '{}' ';' - # check if an newer mage version is available + # check if a newer mage version is available is_newer_mage_version_available } syncmage_tarball() { local latest_tarball + local latest_md5 local temp="$(mktemp -d)" local mirr mymirr + # try to get the md5 marked as latest on the server + latest_md5="mage-latest.md5" + # try to get the tarball marked as latest on the server latest_tarball="mage-latest.tar.bz2" @@ -1244,8 +1248,17 @@ mymirr="${mirr%/*}" echo -ne "${COLBLUE} --- ${COLDEFAULT}" - echo "fetching latest tarball from ${mymirr} ..." + echo "fetching latest md5 from ${mymirr} ..." + wget \ + --passive-ftp \ + --tries 3 \ + --continue \ + --progress bar \ + --directory-prefix=${temp} \ + ${mymirr}/rsync/tarballs/${latest_md5} + echo -ne "${COLBLUE} --- ${COLDEFAULT}" + echo "fetching latest tarball from ${mymirr} ..." wget \ --passive-ftp \ --tries 3 \ @@ -1263,6 +1276,14 @@ if [[ -f ${temp}/${latest_tarball} ]] then + # check md5 + if [[ ! -f ${temp}/${latest_md5} ]] + then + die "md5 is missing ... aborting" + else + ( cd ${temp}; md5sum --check ${lastest_md5} ) || die "md5 for ${lastest_tarball} failed" + fi + if [[ -d ${MAGEDIR} ]] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" @@ -1278,9 +1299,12 @@ if [[ -d ${temp} ]] then echo -ne "${COLBLUE} --- ${COLDEFAULT}" - echo "clenaing temp-files ..." + echo "cleaning temp-files ..." rm -rf ${temp} fi + + # check if a newer mage version is available + is_newer_mage_version_available else die "Could not fetch the latest tarball ... aborting" fi @@ -2160,6 +2184,8 @@ local SDEPEND local PROVIDE local PKGTYPE + local MAGE_TARGETS + local SPLIT_PACKAGE_BASE local preinstall local postinstall local preremove @@ -2280,30 +2306,45 @@ echo B:${pbuild} fi - if [[ -z ${MAGE_TARGETS} ]] + if [[ -n ${MAGE_TARGETS} ]] then # basic svn compat if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] then - for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 + for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 do smage2file="${i}" done else - smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 + smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 fi + + elif [[ -n ${SPLIT_PACKAGE_BASE} ]] + then + # basic svn compat + if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] + then + for i in ${SMAGESCRIPTSDIR}/trunk/*/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 + do + smage2file="${i}" + done + else + smage2file=${SMAGESCRIPTSDIR}/${SPLIT_PACKAGE_BASE}/${SPLIT_PACKAGE_BASE}-${pver}-${pbuild}.smage2 + fi + else # basic svn compat if [[ -d ${SMAGESCRIPTSDIR}/trunk ]] then - for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 + for i in ${SMAGESCRIPTSDIR}/trunk/*/${pname}/${pname}-${pver}-${pbuild}.smage2 do smage2file="${i}" done else - smage2file=${SMAGESCRIPTSDIR}/${pname/${MAGE_TARGETS}/}/${pname/${MAGE_TARGETS}/}-${pver}-${pbuild}.smage2 + smage2file=${SMAGESCRIPTSDIR}/${pname}/${pname}-${pver}-${pbuild}.smage2 fi fi + if [ -f "${smage2file}" ] then echo -e " ${COLBLUE}***${COLDEFAULT} building package from source ... "