diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2015-09-01 11:16:49 +0200 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2015-09-01 11:22:31 +0200 |
commit | 43230f1239729183fb7d3bff0313253208de9740 (patch) | |
tree | 987a9ac5cc1822f87c24086a732aff492271ae15 /releasetag.sh | |
download | vendor_replicant-release-scripts-43230f1239729183fb7d3bff0313253208de9740.tar.gz vendor_replicant-release-scripts-43230f1239729183fb7d3bff0313253208de9740.tar.bz2 vendor_replicant-release-scripts-43230f1239729183fb7d3bff0313253208de9740.zip |
Initial commit: Release scripts
Replicant 4.2 0004 images release
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
Diffstat (limited to 'releasetag.sh')
-rwxr-xr-x | releasetag.sh | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/releasetag.sh b/releasetag.sh new file mode 100755 index 0000000..21fdad4 --- /dev/null +++ b/releasetag.sh @@ -0,0 +1,103 @@ +#!/bin/sh +# +# Copyright (C) 2015 Paul Kocialkowski <contact@paulk.fr> +# +# 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 3 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/>. +# + +# Variables +SCRIPT=$0 +REPLICANT_DIR=$1 +MANIFEST=$2 + +ARGS_COUNT=1 +COLOR=1 +TMP="/tmp" +REPO="../tools/repo" +RELEASE_KEY="4A80EB23" +REMOTE="replicant" +PUSH_REMOTE="git.replicant.us" + +VERSION="4.2" +RELEASE="0004" + +if [ "$COLOR" = "1" ] +then + color_start="\033[36m" + color_end="\033[0m" +else + color_start="" + color_end="" +fi + +manifest () { + dir=$( pwd ) + cd "$REPLICANT_DIR" + + $REPO manifest -r > $MANIFEST + + cd "$dir" +} + +tag_repos () { + list="" + + default=$( cat $MANIFEST | grep default | grep "remote=\"$REMOTE\"" ) + if [ "$default" != "" ] + then + list=$( cat $MANIFEST | grep project | grep -v "remote=\"" )"\n" + fi + + list="$list"$( cat $MANIFEST | grep project | grep "remote=\"$REMOTE\"" ) + + echo "$list" | while read repo + do + path=$( echo "$repo" | sed "s/.*path=\"\([^\"]*\)\".*/\1/g" ) + revision=$( echo "$repo" | sed "s/.*revision=\"\([^\"]*\)\".*/\1/g" ) + + dir=$( pwd ) + cd "$REPLICANT_DIR/$path" + + echo "Tagging ""$color_start""$path""$color_end"" with $revision" + + git tag -s -u $RELEASE_KEY -m "Replicant $VERSION $RELEASE images release" -a "replicant-$VERSION-$RELEASE" $revision + + echo "Pusing ""$color_start""$path""$color_end" + + path=$( echo $path | tr '[:upper:]' '[:lower:]' ) + + git push "git@$PUSH_REMOTE:replicant/$path.git" "replicant-$VERSION-$RELEASE" + + cd "$dir" + done +} + +print_help () { + echo "$SCRIPT: [REPLICANT_DIR] (MANIFEST)" +} + +# Check for the correct number of args +if [ "$#" -lt "$ARGS_COUNT" ] +then + print_help + exit 1 +fi + +if [ "$MANIFEST" = "" ] +then + MANIFEST="$TMP/manifest.xml" + manifest +fi + +tag_repos |