Commit 0c4917f9 authored by Scott Deboy's avatar Scott Deboy

Updating script to reuse branch determination logic, updating echo'd output...

Updating script to reuse branch determination logic, updating echo'd output and fixing a bug in branch evaluation logic
parent 0b2722fa
#!/bin/bash -e
unset BRANCH
function setBranch {
local result="${DEFAULT_BRANCH}"
#if no branch was specified
if [ -z "${DEFAULT_BRANCH}" ]; then
#if usestream was specified but there is no upstream module, use ruih
if $USE_UPSTREAM ; then
if [[ "${NO_UPSTREAM_MODULES[@]}" == *"$module"* ]]; then
result=ruih/master
else
result=master
fi
# if usestream was not specified, use ruih
else
result=ruih/master
fi
fi
echo $result
}
unset DEFAULT_BRANCH
DELIBTOOLIZE=true
INSTALL_DEPS=true
RECONFIGURE=false
......@@ -25,7 +45,7 @@ while true; do
echo " --introspection Enable introspection"
exit;;
-v | --verbose ) VERBOSE=true; shift ;;
--branch ) shift; BRANCH=$1 ; shift ;;
--branch ) shift; DEFAULT_BRANCH=$1 ; shift ;;
--no-delibtoolize ) DELIBTOOLIZE=false ; shift ;;
--no-update ) UPDATE_MODULES=false; shift ;;
--no-deps ) INSTALL_DEPS=false; shift ;;
......@@ -111,6 +131,7 @@ echo Restoring libtoolized pkgconfig files
find . -name '*-uninstalled.pc' -exec sed -i -e 's/\.libs\/\(libgst.\+\).so$/\1\.la/' {} \;
for module in ${GST_MODULES[@]} ; do
unset MODULE_BRANCH
if [ "$module" == "orc" ] ; then
GST_PREFIX=""
else
......@@ -118,28 +139,22 @@ for module in ${GST_MODULES[@]} ; do
fi
# Clone or update the repo
if [ ! -d "$module" ] ; then
echo "Cloning [$module]"
if [[ "${GITHUB_MODULES[@]}" == *"$module"* ]]; then
echo "Cloning [$module] from git@github.com:cablelabs/${module}.git"
if ! git clone "git@github.com:cablelabs/${module}.git" ; then
errors="$errors\nUnable to clone ${module} over SSH, using HTTPS instead."
git clone "https://github.com/cablelabs/${module}.git"
fi
cd $module
else
echo "Cloning [$module] from git://anongit.freedesktop.org/git/gstreamer/$module"
git clone "git://anongit.freedesktop.org/git/gstreamer/$module"
cd $module
fi
if [ -z "$BRANCH" ] ; then
if [[ "${NO_UPSTREAM_MODULES[@]}" == *"$module"* ]]; then
BRANCH=master
else
BRANCH=ruih/master
fi
fi
echo "Checking out branch $BRANCH"
git checkout $BRANCH || errors="$errors\nUnable to checkout branch: $BRANCH for repo $module"
MODULE_BRANCH=$(setBranch $module)
echo "Checking out branch $MODULE_BRANCH"
git checkout $MODULE_BRANCH || errors="$errors\nUnable to checkout branch: $MODULE_BRANCH for repo $module"
elif $UPDATE_MODULES ; then
echo "Updating [$module]"
cd $module
# This file is updated automatically by configure, and we don't care about it.
......@@ -147,23 +162,19 @@ for module in ${GST_MODULES[@]} ; do
git update-index --assume-unchanged win32/common/config.h
fi
echo "Fetching origin for [$module]"
git fetch origin || errors="$errors\nUnable to update remote: origin"
if [ -z "$BRANCH" ] ; then
if [[ "${NO_UPSTREAM_MODULES[@]}" == *"$module"* ]]; then
BRANCH=master
else
BRANCH=ruih/master
fi
fi
git checkout $BRANCH || errors="$errors\nUnable to checkout branch: $BRANCH for repo $module"
MODULE_BRANCH=$(setBranch $module)
# -p means "don't remove merges"
git rebase -p origin/$BRANCH $BRANCH || errors="$errors\nUnable to rebase local branch $BRANCH onto remote branch origin/$BRANCH for repo $module"
# requires the branch to be previously checked out
echo "Rebasing to origin/$MODULE_BRANCH"
git rebase -p origin/$MODULE_BRANCH $MODULE_BRANCH || errors="$errors\nUnable to rebase local branch $MODULE_BRANCH onto remote branch origin/$MODULE_BRANCH for repo $module"
else
cd $module
if [ -z "$BRANCH" ] ; then
git checkout $BRANCH || errors="$errors\nUnable to checkout branch: $BRANCH for repo $module"
if [ -n "$DEFAULT_BRANCH" ] ; then
echo "Checking out branch $DEFAULT_BRANCH"
git checkout $DEFAULT_BRANCH || errors="$errors\nUnable to checkout branch: $DEFAULT_BRANCH for repo $module"
fi
fi
if [[ ! "${NO_UPSTREAM_MODULES[@]}" == *"$module"* ]]; then
......
Markdown is supported
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