--- trunk/mage/usr/lib/mage/smage2.sh 2012/01/13 21:04:02 1649 +++ trunk/mage/usr/lib/mage/smage2.sh 2013/02/01 10:19:20 2043 @@ -178,6 +178,12 @@ # get the right variables for the split export PNAME="${subpackage}" split_info_${subpackage} + # fix PCATEGORIE -> PCAT + if [[ ! -z ${PCATEGORIE} ]] + then + PCAT="${PCATEGORIE}" + unset PCATEGORIE + fi # build md5sum for existing packages generate_package_md5sum \ --pcat "${PCAT}" \ @@ -400,28 +406,42 @@ export SAVED_BINDIR="${BINDIR}" for subpackage in ${SPLIT_PACKAGES} do - if typeset -f src_install_${subpackage} > /dev/null + split_info_${subpackage} + if [[ ${PKGTYPE} = virtual ]] then - # export subpackage bindir - export BINDIR="${SAVED_BINDIR}_${subpackage}" - # export PNAME, several internal function and include - # rely on this variable - export PNAME="${subpackage}" - echo echo -en "${COLBLUE}*** ${COLDEFAULT}" - echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" + echo -en "Virtual package detected" echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." - ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} - die_pipestatus 0 "src_install_${subpackage} failed" - resume_stamp src_install_${subpackage} - step_by_step src_install_${subpackage} + echo "virtual package detected; nothing will be build ..." + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + else + if typeset -f src_install_${subpackage} > /dev/null + then + # export subpackage bindir + export BINDIR="${SAVED_BINDIR}_${subpackage}" + # export PNAME, several internal function and include + # rely on this variable + export PNAME="${subpackage}" + + echo + echo -en "${COLBLUE}*** ${COLDEFAULT}" + echo -en "Running ${COLGREEN}split src_install()${COLDEFAULT}" + echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" + echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." + + ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_install_${subpackage} failed" + resume_stamp src_install_${subpackage} + step_by_step src_install_${subpackage} + fi fi + # restore smage environment + split_restore_variables done - # restore bindir & pname - split_restore_variables # unset all saved smage variables split_unset_variables else @@ -445,11 +465,33 @@ # compressing doc, info & man files if [[ -n ${SPLIT_PACKAGES} ]] then + # save smage environment + split_save_variables for subpackage in ${SPLIT_PACKAGES} do - run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} - resume_stamp post-mcompressdoc_${subpackage} + # honor split_info + split_info_${subpackage} + if [[ ${PKGTYPE} = virtual ]] + then + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + fi + + if mqueryfeature "!compressdoc" + then + echo -e "!compressdoc detected; documentation of '${subpackage}' will not be compressed ..." + elif mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping documentation compression for '${subpackage}' ..." + else + run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} + resume_stamp post-mcompressdoc_${subpackage} + fi + # restore smage environment + split_restore_variables done + # unset saved variables + split_unset_variables else run_resume post-mcompressdoc || mcompressdocs ${BINDIR} resume_stamp post-mcompressdoc @@ -464,12 +506,35 @@ else if [[ -n ${SPLIT_PACKAGES} ]] then + # save smage environment + split_save_variables for subpackage in ${SPLIT_PACKAGES} do - echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" - run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} - resume_stamp post-mstriplibtoolarchive_${subpackage} + # honor split_info + split_info_${subpackage} + if [[ ${PKGTYPE} = virtual ]] + then + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + fi + + if mqueryfeature "!libtool" + then + if mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping libtool archive stripping for '${subpackage}'..." + else + echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" + run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} + resume_stamp post-mstriplibtoolarchive_${subpackage} + fi + fi + + # restore smage environment + split_restore_variables done + # unset saved variables + split_unset_variables else echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} @@ -482,16 +547,39 @@ then if mqueryfeature "!pkgbuild" then - echo "!pkgbuild detected; skipping file purgation..." + echo "!pkgbuild detected; skipping file purgation ..." else if [[ -n ${SPLIT_PACKAGES} ]] then + # save smage environment + split_save_variables for subpackage in ${SPLIT_PACKAGES} do - echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" - run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} - resume_stamp post-mpurgetargets_${subpackage} + # honor split_info + split_info_${subpackage} + if [[ ${PKGTYPE} = virtual ]] + then + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + fi + + if mqueryfeature "purge" + then + if mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping file purgation for '${subpackage}' ..." + else + echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" + run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} + resume_stamp post-mpurgetargets_${subpackage} + fi + fi + + # restore smage environment + split_restore_variables done + # unset saved variables + split_unset_variables else echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" run_resume post-mpurgetargets || mpurgetargets ${BINDIR} @@ -503,25 +591,48 @@ # stripping all bins and libs if mqueryfeature "!strip" then - echo -e "!strip detected; Package will not be stripped ..." + echo -e "!strip detected; package will not be stripped ..." elif mqueryfeature "!pkgbuild" then echo "!pkgbuild detected; skipping stripping of the package ..." else if [[ -n ${SPLIT_PACKAGES} ]] then + # save smage environment + split_save_variables for subpackage in ${SPLIT_PACKAGES} do - echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" - run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} - resume_stamp post-mstripbins_${subpackage} - echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" - run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} - resume_stamp post-mstriplibs_${subpackage} - echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" - run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} - resume_stamp post-mstripstatic_${subpackage} + # honor split_info + split_info_${subpackage} + if [[ ${PKGTYPE} = virtual ]] + then + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + fi + + if mqueryfeature "!strip" + then + echo -e "!strip detected; package '${subpackage}' will not be stripped ..." + elif mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping stripping of the package '${subpackage}' ..." + else + echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" + run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} + resume_stamp post-mstripbins_${subpackage} + echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" + run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} + resume_stamp post-mstriplibs_${subpackage} + echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" + run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} + resume_stamp post-mstripstatic_${subpackage} + fi + + # restore smage environment + split_restore_variables done + # unset saved variables + split_unset_variables else echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" run_resume post-mstripbins || mstripbins ${BINDIR} @@ -579,9 +690,25 @@ # get the right variables for the split export PNAME="${subpackage}" split_info_${PNAME} + # fix PCATEGORIE -> PCAT + if [[ ! -z ${PCATEGORIE} ]] + then + PCAT="${PCATEGORIE}" + unset PCATEGORIE + fi + if [[ ${PKGTYPE} = virtual ]] + then + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" + fi # jump to next one if !pkgbuild is set in split_info - mqueryfeature "!pkgbuild" && continue + if mqueryfeature "!pkgbuild" + then + # restore smage environment + split_restore_variables + continue + fi # check if an special subpackage_pkgbuild exists if typeset -f ${PNAME}_pkgbuild > /dev/null