#!/usr/bin/sh
#
# Copyright (c) 2006 Red Hat, Inc.
#
# This program is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 2 of
# the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see http://www.gnu.org/licenses/.
#
# Author: Greg Nichols
#
# determine the next available package tag for test package

# usage: get_version_info [-v | -r] [<rcs tag>] 

OPTION="$1"
TAG="$2"

# defaults
if [ -n "$TESTVERSION" ]; then
   VERSION="$TESTVERSION"
else
   VERSION="1.0"
fi
RELEASE="0"

if [ -n "$TAG" ]; then
   VERSION=`echo $TAG |  sed -e "s/.*-\([0-9_\.]*\)-\([0-9]*\)$/\1/" | sed -e 's/_/\./g'`
   RELEASE=`echo $TAG |  sed -e "s/.*-\([0-9]*\)$/\1/"`
fi


if [ "$OPTION" = "-v" ]; then
	echo $VERSION
fi

if [ "$OPTION" = "-r" ]; then
	echo $RELEASE
fi 

