--- trunk/mage/usr/lib/mage/smage2.functions.sh 2012/01/13 18:29:52 1640 +++ trunk/mage/usr/lib/mage/smage2.functions.sh 2012/02/06 10:07:01 1680 @@ -8,11 +8,29 @@ { local file="$1" local mystate - local mycodename + local mytag source ${file} + # if PCAT was not set and PCATEGORIE was found + # inform the user and use PCATEGORIE as PCAT + if [[ -z ${PCAT} ]] + then + if [[ -n ${PCATEGORIE} ]] + then + PCAT="${PCATEGORIE}" + unset PCATEGORIE + # print a warning + echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}" + echo -e "${COLYELLOW} Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}" + echo + else + die "Neither PCAT nor PCATEGORIE are defined!" + fi + fi + [[ -n ${STATE} ]] && mystate="${STATE}" + [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" # do not overide if local state was broken or disabled! case ${STATE} in @@ -24,9 +42,41 @@ then source ${SMAGESCRIPTSDIR}/distribution [[ -n ${STATE} ]] && mystate="${STATE}" + [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" fi # now switch state and export it STATE="${mystate}" + + if mqueryfeature "pkgdistrotag" + then + # if DISTROTAG was not defined globally + # or in distribution file then deactivate this feature! + # at this point $mytag must have the distrotag + if [[ -z ${mytag} ]] + then + FVERBOSE=off msetfeature "!pkgdistrotag" + unset DISTROTAG + echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}" + echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}" + else + # now switch state and export it + export DISTROTAG="${mytag}" + fi + else + unset DISTROTAG + fi +} + +print_distrotag() +{ + if FVERBOSE=off mqueryfeature "pkgdistrotag" + then + if [[ ! -z ${DISTROTAG} ]] + then + # add a point as prefix + echo ".${DISTROTAG}" + fi + fi } showversion() @@ -231,8 +281,9 @@ fi fi - # always enable shared by default - if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] + # always enable shared by default but not for waf configure + if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] && + [[ -z $(./configure --version | grep waf) ]] then myopts+=" --enable-shared" fi @@ -606,10 +657,12 @@ # PNAME name of pkg # PVER version # PBUILD revision -# PCATEGORIE category of the pkg +# PCAT category of the pkg +# PCATEGORIE category of the pkg (deprecated, use PCAT!) # STATE state of pkg stable|unstable|old # DESCRIPTION a short description (opt) # HOMEPAGE homepage (opt) +# LICENSE license information of the pkg (opt) # DEPEND runtime dependencies (opt) # SDEPEND adds needed deps to build the pkg (opt) # PROVIDE provides a virtual (opt) @@ -649,7 +702,7 @@ magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" # destination to magefile - dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}" + dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}${target}/${magefile}" # show what we are doing echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}" @@ -660,13 +713,16 @@ > ${dest} # pgkname and state - echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} + echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest} echo "STATE=\"${STATE}\"" >> ${dest} # description and homepage echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} + # license information + echo "LICENSE=\"${LICENSE}\"" >> ${dest} + # special tags and vars echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} @@ -758,6 +814,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 # get the preinstall etc split_export_inherits ${subpackage} build_mage_script --split-pkg-base "${split_pkg_base}" @@ -809,7 +871,7 @@ export SAVED_PNAME="${PNAME}" export SAVED_PVER="${PVER}" export SAVED_PBUILD="${PBUILD}" - export SAVED_PCATEGORIE="${PCATEGORIE}" + export SAVED_PCAT="${PCAT}" export SAVED_DESCRIPTION="${DESCRIPTION}" export SAVED_HOMEPAGE="${HOMEPAGE}" export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" @@ -884,7 +946,7 @@ export PNAME="${SAVED_PNAME}" export PVER="${SAVED_PVER}" export PBUILD="${SAVED_PBUILD}" - export PCATEGORIE="${SAVED_PCATEGORIE}" + export PCAT="${SAVED_PCAT}" export DESCRIPTION="${SAVED_DESCRIPTION}" export HOMEPAGE="${SAVED_HOMEPAGE}" export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" @@ -953,7 +1015,7 @@ unset SAVED_PNAME unset SAVED_PVER unset SAVED_PBUILD - unset SAVED_PCATEGORIE + unset SAVED_PCAT unset SAVED_DESCRIPTION unset SAVED_HOMEPAGE unset SAVED_SPECIAL_VARS @@ -1069,7 +1131,7 @@ [ -n "${target}" ] && target="-${target}" # build pkgname - pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" + pkgname="${pname}${target}-${pver}-${parch}$(print_distrotag)-${pbuild}" # build pkg-md5-sum only if requested if mqueryfeature regentree @@ -1122,7 +1184,7 @@ [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR} mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} - echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}" + echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}\n" } step_by_step()