From 2357e3196525de547db6d540650cbb3a31414056 Mon Sep 17 00:00:00 2001 From: o9000 Date: Fri, 24 Apr 2015 18:45:25 +0200 Subject: [PATCH] Updated svn version scripts for git --- CMakeLists.txt | 2 +- get_svnrev.sh | 27 --------------------------- get_version.sh | 3 +++ make_release.sh | 49 +++++++++++++++++++++++++++++++++---------------- 4 files changed, 37 insertions(+), 44 deletions(-) delete mode 100755 get_svnrev.sh create mode 100755 get_version.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index fbc79f5..586080b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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} diff --git a/get_svnrev.sh b/get_svnrev.sh deleted file mode 100755 index 06a48ce..0000000 --- a/get_svnrev.sh +++ /dev/null @@ -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 diff --git a/get_version.sh b/get_version.sh new file mode 100755 index 0000000..b830059 --- /dev/null +++ b/get_version.sh @@ -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')" diff --git a/make_release.sh b/make_release.sh index 98e45e4..af98b56 100755 --- a/make_release.sh +++ b/make_release.sh @@ -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