X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=releng%2Fdoc%2Frelease-helper.sh;fp=releng%2Fdoc%2Frelease-helper.sh;h=7f2020e317f8e15c7db4ec3a5309347a98751524;hp=0000000000000000000000000000000000000000;hb=9bc64dd138fad9e364dd69e9c3e1e337cf7e8b32;hpb=480b0e3c16a3958a21de00707b9957c422c21c88 diff --git a/releng/doc/release-helper.sh b/releng/doc/release-helper.sh new file mode 100755 index 000000000..7f2020e31 --- /dev/null +++ b/releng/doc/release-helper.sh @@ -0,0 +1,221 @@ +#!/bin/bash + +self=`basename $0` +version=$1 +branch=$2 +user=$3 +action=$4 +tagForVersion=v${version} + +############################################################################### + +declare -a repositories=( + "simantics/third-party.git" "third-party" + "simantics/platform.git" "platform" + "simantics/fmil.git" "fmil" + "simantics/interop.git" "interop" + "simantics/district.git" "district" + "simantics/matlab.git" "matlab" + "simantics/python.git" "python" + "simantics/r.git" "r" + "simantics/sysdyn.git" "sysdyn" + "members/fmi.git" "fmi" + "members/simupedia.git" "simupedia" +) + +repositoryCount=$((${#repositories[@]} / 2)) + +function repo { + eval $1=\${repositories[$(($2 * 2))]} +} + +function localPath { + eval $1=\${repositories[$(($2 * 2 + 1))]} +} + +############################################################################### + +function msg { + echo "[$(($1+1))/${repositoryCount}] $2" +} + +function clone { + echo "git clone ssh://${user}@www.simantics.org:29418/$1" + git clone ssh://${user}@www.simantics.org:29418/$1 +} + +function branch { + echo "git branch $1" + git branch $1 +} + +function fetch { + echo "git fetch --all" + git fetch --all +} + +function pull { + echo "git pull --all" + git pull --all +} + +function pushBranch { + echo "git push origin $1" + git push origin $1 +} + +function checkout { + echo "git checkout $1" + git checkout $1 +} + +function tag { + echo "git tag $1 -m \"Simantics $1 simultaneous release\"" + git tag $1 -m "Simantics $1 simultaneous release" +} + +function removeTag { + echo "git tag -d $1" + git tag -d $1 +} + +function pushTags { + echo "git push origin --tags" + git push origin --tags +} + +function status { + git status +} + +function listTags { + git tag -l +} + +function listBranches { + git branch -a +} + +############################################################################### + +case "$action" in + clone) + mkdir -p $version + pushd $version > /dev/null + for (( i=0; i<${repositoryCount}; i++ )); do + repo p $i + msg $i "Clone $p" + clone $p + done + popd > /dev/null + exit 0 + ;; +esac + +pushd $version > /dev/null +case "$action" in + branch) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Create $branch branch in $lp" + pushd $lp > /dev/null + branch $branch + popd > /dev/null + done + ;; + checkout) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Checkout $branch branch in $lp" + pushd $lp > /dev/null + checkout $branch + popd > /dev/null + done + ;; + tag) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Tag ${version} for $lp" + pushd $lp > /dev/null + checkout $branch + tag ${tagForVersion} + popd > /dev/null + done + ;; + list-branches) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "List branches in $lp" + pushd $lp > /dev/null + listBranches + popd > /dev/null + done + ;; + list-tags) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "List tags in $lp" + pushd $lp > /dev/null + listTags + popd > /dev/null + done + ;; + remove-tag) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Remove tag $tagForVersion from $lp" + pushd $lp > /dev/null + removeTag ${tagForVersion} + popd > /dev/null + done + ;; + fetch) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Fetch from remote origin in $lp" + pushd $lp > /dev/null + fetch + popd > /dev/null + done + ;; + pull) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Pull from remote origin in $lp" + pushd $lp > /dev/null + pull + popd > /dev/null + done + ;; + push) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Push branch $branch to remote origin in $lp" + pushd $lp > /dev/null + pushBranch $branch + popd > /dev/null + done + ;; + push-tags) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Push tags to remote origin in $lp" + pushd $lp > /dev/null + pushTags + popd > /dev/null + done + ;; + status) + for (( i=0; i<${repositoryCount}; i++ )); do + localPath lp $i + msg $i "Status of $lp" + pushd $lp > /dev/null + status + popd > /dev/null + done + ;; + *) + echo "Usage: ${self} clone|branch|checkout|fetch|list-tags|pull|push|push-tags|remove-tag|status|tag" + + ;; +esac