Add branch function
Fix indentation Fix typo
This commit is contained in:
parent
b2627558b7
commit
f08a8ed24e
1 changed files with 51 additions and 8 deletions
59
pg-env
59
pg-env
|
@ -36,11 +36,11 @@ commitfest() {
|
|||
echo "Run this command from PostgreSQL git checkout"
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
IsBranchPreset=$( git worktree list | grep '\[CF_${FestID}_${EntryID}\]' )
|
||||
IsBranchPresent=$( git worktree list | grep '\[CF_${FestID}_${EntryID}\]' )
|
||||
else
|
||||
IsBranchPreset=$( git worktree list | grep '\[${3}_CF_${FestID}_${EntryID}\]' )
|
||||
IsBranchPresent=$( git worktree list | grep '\[CF_${FestID}_${EntryID}_${3}\]' )
|
||||
fi
|
||||
if [ ! -z "${IsBranchPreset}" ]; then
|
||||
if [ ! -z "${IsBranchPresent}" ]; then
|
||||
EXIT_VALUE=1
|
||||
echo "Worktree already present, to remove it use following"
|
||||
echo "git worktree remove --force <worktree dir>"
|
||||
|
@ -59,10 +59,52 @@ commitfest() {
|
|||
exit $EXIT_VALUE
|
||||
}
|
||||
|
||||
branch() {
|
||||
shift
|
||||
branch_name=$1
|
||||
echo "Create new worktree for ${branch_name}"
|
||||
EXIT_VALUE=0
|
||||
if [ $# -ne 1 ] && [ $# -ne 2 ]; then
|
||||
EXIT_VALUE=1
|
||||
echo "Usage: $0 branch <Name of new Branch>"
|
||||
echo "or"
|
||||
echo "Usage: $0 branch <Name of new Branch <PG_RELEASED_BRANCH_NAME>"
|
||||
fi
|
||||
if [ ! -f src/include/postgres.h ] || [ ! -d .git ] ; then
|
||||
EXIT_VALUE=1
|
||||
echo "Run this command from PostgreSQL git checkout"
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
IsBranchPresent=$( git worktree list | grep '\[${branch_name}\]' )
|
||||
else
|
||||
IsBranchPresent=$( git worktree list | grep '\[${branch_name}_${2}\]' )
|
||||
fi
|
||||
if [ ! -z "${IsBranchPresent}" ]; then
|
||||
EXIT_VALUE=1
|
||||
echo "Worktree already present, to remove it use following"
|
||||
echo "git worktree remove --force <worktree dir>"
|
||||
echo "git branch -d <branch name>"
|
||||
fi
|
||||
if [ $EXIT_VALUE -eq 0 ]; then
|
||||
if [ $# -eq 1 ]; then
|
||||
git worktree add --track -b ${branch_name} ../postgresql-${branch_name}
|
||||
create_pgenv HEAD postgresql-${branch_name}
|
||||
else
|
||||
git worktree add --track -b ${branch_name}_${2} ../postgresql-${branch_name}_${2} origin/$2
|
||||
create_pgenv $(grep PACKAGE_VERSION ../postgresql-${branch_name}_${2}/configure | grep -o '[0-9]*' | head -1) postgresql-${branch_name}_${2}
|
||||
fi
|
||||
EXIT_VALUE=$?
|
||||
fi
|
||||
exit $EXIT_VALUE
|
||||
}
|
||||
|
||||
if [ "$0" = "$BASH_SOURCE" ]; then
|
||||
if [ "$1" = "commitfest" ]; then
|
||||
commitfest $@
|
||||
fi
|
||||
if [ "$1" = "branch" ]; then
|
||||
branch $@
|
||||
fi
|
||||
echo "source $0"
|
||||
exit 1
|
||||
fi
|
||||
|
@ -152,9 +194,9 @@ distclean() {
|
|||
compile() {
|
||||
pushd ${PG_DEV_SRC}
|
||||
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||
time ./configure --prefix=${PG_DEV_INST} --enable-debug --with-pgport=${PGPORT} --with-lz4 --with-ssl=openssl --with-python --with-perl --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}" | tee /tmp/pg_compile.log
|
||||
(time ./configure --prefix=${PG_DEV_INST} --enable-injection-points --enable-debug --with-pgport=${PGPORT} --with-lz4 --with-ssl=openssl --with-python --with-perl --enable-debug --enable-cassert --enable-tap-tests CFLAGS="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}") |& tee /tmp/pg_compile.log
|
||||
else
|
||||
time meson setup build --prefix=${PG_DEV_INST} -Dpgport=${PGPORT} -Dlz4=enabled -Dssl=openssl -Dplpython=enabled -Dplperl=enabled -Ddebug=true -Dcassert=true -Dtap_tests=enabled -Dc_args="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}" | tee /tmp/pg_compile.log
|
||||
(time meson setup build --prefix=${PG_DEV_INST} -Dpgport=${PGPORT} -Dlz4=enabled -Dssl=openssl -Dplpython=enabled -Dplperl=enabled -Ddebug=true -Dcassert=true -Dtap_tests=enabled -Dc_args="-ggdb -O0 -g3 -ggdb3 -fno-omit-frame-pointer ${PG_ENV_CFLAGS}") |& tee /tmp/pg_compile.log
|
||||
fi
|
||||
if [ $? -gt 0 ]; then
|
||||
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||
|
@ -164,9 +206,9 @@ compile() {
|
|||
fi
|
||||
else
|
||||
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||
make install | tee -a /tmp/pg_compile.log
|
||||
(time make install) |& tee -a /tmp/pg_compile.log
|
||||
else
|
||||
(cd build; ninja -v install) | tee -a /tmp/pg_compile.log
|
||||
(cd build; time ninja -v install) |& tee -a /tmp/pg_compile.log
|
||||
fi
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "make install failed"
|
||||
|
@ -178,7 +220,7 @@ compile() {
|
|||
compile_contrib() {
|
||||
if [ -z ${MESON_BUILD_PRESENT} ]; then
|
||||
pushd ${PG_DEV_SRC}/contrib
|
||||
time make install | tee -a /tmp/pg_compile.log
|
||||
(time make install) |& tee -a /tmp/pg_compile.log
|
||||
if [ $? -gt 0 ]; then
|
||||
echo "make install failed"
|
||||
fi
|
||||
|
@ -214,6 +256,7 @@ restartdb(){
|
|||
}
|
||||
|
||||
cleandb(){
|
||||
stopdb "$@"
|
||||
if [ -z "$1" ]; then
|
||||
[ -n "$ZSH_VERSION" ] && setopt localoptions rmstarsilent
|
||||
rm -rf $PGDATA/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue