Compare commits

...

17 Commits

Author SHA1 Message Date
Slávek Banko 9d96d333d3
Update switch_all_submodules_to_head_and_clean
+ better detection of whether a branch is remote tracked
+ instead of git pull --rebase is used git fetch and git rebase
+ added verification whether the remote server is available
+ do a git checkout only if the required branch is not active
+ added support for creating a 'tde' submodules tree using git worktree

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 065e9e0936)
7 years ago
Slávek Banko 3ee3a5a70b
Update switch_all_submodules_to_head_and_clean
+ cleaning of temporary branches combined into one operation along with pull
+ this prevents additional communication with the remote server
+ all remote servers will be fetched and also pruned

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 9bb83bf90c)
7 years ago
Slávek Banko 9be6e5e6f0 Update switch_all_submodules_to_head_and_clean:
+ add support for cloning repositories via ssh

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit f50efa7e80)
7 years ago
Slávek Banko c58fea6319 Update switch_all_submodules_to_head_and_clean
+ add cleaning of potential temporary branches from remote server

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit a04af55867)
7 years ago
Slávek Banko d356f38213 Revamp switch_all_submodules_to_head_and_clean
+ script revised according to update_all_submodules
+ files .gitmodules are processed instead of call git submodule foreach
+ modules are initialized during processing instead of at the beginning
+ initialize submodules only if they have not yet been initialized
+ use --no-recurse-submodules at git pull for better overview of the update progress

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 8fb500ce46)
7 years ago
Slávek Banko d46100143d Update update_all_submodules
+ create lock specific by branch
+ initialize submodules only if they have not yet been initialized
+ use --no-recurse-submodules at git pull for better overview of the update progress

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit b0d74087e5)
7 years ago
Slávek Banko c0339738cf Update create_tarball and create_all_tarballs
+ default TARGET is now detected from the TDE core header
+ added check if TARGET is valid for the branch

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit a4ee973238)
7 years ago
Slávek Banko 9982b4a55e Update version number for new target R14.0.5 9 years ago
Slávek Banko 558e70b263 Revamp update_all_submodules
+ submodules file is no longer needed
+ list of submodules is loaded from .gitmodules
+ order of the submodules is determined by .gitmodules
+ nested submodules are processed recursively by .gitmodules
+ all submodules, including nested, are updated in one cycle

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 9f54f58809)
10 years ago
Slávek Banko 0e9786f3a5 Allow to create tarballs on detached branch
For example, for a particular git tag

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 2c76932134)
10 years ago
Slávek Banko 2b30dcc138 Update version number for new target R14.0.4 10 years ago
Slávek Banko 8eb2ea0f54 switch_all_submodules_to_head_and_clean: Add support to clone from mirror
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 980d8ea3f8)
10 years ago
Slávek Banko 6d53459401 switch_all_submodules_to_head_and_clean: Use --rebase on git pull
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 916d3c9355)
10 years ago
Slávek Banko 5097cbe74c Update version number for new target R14.0.3 10 years ago
Slávek Banko 4b764e3a1f Update version number for new target R14.0.2 10 years ago
Slávek Banko 41bd09eab9 Update default target release to R14.0.1
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
11 years ago
Slávek Banko 580cb8e6f8 create_tarball: Split initial character in tag while sorting by version
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 0a16bdf260)
11 years ago

@ -1,7 +1,8 @@
#!/bin/bash
# Set the current target version
export TARGET=${TARGET:-"14.0.0"}
# The default is the version detected from TDE core header.
export TARGET=${TARGET:-}
# When $SUFFIX = true then the package tarball name will be $package-trinity.
# When $SUFFIX != true then the package tarball name will be trinity-$package.
@ -11,7 +12,7 @@ export SUFFIX=${SUFFIX:-"true"}
# Setting base path for tarballs. Tarballs for indivitual modules
# will be created into folders in same structure, as is in 'tde'.
# The default is 'tde-tarballs' in parent directory.
TARBALLS_BASE=${TARBALLS_BASE:-"$(dirname $PWD)/tde-tarballs/$TARGET"}
TARBALLS_BASE=${TARBALLS_BASE:-}
# List of modules to be omitted during creating tarballs.
SKIP_MODULES="
@ -31,27 +32,96 @@ skip_module() {
return 1
}
# Check git-dir
if [[ ! -e .git ]] ||
[[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then
echo "This script can only be run from a top level git directory. Exiting..."
# echo in bold
echobd () {
if [ -p /dev/stdout ]; then
echo "$1"
else
echo -ne "\033[1m"
echo -n "$1"
echo -e "\033[0m"
fi
}
# Move to main tde folder
REMOTE_URL=$(git config --get remote.origin.url 2>/dev/null)
if [ "$REMOTE_URL" != "${REMOTE_URL%/tde-packaging}" ]; then
# Switch from tde-packaging into main tde folder
cd `git rev-parse --show-toplevel`
cd ../tde
REMOTE_URL=$(git config --get remote.origin.url 2>/dev/null)
fi
while [ -n "$REMOTE_URL" ] && [ "$REMOTE_URL" = "${REMOTE_URL%/tde}" ]; do
# Switch from submodule to parent
cd `git rev-parse --show-toplevel`
cd ..
REMOTE_URL=$(git config --get remote.origin.url 2>/dev/null)
done
if [ "$REMOTE_URL" = "${REMOTE_URL%/tde}" ]; then
# Main tde folder not found
echo "This script can only be run from TDE git directory. Exiting."
exit 1
fi
cd `git rev-parse --show-toplevel`
# Check remote branch
branch=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-`
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
if [[ -z "$branch" ]]; then
branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
fi
if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..."
exit 1
fi
# Set target version
if [ -z "$TARGET" ]; then
if [ -f main/tdelibs/tdecore/tdeversion.h ]; then
tdeversionHeader=main/tdelibs/tdecore/tdeversion.h
fi
if [ -f main/tdelibs/kdecore/kdeversion.h ]; then
tdeversionHeader=main/tdelibs/kdecore/kdeversion.h
fi
if [ -z "$tdeversionHeader" ]; then
echo "Cannot find TDE core headers. Exiting."
exit 1
fi
TARGET=`sed -n 's|#define [KT]DE_VERSION_STRING "[^0-9]\?\([^ "]*\).*|\1|p' $tdeversionHeader`
fi
export TARGET
# Check branch by target
if [ "$TARGET" != "${TARGET#3.5.}" ]; then
if [ "$TARGET" != "${TARGET#3.5.13.}" ]; then
targetBranch=v3.5.13-sru
else
targetBranch=master
fi
else
if [ "$TARGET" != "${TARGET%.0}" ]; then
targetBranch=master
else
targetBranch=r${TARGET%.*}.x
fi
fi
if [ "$branch" != "$targetBranch" ]; then
echo "Target $TARGET is not valid on $branch branch. Exiting."
exit 1
fi
# Setting base path for tarballs
TARBALLS_BASE=${TARBALLS_BASE:-"$(dirname $PWD)/tde-tarballs/$TARGET"}
# Create tarballs for submodules
echobd "Create tarballs for $(basename "$PWD") $branch branch"
echobd "Working in $PWD"
if [[ -e .gitmodules ]]; then
create_tarball=$(dirname $(readlink -f "$0"))/create_tarball
sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <.gitmodules | \
while read submodule; do
skip_module "$submodule" && continue
echobd "Module ${submodule}"
if [[ ! -e "$submodule/.git" ]]; then
git submodule init -- "$submodule"
git submodule update -- "$submodule"
@ -63,3 +133,4 @@ if [[ -e .gitmodules ]]; then
(cd "$submodule" && "$create_tarball")
done
fi
echobd "Done in $PWD"

@ -1,7 +1,8 @@
#!/bin/bash
# Set the current target version
TARGET=${TARGET:-"14.0.0"}
# The default is the version detected from TDE core header.
TARGET=${TARGET:-}
# When $SUFFIX = true then the package tarball name will be $package-trinity.
# When $SUFFIX != true then the package tarball name will be trinity-$package.
@ -27,13 +28,67 @@ if [[ ! -e .git ]] ||
fi
# Check remote branch
branch=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-`
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
if [[ -z "$branch" ]]; then
branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
fi
if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..."
exit 1
fi
# Get submodule name
REMOTE_URL=$(git config --get remote.origin.url)
if [ "$REMOTE_URL" = "${REMOTE_URL%/tde}" ]; then
TDEROOT=$( cd `git rev-parse --show-toplevel` &&
cd .. &&
cd `git rev-parse --show-toplevel` &&
pwd )
SUBROOT=$( cd `git rev-parse --show-toplevel` &&
pwd )
elif [ -f .gitignore ]; then
TDEROOT=$( cd `git rev-parse --show-toplevel` &&
pwd )
SUBROOT=$PWD
METAPACKAGE=true
fi
MODULE=${SUBROOT#$TDEROOT/main/}
# Set target version
if [ -z "$TARGET" ]; then
if [ -f $TDEROOT/main/tdelibs/tdecore/tdeversion.h ]; then
tdeversionHeader=$TDEROOT/main/tdelibs/tdecore/tdeversion.h
fi
if [ -f $TDEROOT/main/tdelibs/kdecore/kdeversion.h ]; then
tdeversionHeader=$TDEROOT/main/tdelibs/kdecore/kdeversion.h
fi
if [ -z "$tdeversionHeader" ]; then
echo "Cannot find TDE core headers. Exiting."
exit 1
fi
TARGET=`sed -n 's|#define [KT]DE_VERSION_STRING "[^0-9]\?\([^ "]*\).*|\1|p' $tdeversionHeader`
fi
# Check branch by target
if [ "$TARGET" != "${TARGET#3.5.}" ]; then
if [ "$TARGET" != "${TARGET#3.5.13.}" ]; then
targetBranch=v3.5.13-sru
else
targetBranch=master
fi
else
if [ "$TARGET" != "${TARGET%.0}" ]; then
targetBranch=master
else
targetBranch=r${TARGET%.*}.x
fi
fi
if [ "$branch" != "$targetBranch" ]; then
echo "Target $TARGET is not valid on $branch branch. Exiting."
exit 1
fi
# Check submodules
if [[ -e .gitmodules ]]; then
sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <.gitmodules | \
@ -67,25 +122,10 @@ if [[ -n "$target_tag" ]] && \
exit 1
fi
# Get submodule name
REMOTE_URL=$(git config --get remote.origin.url)
if [ "$REMOTE_URL" = "${REMOTE_URL%/tde}" ]; then
TDEROOT=$( cd `git rev-parse --show-toplevel` &&
cd .. &&
cd `git rev-parse --show-toplevel` &&
pwd )
SUBROOT=$( cd `git rev-parse --show-toplevel` &&
pwd )
elif [ -f .gitignore ]; then
TDEROOT=$( cd `git rev-parse --show-toplevel` &&
pwd )
SUBROOT=$PWD
METAPACKAGE=true
fi
MODULE=${SUBROOT#$TDEROOT/main/}
# Calculate version
tag=`git tag | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr | while read t; do \
tag=`git tag | \
sed "s|^\([^0-9]\)|\1.|" | sort -t. -k 1,1nr -k 2,2nr -k 3,3nr -k 4,4nr -k 5,5nr | sed "s|^\([^0-9]\)\.|\1|" | \
while read t; do \
git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \
echo "$t..HEAD" && break; done`

@ -1,26 +1,41 @@
#!/bin/bash
if [[ ! -e .git ]] ||
# echo in bold
echobd () {
if [ -p /dev/stdout ]; then
echo "$1"
else
echo -ne "\033[1m"
echo -n "$1"
echo -e "\033[0m"
fi
}
# verify git directory and branch
if [[ ! -e .git ]] &&
[[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then
echo "This script can only be run from a top level git directory. Exiting..."
echo "Current directory does not contain a .git folder. Exiting..."
exit 1
fi
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..."
if [[ -z "$branch" ]]; then
branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
fi
if [[ -z "$branch" ]]; then
echo "There is not active branch. Exiting..."
exit 1
fi
# check git abilities
if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then
GIT_IGNORE_SUBMODULES="--ignore-submodules"
remote=`git config branch."$branch".remote`
if [[ -z "$remote" ]]; then
echo "Active branch is not remote tracked. Exiting..."
exit 1
fi
echo "Preparing $PWD for development use"
# get git user
echobd "Preparing $(git rev-parse --show-toplevel | xargs -r basename) $branch branch for development use"
if [[ $1 == "" ]]; then
gituser=`sed -n "/^\[remote \"origin\"\]/,/url/s/\turl = http:\/\/\([^@]*\)@.*/\1/p" <\`git rev-parse --git-dir\`/config | grep -v "\(anonymous\|system\)"`
gituser=`git config --local remote.$remote.url | sed -n "s|\(https\?://\)\?\([^@]*\)@.*|\2|p" | grep -v "\(anonymous\|system\)"`
else
gituser=$1
fi
@ -33,33 +48,113 @@ if [[ $gituser == "" ]]; then
gituser="anonymous"
fi
THISSCRIPT=$(readlink -f $0)
if [[ ! -e "$THISSCRIPT" ]]; then
echo "Unable to find myself! Exiting..."
exit 1
# check git abilities
if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then
GIT_IGNORE_SUBMODULES="--ignore-submodules"
fi
if [[ -n "`git pull --help |grep -- '--\[no-\]recurse-submodules'`" ]]; then
GIT_NO_RECURSE_SUBMODULES="--no-recurse-submodules"
fi
# update module and submodules
updateModule() {
local MODULE
local REPO_URL
local REPO_PROTO
local REPO_MODULE
local REPO_WORKTREE
if [[ "$1" != "" ]]; then
MODULE=$1/
else
MODULE=""
fi
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
cd $PARENTDIR/$MODULE
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD
git clean -dxff
fi
git pull
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
fi
git remote |
while read REMOTE; do
REPO_SERVER=$(git config remote."$REMOTE".url |
sed -n "s|^http[^/]*/*\([^@]*@\)\?\([^/]*\)/.*|\2|p")
if [ -x /usr/bin/fping ] && [ -n "$REPO_SERVER" ]; then
fping -q -r1 "$REPO_SERVER" || continue
fi
echo Fetching $REMOTE
git fetch $REMOTE --prune $GIT_NO_RECURSE_SUBMODULES
done
git branch | grep -x "* $branch" >/dev/null || \
git checkout $branch
remote=`git config branch."$branch".remote`
[[ -n "$remote" ]] || return
git rebase $remote/$branch $branch
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD
git clean -dxff
fi
fi
if [[ -e .gitmodules ]]; then
if [[ -e $PARENTDIR/$MODULE.gitmodules ]]; then
if [[ $gituser == "anonymous" ]]; then
sed -i 's/system@//g' .gitmodules
sed -i 's/system@//g' $PARENTDIR/$MODULE.gitmodules
else
sed -i "s/system@/$gituser@/g" .gitmodules
sed -i "s/system@/$gituser@/g" $PARENTDIR/$MODULE.gitmodules
fi
REPO_URL=$(git config --get remote.$remote.url |\
sed "s|\(https\?://\)\?\([^@]*@\)\?\(.*\)/[^/]*$|\3|")
REPO_PROTO=$(git config --get remote.$remote.url |\
sed "s|\(https\?://\)\?\([^@]*@\)\?\(.*\)/[^/]*$|\1|")
REPO_MASTER=scm.trinitydesktop.org/scm/git
REPO_MODULE=$(git config --get remote.$remote.url |\
sed -e "s|\(https\?://\)\?\([^@]*@\)\?\(.*\)/\([^/]*\)$|\4|" -e "s|\.git$||")
REPO_GITDIR=$(git rev-parse --git-dir)
if [[ "${REPO_GITDIR/worktrees//}" != "$REPO_GITDIR" ]]; then
REPO_WORKTREE=${REPO_GITDIR%/[^/]*/worktrees/[^/]*}
fi
if [[ "$REPO_URL" != "$REPO_MASTER" ]]; then
sed -i "s#https\?://\([^@]*@\)\?$REPO_MASTER#$REPO_PROTO\1$REPO_URL#g" $PARENTDIR/$MODULE.gitmodules
fi
sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <$PARENTDIR/$MODULE.gitmodules |\
while read submodule; do
echobd "Attempting to switch submodule ${MODULE}${submodule}"
cd $PARENTDIR/$MODULE
if [[ -n "$REPO_WORKTREE" ]] && [[ ! -e "$submodule/.git" ]]; then
REPO_LOCALTREE=$(git config --file .gitmodules --get submodule.$submodule.url | \
sed "s#^\(https\?://\)\?\([^@]*@\)\?$REPO_URL#$REPO_WORKTREE#g")
if [[ ! -d "$REPO_LOCALTREE" ]]; then
REPO_LOCALTREE=$REPO_LOCALTREE.git
fi
if [[ ! -d "$REPO_LOCALTREE" ]]; then
git clone --bare --config "remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*" \
"$(git config --file .gitmodules --get submodule.$submodule.url)" "$REPO_LOCALTREE"
fi
if [[ "$REPO_MODULE" != "tde" ]]; then
git config --file .gitmodules submodule.$submodule.url "$REPO_LOCALTREE"
else
(
cd $REPO_LOCALTREE &&
git fetch &&
git worktree add $PARENTDIR/$MODULE$submodule $branch &&
cd $PARENTDIR/$MODULE$submodule &&
git branch --set-upstream-to=origin/$branch
) || continue
fi
fi
if [[ -z "`git config --get submodule.$submodule.url`" ]]; then
git submodule init -- $submodule
fi
if [[ ! -e "$submodule/.git" ]]; then
git submodule update -- $submodule
fi
updateModule ${MODULE}${submodule}
done
git checkout -- $PARENTDIR/$MODULE.gitmodules
fi
}
git submodule init
git submodule update
git submodule foreach "git checkout $branch && $THISSCRIPT $gituser"
git checkout -- .gitmodules
fi
# Update from top module
cd `git rev-parse --show-toplevel`
PARENTDIR=$PWD
echobd "Working in $PARENTDIR"
updateModule
echobd "Done in $PARENTDIR"

@ -1,75 +1,122 @@
#!/bin/bash
if [[ -e /var/lock/update-tde-git-submodules ]]; then
echo "TDE GIT submodules are currently being updated"
echo "If this is not the case, please remove the lockfile /var/lock/update-tde-git-submodules"
exit 0
fi
# echo in bold
echobd () {
if [ -p /dev/stdout ]; then
echo "$1"
else
echo -ne "\033[1m"
echo -n "$1"
echo -e "\033[0m"
fi
}
if [[ ! -e .git ]] ||
# verify git directory and branch
if [[ ! -e .git ]] &&
[[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then
echo "Current directory does not contain a .git folder. Exiting..."
exit 1
fi
branch=`git symbolic-ref -q HEAD | sed "s|^refs/heads/||"`
if [[ -z "$branch" ]]; then
branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
fi
if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..."
exit 1
fi
# get git user
GITUSER="Automated System <$(git config --get user.email)>"
# check git abilities
if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then
GIT_IGNORE_SUBMODULES="--ignore-submodules"
fi
touch /var/lock/update-tde-git-submodules
PARENTDIR=$PWD
echo "Working in $PARENTDIR"
git pull
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD
git clean -dxff
if [[ -n "`git pull --help |grep -- '--\[no-\]recurse-submodules'`" ]]; then
GIT_NO_RECURSE_SUBMODULES="--no-recurse-submodules"
fi
exec 3< submodules
while read <&3
do
cd $PARENTDIR
DIR2UPDATE=$REPLY
if [[ $DIR2UPDATE != "" ]]; then
echo "Attempting to reset submodule $DIR2UPDATE"
cd $PARENTDIR/$DIR2UPDATE/..
# commmit changed module
commitModule() {
if [[ "$1" == "" ]]; then
return
fi
local MODULE=$1
cd $PARENTDIR/$MODULE/..
cd `git rev-parse --show-toplevel`
if [[ -z "`grep \"^Updated: $PWD$\" /var/lock/update-tde-git-submodules`" ]]; then
echo "Updated: $PWD" >>/var/lock/update-tde-git-submodules
git submodule init
git submodule update
if [[ ! -z "`git status --porcelain $PARENTDIR/$MODULE`" ]]; then
echo "Committing changes to $PWD"
git add $PARENTDIR/$MODULE
git commit $PARENTDIR/$MODULE --author "$GITUSER" -m "Reset submodule $MODULE to latest HEAD"
fi
if [[ "`git rev-parse HEAD`" != "`git rev-parse origin/$branch`" ]]; then
echo "Push changes for $PWD"
git pull --rebase $GIT_NO_RECURSE_SUBMODULES
git push origin HEAD
fi
}
# update module and submodules
updateModule() {
local MODULE
if [[ "$1" != "" ]]; then
MODULE=$1/
else
MODULE=""
fi
cd $PARENTDIR/$DIR2UPDATE
cd $PARENTDIR/$MODULE
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD
git clean -dxff
fi
if [[ "$1" != "" ]]; then
git checkout $branch
git pull
cd ..
cd `git rev-parse --show-toplevel`
echo "Committing changes to $PWD"
if [[ ! -z "`git status --porcelain $PARENTDIR/$DIR2UPDATE`" ]]; then
git add $PARENTDIR/$DIR2UPDATE
git commit $PARENTDIR/$DIR2UPDATE -m "Reset submodule $DIR2UPDATE to latest HEAD"
fi
git pull --rebase $GIT_NO_RECURSE_SUBMODULES
if [[ "`git rev-parse HEAD`" != "`git rev-parse origin/$branch`" ]]; then
echo "Push changes for $PWD"
git push origin HEAD
fi
if [[ "$1" != "" ]]; then
commitModule $1
fi
done
exec 3>&-
# Let the disk subsystem recover
sleep 60
if [[ -e $PARENTDIR/$MODULE.gitmodules ]]; then
sed -n "s|^\[submodule \"\([^\"]*\)\"\]$|\1|p" <$PARENTDIR/$MODULE.gitmodules |\
while read submodule; do
echobd "Attempting to reset submodule ${MODULE}${submodule}"
cd $PARENTDIR/$MODULE
if [[ -z "`git config --get submodule.$submodule.url`" ]]; then
git submodule init -- $submodule
fi
if [[ ! -e "$submodule/.git" ]]; then
git submodule update -- $submodule
fi
updateModule ${MODULE}${submodule}
done
if [[ "$1" != "" ]]; then
commitModule $1
fi
fi
}
rm /var/lock/update-tde-git-submodules
# Update from top module
if [[ -e /var/lock/update-tde-git-submodules-$branch ]]; then
echo "TDE GIT submodules are currently being updated"
echo "If this is not the case, please remove the lockfile"
echo "/var/lock/update-tde-git-submodules-$branch"
exit 0
fi
touch /var/lock/update-tde-git-submodules-$branch
echobd "Updating submodules in $(git rev-parse --show-toplevel | xargs -r basename) $branch branch"
cd `git rev-parse --show-toplevel`
PARENTDIR=$PWD
echobd "Working in $PARENTDIR"
updateModule
echobd "Done in $PARENTDIR"
rm /var/lock/update-tde-git-submodules-$branch

Loading…
Cancel
Save