[Japi-cvs] SF.net SVN: japi:[921] common/trunk
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2009-02-17 11:04:03
|
Revision: 921
http://japi.svn.sourceforge.net/japi/?rev=921&view=rev
Author: christianhujer
Date: 2009-02-17 11:03:57 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Added branch.sh and release.sh for automating branching and releasing.
Added Paths:
-----------
common/trunk/branch.sh
common/trunk/release.sh
Added: common/trunk/branch.sh
===================================================================
--- common/trunk/branch.sh (rev 0)
+++ common/trunk/branch.sh 2009-02-17 11:03:57 UTC (rev 921)
@@ -0,0 +1,75 @@
+#!/bin/bash
+
+# Copyright (C) 2009 Christian Hujer.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+# Returns the latest branch.
+# If no branches are avaialable, 0.0 is returned.
+function getPreviousBranch() {
+ version=$( (cd ../branches ; ls) | grep -P '^\d+\.\d+$' | sort -g -t . -k 2 | sort -g -t . -k 1 -s | tail -n 1 )
+ if [[ -z $version ]]
+ then
+ version=0.0
+ fi
+ echo $version
+}
+
+# Returns the next minor branch.
+# For the first branch, 0.1 is returned.
+function getNextMinorBranch() {
+ version=$(getPreviousBranch)
+ if [[ $version =~ ^([0-9]+)\.([0-9]+)$ ]]
+ then
+ major=${BASH_REMATCH[1]}
+ minor=${BASH_REMATCH[2]}
+ else
+ echo Cannot split version $version into major and minor
+ exit 1
+ fi
+ minor=$(( $minor + 1 ))
+ echo $major.$minor
+}
+
+# Returns the next major branch.
+# For the first major branch, 1.0 is returned.
+function getNextMajorBranch() {
+ version=$(getPreviousBranch)
+ if [[ $version =~ ^([0-9]+)\.([0-9]+)$ ]]
+ then
+ major=${BASH_REMATCH[1]}
+ minor=${BASH_REMATCH[2]}
+ else
+ echo Cannot split version $version into major and minor
+ exit 1
+ fi
+ major=$(( $major + 1 ))
+ echo $major.0
+}
+
+# TODO:2009-02-17:christianhujer:Add support for options like -h.
+# TODO:2009-02-17:christianhujer:Add a check if we really are in trunk/.
+
+if [[ $1 == '-m' ]]
+then
+ branch=$(getNextMajorBranch)
+else
+ branch=$(getNextMinorBranch)
+fi
+branchdir=../branches/$branch
+svn cp . $branchdir
+cd $branchdir
+svn propset svn:externals "$(svn propget svn:externals . | sed "s/^\^\/common\/trunk common$/^\/comon\/trunk@$(svnversion) common/ " )" .
+echo svn commit -m "Created branch $branch." ..
Property changes on: common/trunk/branch.sh
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
Added: common/trunk/release.sh
===================================================================
--- common/trunk/release.sh (rev 0)
+++ common/trunk/release.sh 2009-02-17 11:03:57 UTC (rev 921)
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# Copyright (C) 2009 Christian Hujer.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+branch=$(basename $(pwd))
+
+# Returns the next tag for this branch.
+# If no tag are avaialable, $branch.0 is returned.
+function getNextTag() {
+ version=$( (cd ../../tags ; ls) | grep -P '^'$branch'\.\d+$' | sort -g -t . -k 3 | tail -n 1 )
+ if [[ -z $version ]]
+ then
+ version=$branch.0
+ else
+ if [[ $version =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
+ then
+ major=${BASH_REMATCH[1]}
+ minor=${BASH_REMATCH[2]}
+ rel=${BASH_REMATCH[3]}
+ else
+ echo Cannot split version $version into major and minor
+ exit 1
+ fi
+ version=$major.$minor.$(( $rel + 1 ))
+ fi
+ echo $version
+}
+
+# TODO:2009-02-17:christianhujer:Add support for options like -h.
+# TODO:2009-02-17:christianhujer:Add a check if we really are in trunk/.
+
+tag=$(getNextTag)
+tagdir=../tags/$tag
+svn cp . $tagdir
+cd $tagdir
+echo svn commit -m "Created release tag $tag for branch $branch." ..
+echo ant dist
+# TODO:2009-02-17:christianhujer:Get sourceforge username from developer.properties.
+echo rsync -avPe ssh dist/ chr...@fr...:uploads/
Property changes on: common/trunk/release.sh
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ LF
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|