--- trunk/mage/usr/lib/mage/mage4.functions.sh 2013/10/25 07:16:09 2270 +++ trunk/mage/usr/lib/mage/mage4.functions.sh 2013/10/25 07:28:23 2271 @@ -122,11 +122,13 @@ unpack_package() { local magefile="$1" - local pkg + local pkgname + local pkgfile local pkgtype local tar_opts - pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" + pkgname="$(get_value_from_magefile PKGNAME ${magefile})" + pkgfile="${pkgname}.${PKGSUFFIX}" pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" xtitle "[ Unpacking ${pkg} ]" @@ -135,7 +137,7 @@ if [[ ${pkgtype} = virtual ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !unpack virtual ${pkg/.${PKGSUFFIX}/} ... " + echo " !unpack virtual ${pkgname} ... " continue fi @@ -143,7 +145,7 @@ if [[ ${pkgtype} = sources ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !unpack sources ${pkg/.${PKGSUFFIX}/} ... " + echo " !unpack sources ${pkgname} ... " continue fi @@ -155,8 +157,8 @@ tar_opts="xjmf" fi - echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkg} ... " - tar ${tar_opts} ${PKGDIR}/${pkg} -C ${BUILDDIR} || die "Unpacking package ${pkg}" + echo -e " ${COLBLUE}***${COLDEFAULT} unpacking ${pkgfile} ... " + tar ${tar_opts} ${PKGDIR}/${pkgfile} -C ${BUILDDIR} || die "Unpacking package ${pkgfile}" } unpack_packages() @@ -1468,7 +1470,8 @@ { local i local list="$@" - local pkg + local pkgname + local pkgfile local mirr local magefile local md5file @@ -1490,17 +1493,18 @@ for magefile in ${list} do - pkg="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" + pkgname="$(get_value_from_magefile PKGNAME ${magefile})" + pkgfile="${pkgname}.${PKGSUFFIX}" pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" (( count_current++ )) - xtitle "[ (${count_current}/${count_total}) Fetching ${pkg} ]" + xtitle "[ (${count_current}/${count_total}) Fetching ${pkgfile} ]" # abort on virtual pkg if [[ ${pkgtype} = virtual ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !fetch virtual (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " + echo " !fetch virtual (${count_current}/${count_total}): ${pkgname} ... " continue fi @@ -1508,24 +1512,24 @@ if [[ ${pkgtype} = sources ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !fetch sources (${count_current}/${count_total}): ${pkg/.${PKGSUFFIX}/} ... " + echo " !fetch sources (${count_current}/${count_total}): ${pkgname} ... " continue fi # abort if already exist - if [ -f ${PKGDIR}/${pkg} ] + if [ -f ${PKGDIR}/${pkgfile} ] then echo -ne " ${COLBLUE}***${COLDEFAULT}" - echo " fetch complete (${count_current}/${count_total}): ${pkg} ... " + echo " fetch complete (${count_current}/${count_total}): ${pkgfile} ... " continue fi echo -ne " ${COLBLUE}***${COLDEFAULT}" - echo -e " fetching (${count_current}/${count_total}): ${pkg} ... " - mdownload --uri "package://${pkg}" --dir "${PKGDIR}" || die "Could not download ${pkg}" - if [ ! -f ${PKGDIR}/${pkg} ] + echo -e " fetching (${count_current}/${count_total}): ${pkgfile} ... " + mdownload --uri "package://${pkgfile}" --dir "${PKGDIR}" || die "Could not download ${pkgfile}" + if [ ! -f ${PKGDIR}/${pkgfile} ] then - die "Package '${pkg}' after download not found in '${PKGDIR}'" + die "Package '${pkgfile}' after download not found in '${PKGDIR}'" fi done @@ -2803,7 +2807,7 @@ pname=$(magename2pname ${magefile}) pkgname="$(get_value_from_magefile PKGNAME ${magefile})" md5file="${MAGEDIR}/${pcat}/${pname}/md5/${pkgname}.md5" - pkgfile="$(get_value_from_magefile PKGNAME ${magefile}).${PKGSUFFIX}" + pkgfile="${pkgname}.${PKGSUFFIX}" pkgtype="$(get_value_from_magefile PKGTYPE ${magefile})" (( count_current++ )) @@ -2813,7 +2817,7 @@ if [[ ${pkgtype} = virtual ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !md5sum virtual (${count_current}/${count_total}): ${pkgfile/.${PKGSUFFIX}/} ... " + echo " !md5sum virtual (${count_current}/${count_total}): ${pkgname} ... " continue fi @@ -2821,7 +2825,7 @@ if [[ ${pkgtype} = sources ]] then echo -ne " ${COLBLUE}---${COLDEFAULT}" - echo " !md5sum sources (${count_current}/${count_total}): ${pkgfile/.${PKGSUFFIX}/} ... " + echo " !md5sum sources (${count_current}/${count_total}): ${pkgname} ... " continue fi