--- trunk/mage/usr/lib/mage/smage2.functions.sh 2012/01/13 20:51:18 1648 +++ trunk/mage/usr/lib/mage/smage2.functions.sh 2012/01/13 21:04:02 1649 @@ -8,7 +8,7 @@ { local file="$1" local mystate - local mycodename + local mytag source ${file} @@ -29,6 +29,7 @@ fi [[ -n ${STATE} ]] && mystate="${STATE}" + [[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" # do not overide if local state was broken or disabled! case ${STATE} in @@ -40,9 +41,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() @@ -678,7 +711,7 @@ > ${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 @@ -1090,7 +1123,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