Skip to content
Snippets Groups Projects
Commit 833edfe9 authored by Ugo Albanese's avatar Ugo Albanese
Browse files

Merged in clone-admin-scripts-NRRPLT-8318 (pull request #83)

[NRRPLT-8318] Clone and keep up to date admin-scripts in developers source installation.

Approved-by: Viktor Vorobev
parent 1f706dfb
No related branches found
No related tags found
No related merge requests found
......@@ -3,13 +3,13 @@
install_dir="$HBP"
if [[ -z "$install_dir" ]] ; then
if [[ -z "$install_dir" ]]; then
echo "Please set the \$HBP variable to your desired installation path first."
exit
else
if [[ -d "$install_dir" ]] ; then
if [[ -d "$install_dir" ]]; then
echo "The NRP repos will be cloned to the already-existing directory" "$install_dir"
elif [[ -f "$install_dir" ]] ; then
elif [[ -f "$install_dir" ]]; then
echo "Invalid destination." "$install_dir" "is a file."
exit 1
else
......@@ -20,23 +20,21 @@ fi
# Get Bitbucket username to clone repos for developers
echo
if [ "$NRP_INSTALL_MODE" != "user" ]
then
if [ "$NRP_INSTALL_MODE" != "user" ]; then
read -p "Enter your Bitbucket username: " user
fi
echo
function clone_repo {
function clone_repo() {
[ "$#" -ne 1 ] && echo "Invalid number of arguments to clone_repo. Aborting." && exit 1
echo
echo $1
if [ -d "$1" ] ; then
if [ -d "$1" ]; then
echo "Skipped, directory already exists."
else
if [ "$NRP_INSTALL_MODE" == "user" ]
then
if [ "$NRP_INSTALL_MODE" == "user" ]; then
git clone -b master --depth 1 https://bitbucket.org/hbpneurorobotics/$1.git $1
else
git clone $user@bitbucket.org:hbpneurorobotics/$1.git $1
......@@ -76,16 +74,22 @@ daint)
)
;;
*)
repos=(
${nrp_3rd_party[*]}
${nrp_repos[*]}
)
repos=(
${nrp_3rd_party[*]}
${nrp_repos[*]}
)
;;
esac
echo "Cloning repos:"
pushd "$install_dir" > /dev/null
for repo in "${repos[@]}" ; do
clone_repo "$repo";
pushd "$install_dir" >/dev/null
for repo in "${repos[@]}"; do
clone_repo "$repo"
done
popd > /dev/null
# developer install repos
if [ "$NRP_INSTALL_MODE" != "user" ]; then
for dev_repo in "${nrp_dev[@]}"; do
clone_repo "$dev_repo"
done
fi
popd >/dev/null
......@@ -238,6 +238,15 @@ function nrp_rebase {
${nrp_repos[*]}
)
fi
# developer installation repos
if [ "$NRP_INSTALL_MODE" != "user" ]; then
repos=(
${repos[*]}
${nrp_dev[*]}
)
fi
for i in "${repos[@]}"
do
echo
......@@ -245,7 +254,7 @@ function nrp_rebase {
echo $i
echo -------------------------
sleep 2
cd "$i"|| { echo NOT FOUND. You might want to run the clone-all-repos script to get this repo; exit 1; }
pushd "$i"|| { echo NOT FOUND. You might want to run the clone-all-repos script to get this repo; exit 1; }
# in case there are unstaged changes we prompt the user to stash them
if git status --short | grep -v "??" > /dev/null 2>&1
......@@ -263,8 +272,14 @@ function nrp_rebase {
fi
fi
git checkout $rebase_branch && git pull --rebase || { echo ERROR; exit 1; }
cd ..
if ! git checkout "$rebase_branch"
then
git checkout master || { echo ERROR; exit 1; }
fi
git pull --rebase || { echo ERROR; exit 1; }
popd
done
}
......
......@@ -31,3 +31,7 @@ nrp_3rd_party=(
nest-simulator
# retina
)
# developer installation repos
nrp_dev=(
admin-scripts
)
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