Skip to content
Snippets Groups Projects
Commit a6b5d042 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: I9ddff07ea935adb73e595a2e8d6a404b08e69a21
parent 764175dd
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 projects hbp_nrp_music_xml and hbp_nrp_music_interface"
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_music_xml/hbp_nrp_music_xml/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-music-xml hbp-nrp-music-interface hbp-nrp-distributed-nest"
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_music_xml/hbp_nrp_music_xml/version.py
setVersion $version hbp_nrp_music_interface/hbp_nrp_music_interface/version.py
setVersion $version hbp_nrp_distributed_nest/hbp_nrp_distributed_nest/version.py
subVersion $version hbp_nrp_music_xml/requirements.txt
subVersion $version hbp_nrp_music_interface/requirements.txt
subVersion $version hbp_nrp_distributed_nest/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