Skip to content
Snippets Groups Projects
Commit 4a7c3d97 authored by Emmanouil Angelidis's avatar Emmanouil Angelidis
Browse files

[NRRPLT-5939] New script to change all the nprRepos versions automatically

The script reads the repos.txt file from the user-scripts and:

1. Compares the old version with the new one in all the repos, and
   if they new is smaller it stops execution
2. Changes all the versions in all the repos to the new version

Change-Id: I2ac773a039ba06d8873f52489ea0a3b7b95094fa
parent ef2c4b23
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
# Substitutes versions of all packages in this repo
# by Bernd Eckstein
function showSyntax() {
echo
echo "This script substitutes the versions in version.py and requirements.txt"
echo "for the project hbp_nrp_virtual_coach"
echo
echo "Syntax: ./setVersion.sh [parameter]"
echo
echo "Parameters:"
echo " --set M.m.p[.devX]] Set version. See examples below"
echo " --show Show current version"
echo " --help Show this help"
echo
echo "Examples: ./setVersion.sh --set 0.4.2.dev5"
echo " ./setVersion.sh --set 0.4.3"
echo
}
function showVersion() {
cat hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/version.py | grep VERSION
}
function testVersion() {
version=$1
if [[ $version =~ ^[0-9]+\.[0-9]+\.[0-9]+(\.dev[0-9]+)?$ ]]; then
return
else
echo
echo "Version string '$version' is not in the format M.m.p[.devX]"
echo "Examples: '0.4.2.dev5'"
echo " '0.4.3'"
echo
exit -1
fi
}
function setVersion() {
version=$1
file=$2
echo " ... "$file
echo "'''version string - generated by setVersion.sh'''" > $file
echo "VERSION = '$version'" >> $file
}
function subVersion() {
version=$1
file=$2
echo " ... "$file
list="hbp-nrp-virtual-coach"
for i in $list; do
sed -i "/$i/c\\$i==$version" $file
done
}
# make sure we are in the directory of the script
cd "$(dirname "$0")"
case "$1" in
--help)
showSyntax
exit
;;
--show)
showVersion
exit
;;
--set)
# just continue
;;
*)
showSyntax
exit
;;
esac
version=$2
testVersion $version # may exit
echo
echo "Setting versions to '"$version"'" in ...
setVersion $version hbp_nrp_virtual_coach/hbp_nrp_virtual_coach/version.py
subVersion $version hbp_nrp_virtual_coach/requirements.txt
echo done.
echo
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment