Browse Source

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>
pull/1/head
Slávek Banko 4 years ago
parent
commit
a4ee973238
  1. 87
      create_all_tarballs
  2. 76
      create_tarball

87
create_all_tarballs

@ -1,7 +1,8 @@
#!/bin/bash
# Set the current target version
export TARGET=${TARGET:-"14.1.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..."
exit 1
# 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 | egrep -v "no branch|detached" | 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"

76
create_tarball

@ -1,7 +1,8 @@
#!/bin/bash
# Set the current target version
TARGET=${TARGET:-"14.1.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 | egrep -v "no branch|detached" | 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,23 +122,6 @@ 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 | \
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|" | \

Loading…
Cancel
Save