Compare commits

...

9 Commits

Author SHA1 Message Date
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,7 @@
#!/bin/bash #!/bin/bash
# Set the current target version # Set the current target version
export TARGET=${TARGET:-"14.0.0"} export TARGET=${TARGET:-"14.0.4"}
# When $SUFFIX = true then the package tarball name will be $package-trinity. # When $SUFFIX = true then the package tarball name will be $package-trinity.
# When $SUFFIX != true then the package tarball name will be trinity-$package. # When $SUFFIX != true then the package tarball name will be trinity-$package.
@ -39,7 +39,7 @@ if [[ ! -e .git ]] ||
fi fi
# Check remote branch # Check remote branch
branch=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-` branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
if [[ -z "$branch" ]] || if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..." echo "There is not active upstream branch. Exiting..."

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# Set the current target version # Set the current target version
TARGET=${TARGET:-"14.0.0"} TARGET=${TARGET:-"14.0.4"}
# When $SUFFIX = true then the package tarball name will be $package-trinity. # When $SUFFIX = true then the package tarball name will be $package-trinity.
# When $SUFFIX != true then the package tarball name will be trinity-$package. # When $SUFFIX != true then the package tarball name will be trinity-$package.
@ -27,7 +27,7 @@ if [[ ! -e .git ]] ||
fi fi
# Check remote branch # Check remote branch
branch=`git branch --contains HEAD | grep -v "no branch" | head -n1 | cut -c 3-` branch=`git branch --contains HEAD | egrep -v "no branch|detached" | head -n1 | cut -c 3-`
if [[ -z "$branch" ]] || if [[ -z "$branch" ]] ||
[[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then [[ -z "`git rev-parse --symbolic-full-name --remotes=\"*/$branch\"`" ]]; then
echo "There is not active upstream branch. Exiting..." echo "There is not active upstream branch. Exiting..."
@ -85,7 +85,9 @@ fi
MODULE=${SUBROOT#$TDEROOT/main/} MODULE=${SUBROOT#$TDEROOT/main/}
# Calculate version # 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 && \ git branch --contains $t | cut -c 3- | grep -x "$branch" >/dev/null && \
echo "$t..HEAD" && break; done` echo "$t..HEAD" && break; done`

@ -44,7 +44,7 @@ if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD git reset --hard HEAD
git clean -dxff git clean -dxff
fi fi
git pull git pull --rebase
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD git reset --hard HEAD
git clean -dxff git clean -dxff
@ -56,6 +56,14 @@ if [[ -e .gitmodules ]]; then
else else
sed -i "s/system@/$gituser@/g" .gitmodules sed -i "s/system@/$gituser@/g" .gitmodules
fi fi
REPO_URL=$(git config --get remote.origin.url |\
sed "s|\(https\?\)://\([^@]*@\)\?\(.*\)/[^/]*$|\3|")
REPO_PROTO=$(git config --get remote.origin.url |\
sed "s|\(https\?\)://\([^@]*@\)\?\(.*\)/[^/]*$|\1|")
REPO_MASTER=scm.trinitydesktop.org/scm/git
if [[ "$REPO_URL" != "$REPO_MASTER" ]]; then
sed -i "s#https\?://\([^@]*@\)\?$REPO_MASTER#$REPO_PROTO://\1$REPO_URL#g" .gitmodules
fi
git submodule init git submodule init
git submodule update git submodule update

@ -6,7 +6,7 @@ if [[ -e /var/lock/update-tde-git-submodules ]]; then
exit 0 exit 0
fi fi
if [[ ! -e .git ]] || if [[ ! -e .git ]] &&
[[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then [[ -z "`git rev-parse --git-dir 2>/dev/null`" ]]; then
echo "Current directory does not contain a .git folder. Exiting..." echo "Current directory does not contain a .git folder. Exiting..."
exit 1 exit 1
@ -19,57 +19,91 @@ if [[ -z "$branch" ]] ||
exit 1 exit 1
fi fi
GITUSER="Automated System <$(git config --get user.email)>"
# check git abilities # check git abilities
if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then if [[ -n "`git status --help 2>/dev/null|grep -- '--ignore-submodules'`" ]]; then
GIT_IGNORE_SUBMODULES="--ignore-submodules" GIT_IGNORE_SUBMODULES="--ignore-submodules"
fi fi
touch /var/lock/update-tde-git-submodules # echo in bold
echobd () {
if [ -p /dev/stdout ]; then
echo "$1"
else
echo -ne "\033[1m"
echo -n "$1"
echo -e "\033[0m"
fi
}
PARENTDIR=$PWD # commmit changed module
echo "Working in $PARENTDIR" commitModule() {
git pull if [[ "$1" == "" ]]; then
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then return
git reset --hard HEAD fi
git clean -dxff local MODULE=$1
fi
exec 3< submodules cd $PARENTDIR/$MODULE/..
while read <&3 cd `git rev-parse --show-toplevel`
do if [[ ! -z "`git status --porcelain $PARENTDIR/$MODULE`" ]]; then
cd $PARENTDIR echo "Committing changes to $PWD"
DIR2UPDATE=$REPLY git add $PARENTDIR/$MODULE
if [[ $DIR2UPDATE != "" ]]; then git commit $PARENTDIR/$MODULE --author "$GITUSER" -m "Reset submodule $MODULE to latest HEAD"
echo "Attempting to reset submodule $DIR2UPDATE" fi
cd $PARENTDIR/$DIR2UPDATE/.. if [[ "`git rev-parse HEAD`" != "`git rev-parse origin/$branch`" ]]; then
cd `git rev-parse --show-toplevel` echo "Push changes for $PWD"
if [[ -z "`grep \"^Updated: $PWD$\" /var/lock/update-tde-git-submodules`" ]]; then git pull --rebase
echo "Updated: $PWD" >>/var/lock/update-tde-git-submodules git push origin HEAD
git submodule init fi
git submodule update }
fi
cd $PARENTDIR/$DIR2UPDATE
if [[ ! -z "`git status --porcelain $GIT_IGNORE_SUBMODULES`" ]]; then
git reset --hard HEAD
git clean -dxff
fi
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
if [[ "`git rev-parse HEAD`" != "`git rev-parse origin/$branch`" ]]; then
git push origin HEAD
fi
fi
done
exec 3>&-
# Let the disk subsystem recover # update module and submodules
sleep 60 updateModule() {
local MODULE
if [[ "$1" != "" ]]; then
MODULE=$1/
else
MODULE=""
fi
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
fi
git pull --rebase
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
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
git submodule init -- $submodule
git submodule update -- $submodule
updateModule ${MODULE}${submodule}
done
if [[ "$1" != "" ]]; then
commitModule $1
fi
fi
}
# Update from top module
touch /var/lock/update-tde-git-submodules
cd `git rev-parse --show-toplevel`
PARENTDIR=$PWD
echobd "Working in $PARENTDIR"
updateModule
echobd "Done in $PARENTDIR"
rm /var/lock/update-tde-git-submodules rm /var/lock/update-tde-git-submodules

Loading…
Cancel
Save