#!/bin/shhaikuTop=$1revisionFile=$2haikuBuildOutputDir=`dirname $revisionFile`lastBuiltRevisionFile=${haikuBuildOutputDir}/last-built-revisioncase `uname` inDarwin)SED=gsed;;*)SED=sed;;esacexport SEDrevision=`cat ${revisionFile} 2>/dev/null`lastBuiltRevision=`cat $lastBuiltRevisionFile 2>/dev/null`originalDir=`pwd`cd ${haikuTop}export LC_ALL=ClocalRev=`git rev-parse HEAD`# only determine the haiku-revision if anything has changed from the# last buildif [ -z "$revision" -o "$lastBuiltRevision" != "$localRev" ]; then# the revision we use is the description of HEAD with respect to the# last reachable hrev-(haiku-revision-)tagrevision=`git describe --dirty --tags --match=hrev* --abbrev=1`if [ -z "$revision" ]; then# failed to find any hrev tags, bail outecho "Error: you are using a Haiku clone without tags, please set"echo " the revision tag to use (e.g. HAIKU_REVISION=hrev43210)"exit 1firevision=`echo $revision | sed 's/-g[0-9a-z]\+//' | sed 's/-/+/g'`if echo "$revision" | grep -- '-' >/dev/null; then# HEAD is not directly a changeset from Haiku's central repo, so we# add the current branch name as additional infobranchName=`git branch | grep '*' | cut -b 3-`revision="$revision [$branchName]"fificd $originalDirif [ -z "$revision" ]; thenrevision=0fiecho $localRev >${lastBuiltRevisionFile}echo $revision >${revisionFile}