./get-version.sh all include/ap_release.h AP_SERVER
The following works for me: is it portable? sed is used (in the get-version.sh script) and cut is used, that's it.
echo rebuilding rpm spec file
( VMMN=`build/get-version.sh mmn include/ap_mmn.h MODULE_MAGIC_NUMBER`
REVISION=`build/get-version.sh all include/ap_release.h AP_SERVER`
VERSION=`echo $REVISION | cut -d- -s -f1`
RELEASE=`echo $REVISION | cut -d- -s -f2`
if [ "x$VERSION" = "x" ]; then
VERSION=$REVISION
RELEASE=1
fi
cat ./build/rpm/httpd.spec.in | \
sed -e "s/APACHE_VERSION/$VERSION/" \
-e "s/APACHE_RELEASE/$RELEASE/" \
-e "s/APACHE_MMN/$VMMN/" \
> httpd.spec )The important part of get-version.sh looks like this:
major_sed="/#define.*$3_MAJORVERSION/s/^.*\([0-9][0-9]*\).*$/\1/p" minor_sed="/#define.*$3_MINORVERSION/s/^.*\([0-9][0-9]*\).*$/\1/p" patch_sed="/#define.*$3_PATCHLEVEL/s/^[^0-9]*\([0-9][0-9a-z-]*\).*$/\1/p" mmn_sed="/#define.*$3_MAJOR/s/^[^0-9]*\([0-9][0-9]*\).*$/\1/p" major="`sed -n $major_sed $2`" minor="`sed -n $minor_sed $2`" patch="`sed -n $patch_sed $2`" mmn="`sed -n $mmn_sed $2`"
Regards,
Graham
--
-----------------------------------------
[EMAIL PROTECTED] "There's a moon
over Bourbon Street
tonight..."