Enable embedding versioning info into the repo

Add a script to write a .ottdrev style file: .ottdrev-vc, which also
includes a SHA-256 hash of the source tree.
Modify findversion.sh to use this file if no VCS info can be found,
and use the source tree hash to set the modified status.
Include leading digits of hash in version string if different,
this is to make it easier to distinguish between modified or
non-release versions.
Add function to create release tag and create/commit .ottdrev-vc
in one go.
This commit is contained in:
Jonathan G Rennison
2015-08-31 01:51:01 +01:00
parent 8c389a2a96
commit 1b8166b198
2 changed files with 169 additions and 0 deletions

View File

@@ -122,6 +122,30 @@ elif [ -d "$ROOT_DIR/.hg" ]; then
# No rev? Maybe it is a custom hgsubversion clone
REV_NR=`LC_ALL=C HGPLAIN= hg parent --template="{svnrev}"`
fi
elif [ -f "$ROOT_DIR/.ottdrev-vc" ]; then
VERSION_DATA="`cat "$ROOT_DIR/.ottdrev-vc" | sed -n -e '1 p;'`"
HASH_DATA="`cat "$ROOT_DIR/.ottdrev-vc" | sed -n -e '2 p;'`"
REV="`echo "$VERSION_DATA" | cut -f 1 -d' '`"
REV_NR="`echo "$VERSION_DATA" | cut -f 2 -d' '`"
MODIFIED="`echo "$VERSION_DATA" | cut -f 3 -d' '`"
CLEAN_REV="`echo "$VERSION_DATA" | cut -f 4 -d' '`"
if [ "$MODIFIED" = "2" ]; then
CLEAN_REV="`echo "$CLEAN_REV" | sed -e 's/M$//'`"
fi
BRANCH="`echo "$REV" | sed -n -e "s|^${CLEAN_REV}M\?-\(.\+\)$|\1|p"`"
REV="$CLEAN_REV"
if ! $ROOT_DIR/version_utils.sh -o; then
MODIFIED="1"
else
CURRENT_HASH="`$ROOT_DIR/version_utils.sh -s`"
if [ "$CURRENT_HASH" != "$HASH_DATA" ]; then
MODIFIED="2"
if [ -n "$BRANCH" ]; then
BRANCH="$BRANCH-"
fi
BRANCH="${BRANCH}H`echo "$CURRENT_HASH" | cut -c 1-8`"
fi
fi
elif [ -f "$ROOT_DIR/.ottdrev" ]; then
# We are an exported source bundle
cat $ROOT_DIR/.ottdrev