Updated svn version scripts for git

This commit is contained in:
o9000 2015-04-24 18:45:25 +02:00
parent 3467a44761
commit 2357e31965
4 changed files with 37 additions and 44 deletions

View file

@ -113,7 +113,7 @@ set( DATADIR share CACHE PATH "Directory for shared data" )
set( SYSCONFDIR /etc CACHE PATH "Directory for configuration files" )
set( DOCDIR share/doc/tint2 CACHE PATH "Directory for documentation files" )
add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_svnrev.sh" "\"${PROJECT_SOURCE_DIR}\"" )
add_custom_target( version ALL "${PROJECT_SOURCE_DIR}/get_version.sh" "\"${PROJECT_SOURCE_DIR}\"" )
link_directories( ${X11_LIBRARY_DIRS}
${PANGOCAIRO_LIBRARY_DIRS}

View file

@ -1,27 +0,0 @@
#!/bin/sh
FALLBACK=\"0.11-svn\"
if [ $# -eq 0 ]; then
DIR=.
else
DIR=$1
fi
if [ -f version.h ]; then
REV_OLD=$(cat version.h | cut -d" " -f3)
else
REV_OLD=\"\"
fi
if [ -x "$(which svnversion 2>/dev/null)" -a -d "${DIR}/.svn" ] ; then
REV=\"$(svnversion -n ${DIR})\"
else
REV=${FALLBACK}
fi
if [ ${REV_OLD} != ${REV} ]; then
echo "Building new version.h"
echo "Rev_old: ${REV_OLD} Rev: ${REV}"
echo "#define VERSION_STRING ${REV}" > version.h
fi

3
get_version.sh Executable file
View file

@ -0,0 +1,3 @@
#!/bin/sh
git describe --exact-match 2>/dev/null || echo "0.11-git$(git show -s --pretty=format:%cI.%h | tr -d ':' | tr -d '-' | tr '.' '-' | sed 's/T[0-9\+]*//g')"

View file

@ -1,23 +1,40 @@
#!/bin/bash
# usage: ./make_release.sh RELEASE_VERSION_NUMBER
# Usage: ./make_release.sh
# Creates a tar.bz2 archive of the current tree.
#
# To bump the version number for the current commit (make sure you are in HEAD!), run manually:
#
# git tag -a v0.12 -m 'Version 0.12'
#
# To generate a release for an older tagged commit, first list the tags with:
#
# git tags
#
# then checkout the tagged commit with:
#
# git checkout tags/v0.1
#
# Finally, to revert to HEAD:
#
# git checkout master
if [[ $# -ne 1 ]]; then
echo "usage: $0 RELEASE_VERSION_NUMBER"
exit
fi
VERSION=$(./get_version.sh)
DIR=tint2-${1}
echo "Making release ${DIR}"
rm -Rf ${DIR}
svn export . ${DIR} > /dev/null
DIR=tint2-$VERSION
echo "Making release $DIR"
rm -rf $DIR
# delete unneeded files
rm -f ${DIR}/configure ${DIR}/make_release.sh
git checkout-index --prefix=$DIR/ -a
# replace get_svnrev.sh by a simple echo command
echo "echo \"#define VERSION_STRING \\\"${1}\\\"\" > version.h" > ${DIR}/get_svnrev.sh
# Delete unneeded files
rm -f $DIR/make_release.sh
# create tarball and remove the exported directory
tar -cjf ${DIR}.tar.bz2 ${DIR}
rm -Rf ${DIR}
echo "echo \"#define VERSION_STRING \\\"$VERSION\\\"\" > version.h" > $DIR/get_version.sh
# Create tarball and remove the exported directory
tar -cjf $DIR.tar.bz2 $DIR
rm -rf $DIR
sha1sum -b $DIR.tar.bz2
sha256sum -b $DIR.tar.bz2