Don't use old-style variable notation.

This commit is contained in:
Dave Page 2019-03-21 14:02:19 +00:00
parent b2b5629a01
commit 17464aa034
9 changed files with 228 additions and 228 deletions

View File

@ -24,16 +24,16 @@ fi
APP_RELEASE=`grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //'`
APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
APP_SHORT_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
APP_SHORT_VERSION=`echo ${APP_LONG_VERSION} | cut -d . -f1,2`
APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
if [ ! -z $APP_SUFFIX ]; then
export APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
if [ ! -z ${APP_SUFFIX} ]; then
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
fi
CONTAINER_NAME=`echo $APP_NAME | sed 's/ //g' | awk '{print tolower($0)}'`
CONTAINER_NAME=`echo ${APP_NAME} | sed 's/ //g' | awk '{print tolower($0)}'`
# Output basic details to show we're working
echo Building Docker Container for $APP_NAME version $APP_LONG_VERSION...
echo Building Docker Container for ${APP_NAME} version ${APP_LONG_VERSION}...
# Create/clearout the build directory
echo Creating/cleaning required directories...
@ -56,7 +56,7 @@ cp pkg/docker/Dockerfile \
docker-build/
# Build the container
docker build docker-build -t $CONTAINER_NAME \
-t $CONTAINER_NAME:latest \
-t $CONTAINER_NAME:$APP_RELEASE \
-t $CONTAINER_NAME:$APP_LONG_VERSION
docker build docker-build -t ${CONTAINER_NAME} \
-t ${CONTAINER_NAME}:latest \
-t ${CONTAINER_NAME}:${APP_RELEASE} \
-t ${CONTAINER_NAME}:${APP_LONG_VERSION}

View File

@ -3,12 +3,12 @@
# Build script to create Mac App Bundle and DMG for pgAdmin4 runtime
export WD=$(cd `dirname $0` && pwd)
export SOURCEDIR=$WD/../..
export BUILDROOT=$WD/../../mac-build
export DISTROOT=$WD/../../dist
export SOURCEDIR=${WD}/../..
export BUILDROOT=${WD}/../../mac-build
export DISTROOT=${WD}/../../dist
export VIRTUALENV=venv
if [ ! -f $SOURCEDIR/pkg/mac/framework.conf ]; then
if [ ! -f ${SOURCEDIR}/pkg/mac/framework.conf ]; then
echo
echo "Error: pkg/mac/framework.conf not found!"
echo "Copy pkg/mac/framework.conf.in to pkg/mac/framework.conf and edit as required for the current system."
@ -17,7 +17,7 @@ if [ ! -f $SOURCEDIR/pkg/mac/framework.conf ]; then
fi
export SYSTEM_PYTHON=0
if [ "x$PYTHON_HOME" == "x" ]; then
if [ "x${PYTHON_HOME}" == "x" ]; then
echo "PYTHON_HOME not set. Setting it to default"
export PYTHON_HOME=/System/Library/Frameworks/Python.framework/Versions/2.7
export PYTHON_VERSION=27
@ -25,39 +25,39 @@ if [ "x$PYTHON_HOME" == "x" ]; then
fi
# Check if Python is working and calculate PYTHON_VERSION
if $PYTHON_HOME/bin/python2 -V > /dev/null 2>&1; then
export PYTHON_VERSION=`$PYTHON_HOME/bin/python2 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
elif $PYTHON_HOME/bin/python3 -V > /dev/null 2>&1; then
export PYTHON_VERSION=`$PYTHON_HOME/bin/python3 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
if ${PYTHON_HOME}/bin/python2 -V > /dev/null 2>&1; then
export PYTHON_VERSION=`${PYTHON_HOME}/bin/python2 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
elif ${PYTHON_HOME}/bin/python3 -V > /dev/null 2>&1; then
export PYTHON_VERSION=`${PYTHON_HOME}/bin/python3 -V 2>&1 | awk '{print $2}' | cut -d"." -f1-2 | sed 's/\.//'`
else
echo "Error: Python installation missing!"
exit 1
fi
if [ "$PYTHON_VERSION" -gt "36" -a "$PYTHON_VERSION" -lt "26" ]; then
if [ "${PYTHON_VERSION}" -gt "37" -a "${PYTHON_VERSION}" -lt "27" ]; then
echo "Python version not supported"
exit 1
fi
if [ "$PYTHON_VERSION" -ge "30" ]; then
export PYTHON=$PYTHON_HOME/bin/python3
if [ "${PYTHON_VERSION}" -ge "30" ]; then
export PYTHON=${PYTHON_HOME}/bin/python3
export PIP=pip3
else
export PYTHON=$PYTHON_HOME/bin/python2
export PYTHON=${PYTHON_HOME}/bin/python2
export PIP=pip
fi
if [ "x$QTDIR" == "x" ]; then
if [ "x${QTDIR}" == "x" ]; then
echo "QTDIR not set. Setting it to default"
export QTDIR=~/Qt/5.8/clang_64
fi
export QMAKE=$QTDIR/bin/qmake
if ! $QMAKE --version > /dev/null 2>&1; then
export QMAKE=${QTDIR}/bin/qmake
if ! ${QMAKE} --version > /dev/null 2>&1; then
echo "Error: qmake not found. QT installation is not present or incomplete."
exit 1
fi
if [ "x$PGDIR" == "x" ]; then
if [ "x${PGDIR}" == "x" ]; then
echo "PGDIR not set. Setting it to default"
export PGDIR=/usr/local/pgsql
fi
@ -66,71 +66,71 @@ _get_version() {
export APP_RELEASE=`grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
export APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
export APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //'`
export APP_BUNDLE_NAME=$APP_NAME.app
export APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
export APP_SHORT_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
export APP_BUNDLE_NAME=${APP_NAME}.app
export APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
export APP_SHORT_VERSION=`echo ${APP_LONG_VERSION} | cut -d . -f1,2`
export APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
if [ ! -z $APP_SUFFIX ]; then
export APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
if [ ! -z ${APP_SUFFIX} ]; then
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
fi
}
_cleanup() {
echo "Cleaning up the old environment and app bundle"
rm -rf $SOURCEDIR/runtime/pgAdmin4.app
rm -rf $BUILDROOT
rm -f $DISTROOT/pgadmin4*.dmg
rm -rf ${SOURCEDIR}/runtime/pgAdmin4.app
rm -rf ${BUILDROOT}
rm -f ${DISTROOT}/pgadmin4*.dmg
}
_create_python_virtualenv() {
export PATH=$PGDIR/bin:$PATH
export LD_LIBRARY_PATH=$PGDIR/lib:$_LD_LIBRARY_PATH
test -d $BUILDROOT || mkdir $BUILDROOT || exit 1
cd $BUILDROOT
export PATH=${PGDIR}/bin:${PATH}
export LD_LIBRARY_PATH=${PGDIR}/lib:${LD_LIBRARY_PATH}
test -d ${BUILDROOT} || mkdir ${BUILDROOT} || exit 1
cd ${BUILDROOT}
if [ $SYSTEM_PYTHON -eq 1 ]; then
test -d $VIRTUALENV || virtualenv -p $PYTHON $VIRTUALENV || exit 1
if [ ${SYSTEM_PYTHON} -eq 1 ]; then
test -d ${VIRTUALENV} || virtualenv -p ${PYTHON} ${VIRTUALENV} || exit 1
else
test -d $VIRTUALENV || virtualenv -p $PYTHON --always-copy $VIRTUALENV || exit 1
test -d ${VIRTUALENV} || virtualenv -p ${PYTHON} --always-copy ${VIRTUALENV} || exit 1
fi
source $VIRTUALENV/bin/activate
$PIP install --no-cache-dir --no-binary psycopg2 -r $SOURCEDIR/requirements.txt || { echo PIP install failed. Please resolve the issue and rerun the script; exit 1; }
source ${VIRTUALENV}/bin/activate
${PIP} install --no-cache-dir --no-binary psycopg2 -r ${SOURCEDIR}/requirements.txt || { echo PIP install failed. Please resolve the issue and rerun the script; exit 1; }
# Figure out some paths for use when completing the venv
# Use "python" here as we want the venv path
export PYMODULES_PATH=`python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())"`
export DIR_PYMODULES_PATH=`dirname $PYMODULES_PATH`
export DIR_PYMODULES_PATH=`dirname ${PYMODULES_PATH}`
# Use $PYTHON here as we want the system path
export PYSYSLIB_PATH=`$PYTHON -c "import sys; print('%s/lib/python%d.%.d' % (sys.prefix, sys.version_info.major, sys.version_info.minor))"`
export PYSYSLIB_PATH=`${PYTHON} -c "import sys; print('%s/lib/python%d.%.d' % (sys.prefix, sys.version_info.major, sys.version_info.minor))"`
# Symlink in the rest of the Python libs. This is required because the runtime
# will clear PYTHONHOME for safety, which has the side-effect of preventing
# it from finding modules that are not explicitly included in the venv
cd $DIR_PYMODULES_PATH
cd ${DIR_PYMODULES_PATH}
# Files
for FULLPATH in $PYSYSLIB_PATH/*.py; do
for FULLPATH in ${PYSYSLIB_PATH}/*.py; do
FILE=${FULLPATH##*/}
if [ ! -e $FILE ]; then
if [ $SYSTEM_PYTHON -eq 1 ]; then
ln -s $FULLPATH $FILE
if [ ! -e ${FILE} ]; then
if [ ${SYSTEM_PYTHON} -eq 1 ]; then
ln -s ${FULLPATH} ${FILE}
else
cp $FULLPATH $FILE
cp ${FULLPATH} ${FILE}
fi
fi
done
# Paths
for FULLPATH in $PYSYSLIB_PATH/*/; do
for FULLPATH in ${PYSYSLIB_PATH}/*/; do
FULLPATH=${FULLPATH%*/}
FILE=${FULLPATH##*/}
if [ ! -e $FILE ]; then
if [ $SYSTEM_PYTHON -eq 1 ]; then
ln -s $FULLPATH $FILE
if [ ! -e ${FILE} ]; then
if [ ${SYSTEM_PYTHON} -eq 1 ]; then
ln -s ${FULLPATH} ${FILE}
else
cp -R $FULLPATH $FILE
cp -R ${FULLPATH} ${FILE}
fi
fi
done
@ -141,56 +141,56 @@ _create_python_virtualenv() {
find . -name "tests" -type d -exec rm -rf "{}" \;
# Link the python<version> directory to python so that the private environment path is found by the application.
if test -d $DIR_PYMODULES_PATH; then
ln -s $(basename $DIR_PYMODULES_PATH) $DIR_PYMODULES_PATH/../python
if test -d ${DIR_PYMODULES_PATH}; then
ln -s $(basename ${DIR_PYMODULES_PATH}) ${DIR_PYMODULES_PATH}/../python
fi
}
_build_runtime() {
_create_python_virtualenv || exit 1
cd $SOURCEDIR/runtime
cd ${SOURCEDIR}/runtime
make clean
$QMAKE || { echo qmake failed; exit 1; }
${QMAKE} || { echo qmake failed; exit 1; }
make || { echo make failed; exit 1; }
cp -r pgAdmin4.app "$BUILDROOT/$APP_BUNDLE_NAME"
cp -r pgAdmin4.app "${BUILDROOT}/${APP_BUNDLE_NAME}"
}
_build_doc() {
cd $SOURCEDIR/docs/en_US
test -d "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources" || "mkdir -p $BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources"
test -d "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/docs/en_US" || mkdir -p "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/docs/en_US"
cp -r _build/html "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/docs/en_US/" || exit 1
cd ${SOURCEDIR}/docs/en_US
test -d "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources" || "mkdir -p ${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources"
test -d "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/docs/en_US" || mkdir -p "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/docs/en_US"
cp -r _build/html "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/docs/en_US/" || exit 1
}
_complete_bundle() {
cd $SOURCEDIR/pkg/mac
cd ${SOURCEDIR}/pkg/mac
# Copy the binary utilities into place
mkdir -p "$BUILDROOT/$APP_BUNDLE_NAME/Contents/SharedSupport/" || exit 1
cp "$PGDIR/bin/pg_dump" "$BUILDROOT/$APP_BUNDLE_NAME/Contents/SharedSupport/" || exit 1
cp "$PGDIR/bin/pg_dumpall" "$BUILDROOT/$APP_BUNDLE_NAME/Contents/SharedSupport/" || exit 1
cp "$PGDIR/bin/pg_restore" "$BUILDROOT/$APP_BUNDLE_NAME/Contents/SharedSupport/" || exit 1
cp "$PGDIR/bin/psql" "$BUILDROOT/$APP_BUNDLE_NAME/Contents/SharedSupport/" || exit 1
mkdir -p "${BUILDROOT/${APP_BUNDLE_NAME}/Contents/SharedSupport/" || exit 1
cp "${PGDIR}/bin/pg_dump" "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/SharedSupport/" || exit 1
cp "${PGDIR}/bin/pg_dumpall" "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/SharedSupport/" || exit 1
cp "${PGDIR}/bin/pg_restore" "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/SharedSupport/" || exit 1
cp "${PGDIR}/bin/psql" "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/SharedSupport/" || exit 1
# Replace the place holders with the current version
sed -e "s/PGADMIN_LONG_VERSION/$APP_LONG_VERSION/g" -e "s/PGADMIN_SHORT_VERSION/$APP_SHORT_VERSION/g" pgadmin.Info.plist.in > pgadmin.Info.plist
sed -e "s/PGADMIN_LONG_VERSION/${APP_LONG_VERSION}/g" -e "s/PGADMIN_SHORT_VERSION/${APP_SHORT_VERSION}/g" pgadmin.Info.plist.in > pgadmin.Info.plist
# copy Python private environment to app bundle
cp -PR $BUILDROOT/$VIRTUALENV "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/" || exit 1
cp -PR ${BUILDROOT}/${VIRTUALENV} "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/" || exit 1
if [ $SYSTEM_PYTHON -eq 1 ]; then
if [ ${SYSTEM_PYTHON} -eq 1 ]; then
# remove the python bin and include from app bundle as it is not needed
rm -rf "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/$VIRTUALENV/bin" "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/$VIRTUALENV/include"
rm -rf "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/$VIRTUALENV/.Python"
rm -rf "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/${VIRTUALENV}/bin" "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/${VIRTUALENV}/include"
rm -rf "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/${VIRTUALENV}/.Python"
fi
# Remove any TCL-related files that may cause us problems
find "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/$VIRTUALENV/" -name "_tkinter*" -exec rm -f "{}" \;
find "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/${VIRTUALENV}/" -name "_tkinter*" -exec rm -f "{}" \;
# run complete-bundle to copy the dependent libraries and frameworks and fix the rpaths
./complete-bundle.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo complete-bundle.sh failed; exit 1; }
./complete-bundle.sh "${BUILDROOT}/${APP_BUNDLE_NAME}" || { echo complete-bundle.sh failed; exit 1; }
pushd $SOURCEDIR/web
pushd ${SOURCEDIR}/web
yarn install || exit 1
yarn run bundle || exit 1
@ -198,8 +198,8 @@ _complete_bundle() {
popd
# copy the web directory to the bundle as it is required by runtime
cp -r $SOURCEDIR/web "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/" || exit 1
cd "$BUILDROOT/$APP_BUNDLE_NAME/Contents/Resources/web"
cp -r ${SOURCEDIR}/web "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/" || exit 1
cd "${BUILDROOT}/${APP_BUNDLE_NAME}/Contents/Resources/web"
rm -f pgadmin4.db config_local.*
rm -rf karma.conf.js package.json node_modules/ regression/ tools/ pgadmin/static/js/generated/.cache
find . -name "tests" -type d -exec rm -rf "{}" \;
@ -214,17 +214,17 @@ _complete_bundle() {
echo "}" >> config_distro.py
# Remove the .pyc files if any
cd "$BUILDROOT/$APP_BUNDLE_NAME"
cd "${BUILDROOT}/${APP_BUNDLE_NAME}"
find . -name *.pyc | xargs rm -f
}
_framework_config() {
cd $SOURCEDIR/pkg/mac
./framework-config.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo "framework-config.sh failed"; exit 1; }
cd ${SOURCEDIR}/pkg/mac
./framework-config.sh "${BUILDROOT}/${APP_BUNDLE_NAME}" || { echo "framework-config.sh failed"; exit 1; }
}
_codesign_bundle() {
cd $SOURCEDIR/pkg/mac
cd ${SOURCEDIR}/pkg/mac
if [ ! -f codesign.conf ]; then
echo
@ -236,18 +236,18 @@ _codesign_bundle() {
return
fi
./codesign-bundle.sh "$BUILDROOT/$APP_BUNDLE_NAME" || { echo codesign-bundle.sh failed; exit 1; }
./codesign-bundle.sh "${BUILDROOT}/${APP_BUNDLE_NAME}" || { echo codesign-bundle.sh failed; exit 1; }
}
_create_dmg() {
cd $SOURCEDIR
cd ${SOURCEDIR}
./pkg/mac/create-dmg.sh || { echo create-dmg.sh failed; exit 1; }
# Clean the mac-build/ on successful build
rm -rf $BUILDROOT/*
rm -rf ${BUILDROOT}/*
}
_codesign_dmg() {
cd $SOURCEDIR/pkg/mac
cd ${SOURCEDIR}/pkg/mac
if [ ! -f codesign.conf ]; then
echo

View File

@ -18,7 +18,7 @@ codesign --sign "${DEVELOPER_ID}" --verbose --deep --force "${BUNDLE}"
echo Verifying the signature
codesign --verify --verbose --deep --force "${BUNDLE}"
RETURN_STATUS=$?
if [ $RETURN_STATUS -ne 0 ]; then
if [ ${RETURN_STATUS} -ne 0 ]; then
echo Code signing did not work, check the log
exit 1
else

View File

@ -1,8 +1,8 @@
#!/bin//sh
#!/bin/bash
DMG_VOLUME_NAME=$APP_NAME
DMG_NAME=`echo $DMG_VOLUME_NAME | sed 's/ //g' | awk '{print tolower($0)}'`
DMG_IMAGE=$DISTROOT/$DMG_NAME-$APP_LONG_VERSION.dmg
DMG_VOLUME_NAME=${APP_NAME}
DMG_NAME=`echo ${DMG_VOLUME_NAME} | sed 's/ //g' | awk '{print tolower($0)}'`
DMG_IMAGE=${DISTROOT}/${DMG_NAME}-${APP_LONG_VERSION}.dmg
if ! test -f "${DMG_IMAGE}" ; then
echo "${DMG_IMAGE} is no disk image!" >&2
@ -22,7 +22,7 @@ codesign --sign "${DEVELOPER_ID}" --verbose --force "${DMG_IMAGE}"
echo Verifying the signature
codesign --verify --verbose --force "${DMG_IMAGE}"
RETURN_STATUS=$?
if [ $RETURN_STATUS -ne 0 ]; then
if [ ${RETURN_STATUS} -ne 0 ]; then
echo ERROR: Code signing did not work
exit 1
else

View File

@ -3,140 +3,140 @@
bundle="$1"
if ! test -d "$bundle" ; then
echo "$bundle is no bundle!" >&2
echo "${bundle} is no bundle!" >&2
exit 1
fi
if test -z $QTDIR ; then
if test -z ${QTDIR} ; then
echo "QTDIR environment variable not set"
exit 1
else
echo "QTDIR=$QTDIR"
echo "QTDIR=${QTDIR}"
fi
test -d "$bundle/Contents/Resources" || mkdir -p "$bundle/Contents/Resources" || exit 1
test -d "${bundle}/Contents/Resources" || mkdir -p "${bundle}/Contents/Resources" || exit 1
# Create qt.conf so that app knows where the Plugins are present
cat >> "$bundle/Contents/Resources/qt.conf" << EOF
cat >> "${bundle}/Contents/Resources/qt.conf" << EOF
[Paths]
Plugins = PlugIns
EOF
test -d "$bundle/Contents/Frameworks" || mkdir -p "$bundle/Contents/Frameworks" || exit 1
test -d "$bundle/Contents/PlugIns/platforms" || mkdir -p "$bundle/Contents/PlugIns/platforms" || exit 1
cp -f $QTDIR/plugins/platforms/libqcocoa.dylib "$bundle/Contents/PlugIns/platforms" || { echo libqcocoa.dylib not found in $QTDIR/plugins/platforms; exit 1; }
cp -f $PGDIR/lib/libpq.5.dylib "$bundle/Contents/Frameworks" || { echo libpq.5.dylib not found in $PGDIR; exit 1; }
test -d "${bundle}/Contents/Frameworks" || mkdir -p "${bundle}/Contents/Frameworks" || exit 1
test -d "${bundle}/Contents/PlugIns/platforms" || mkdir -p "${bundle}/Contents/PlugIns/platforms" || exit 1
cp -f ${QTDIR}/plugins/platforms/libqcocoa.dylib "${bundle}/Contents/PlugIns/platforms" || { echo libqcocoa.dylib not found in ${QTDIR}/plugins/platforms; exit 1; }
cp -f ${PGDIR}/lib/libpq.5.dylib "${bundle}/Contents/Frameworks" || { echo libpq.5.dylib not found in ${PGDIR}; exit 1; }
function CompleteSingleApp() {
local bundle=$1 tag=$(basename "$1") todo todo_old fw_relpath lib lib_bn nested_app na_relpath
echo "Completing app: $bundle"
pushd "$bundle" > /dev/null
echo "Completing app: ${bundle}"
pushd "${bundle}" > /dev/null
#We skip nested apps here - those are treated specially
todo=$(file `find ./ -perm +0111 ! -type d ! -path "*.app/*" ! -name "*.app"` | grep -E "Mach-O 64-bit" | awk -F ':| ' '{ORS=" "; print $1}')
echo "App: $tag: Found executables: $todo"
while test "$todo" != ""; do
todo_old=$todo ;
echo "App: ${tag}: Found executables: ${todo}"
while test "${todo}" != ""; do
todo_old=${todo} ;
todo="" ;
for todo_obj in $todo_old; do
echo "App: $tag: Post-processing: $todo_obj"
for todo_obj in ${todo_old}; do
echo "App: ${tag}: Post-processing: ${todo_obj}"
#Figure out the relative path from todo_obj to Contents/Frameworks
fw_relpath=$(echo "$todo_obj" |\
fw_relpath=$(echo "${todo_obj}" |\
sed -n 's|^\(\.//*\)\(\([^/][^/]*/\)*\)[^/][^/]*$|\2|gp' | \
sed -n 's|[^/][^/]*/|../|gp' \
)"Contents/Frameworks"
fw_relpath_old=$fw_relpath
fw_relpath_old=${fw_relpath}
fw_loc="Contents/Frameworks"
#Find all libraries $todo_obj depends on, but skip system libraries
for lib in $(
otool -L $todo_obj | \
otool -L ${todo_obj} | \
grep "Qt\|dylib\|Frameworks\|PlugIns" | grep -v ":" | sed 's/(.*//' | egrep -v '(/usr/lib)|(/System)|@executable_path@' \
) $(otool -L $todo_obj | grep "Python" | grep -v ":" | sed 's/(.*//' \
) $(otool -L ${todo_obj} | grep "Python" | grep -v ":" | sed 's/(.*//' \
); do
if echo $lib | grep "PlugIns\|libqcocoa" > /dev/null; then
if echo ${lib} | grep "PlugIns\|libqcocoa" > /dev/null; then
lib_loc="Contents/PlugIns/platforms"
elif echo $lib | grep "Qt" > /dev/null; then
qtfw_path="$(dirname $lib | sed 's|.*\(Qt.*framework\)|\1|')"
lib_loc="Contents/Frameworks/$qtfw_path"
if [ "$(basename $todo_obj)" = "$lib" ]; then
lib_loc="$(dirname $todo_obj)"
qtfw_path=$(echo $lib_loc | sed 's/Contents\/Frameworks\///')
elif echo ${lib} | grep "Qt" > /dev/null; then
qtfw_path="$(dirname ${lib} | sed 's|.*\(Qt.*framework\)|\1|')"
lib_loc="Contents/Frameworks/${qtfw_path}"
if [ "$(basename ${todo_obj})" = "${lib}" ]; then
lib_loc="$(dirname ${todo_obj})"
qtfw_path=$(echo ${lib_loc} | sed 's/Contents\/Frameworks\///')
fi
elif echo $lib | grep "Python" > /dev/null; then
pyfw_path="$(dirname $lib | sed 's|.*\(Python.*framework\)|\1|')"
lib_loc="Contents/Frameworks/$pyfw_path"
if [ "$(basename $todo_obj)" = "$lib" ]; then
lib_loc="$(dirname $todo_obj)"
pyfw_path=$(echo $lib_loc | sed 's/Contents\/Frameworks\///')
elif echo ${lib} | grep "Python" > /dev/null; then
pyfw_path="$(dirname ${lib} | sed 's|.*\(Python.*framework\)|\1|')"
lib_loc="Contents/Frameworks/${pyfw_path}"
if [ "$(basename ${todo_obj})" = "${lib}" ]; then
lib_loc="$(dirname ${todo_obj})"
pyfw_path=$(echo ${lib_loc} | sed 's/Contents\/Frameworks\///')
fi
else
lib_loc="Contents/Frameworks"
fi
lib_bn="$(basename "$lib")" ;
if ! test -f "$lib_loc/$lib_bn"; then
lib_bn="$(basename "${lib}")" ;
if ! test -f "${lib_loc}/${lib_bn}"; then
target_file=""
target_path=""
echo "App: $tag: Adding symlink: $lib_bn (because of: $todo_obj)"
echo "App: ${tag}: Adding symlink: ${lib_bn} (because of: ${todo_obj})"
# Copy the QT and Python framework
if echo $lib | grep Qt > /dev/null ; then
test -d $lib_loc || mkdir -p $lib_loc
echo Copying -R $QTDIR/lib/$qtfw_path/$lib_bn to $lib_loc/
cp $QTDIR/lib/$qtfw_path/$lib_bn $lib_loc/
elif echo $lib | grep Python > /dev/null ; then
test -d $lib_loc || mkdir -p $lib_loc
cp -R "$lib" "$lib_loc/$lib_bn"
if echo ${lib} | grep Qt > /dev/null ; then
test -d ${lib_loc} || mkdir -p ${lib_loc}
echo Copying -R ${QTDIR}/lib/${qtfw_path}/${lib_bn} to ${lib_loc}/
cp ${QTDIR}/lib/${qtfw_path}/${lib_bn} ${lib_loc}/
elif echo ${lib} | grep Python > /dev/null ; then
test -d ${lib_loc} || mkdir -p ${lib_loc}
cp -R "${lib}" "${lib_loc}/${lib_bn}"
else
cp -R "$lib" "$lib_loc/$lib_bn"
cp -R "${lib}" "${lib_loc}/${lib_bn}"
fi
if ! test -L "$lib_loc/$lib_bn"; then
chmod 755 "$lib_loc/$lib_bn"
if ! test -L "${lib_loc}/${lib_bn}"; then
chmod 755 "${lib_loc}/${lib_bn}"
else
target_file=$(readlink "$lib")
target_path=$(dirname "$lib")/$target_file
echo "App: $tag: Adding symlink target: $target_path"
cp "$target_path" "$lib_loc/$target_file"
chmod 755 "$lib_loc/$target_file"
target_file=$(readlink "${lib}")
target_path=$(dirname "${lib}")/${target_file}
echo "App: ${tag}: Adding symlink target: ${target_path}"
cp "${target_path}" "${lib_loc}/${target_file}"
chmod 755 "${lib_loc}/${target_file}"
fi
echo "Rewriting ID in $lib_loc/$lib_bn to $lib_bn"
echo install_name_tool -id "$lib_bn" "$lib_loc/$lib_bn"
echo "Rewriting ID in ${lib_loc}/${lib_bn} to ${lib_bn}"
echo install_name_tool -id "${lib_bn}" "${lib_loc}/${lib_bn}"
install_name_tool \
-id "$lib_bn" \
"$lib_loc/$lib_bn" || exit 1
todo="$todo ./$lib_loc/$lib_bn"
-id "${lib_bn}" \
"${lib_loc}/${lib_bn}" || exit 1
todo="${todo} ./${lib_loc}/${lib_bn}"
fi
if echo $lib | grep Qt > /dev/null ; then
fw_relpath="$fw_relpath/$qtfw_path"
if echo ${lib} | grep Qt > /dev/null ; then
fw_relpath="${fw_relpath}/${qtfw_path}"
fi
if echo $lib | grep Python > /dev/null ; then
fw_relpath="$fw_relpath/$pyfw_path"
if echo ${lib} | grep Python > /dev/null ; then
fw_relpath="${fw_relpath}/${pyfw_path}"
fi
chmod +w $todo_obj
echo "Rewriting library $lib to @loader_path/$fw_relpath/$lib_bn in $todo_obj"
echo install_name_tool -change "$lib" "@loader_path/$fw_relpath/$lib_bn" "$todo_obj"
chmod +w ${todo_obj}
echo "Rewriting library ${lib} to @loader_path/${fw_relpath}/${lib_bn} in ${todo_obj}"
echo install_name_tool -change "${lib}" "@loader_path/${fw_relpath}/${lib_bn}" "${todo_obj}"
install_name_tool -change \
"$lib" \
"@loader_path/$fw_relpath/$lib_bn" \
"$todo_obj" || exit 1
"${lib}" \
"@loader_path/${fw_relpath}/${lib_bn}" \
"${todo_obj}" || exit 1
install_name_tool -change \
"$target_path" \
"@loader_path/$fw_relpath/$target_file" \
"$todo_obj" || exit 1
fw_relpath="$fw_relpath_old"
"${target_path}" \
"@loader_path/${fw_relpath}/${target_file}" \
"${todo_obj}" || exit 1
fw_relpath="${fw_relpath_old}"
done
done
done
# Fix the rpaths for psycopg module
find "$bundle/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libpq.5.dylib @loader_path/../../../../../../Frameworks/libpq.5.dylib
find "$bundle/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libssl.1.0.0.dylib @loader_path/../../../../../../Frameworks/libssl.1.0.0.dylib
find "$bundle/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libcrypto.1.0.0.dylib @loader_path/../../../../../../Frameworks/libcrypto.1.0.0.dylib
find "${bundle}/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libpq.5.dylib @loader_path/../../../../../../Frameworks/libpq.5.dylib
find "${bundle}/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libssl.1.0.0.dylib @loader_path/../../../../../../Frameworks/libssl.1.0.0.dylib
find "${bundle}/Contents/Resources/venv/" -name _psycopg.so -print0 | xargs -0 install_name_tool -change libcrypto.1.0.0.dylib @loader_path/../../../../../../Frameworks/libcrypto.1.0.0.dylib
echo "App completed: $bundle"
echo "App completed: ${bundle}"
popd > /dev/null
}
CompleteSingleApp "$bundle"
CompleteSingleApp "${bundle}"

View File

@ -1,36 +1,36 @@
#!/bin/sh
# move to the directory where we want to create the DMG
test -d $DISTROOT || mkdir $DISTROOT
cd $DISTROOT
test -d ${DISTROOT} || mkdir ${DISTROOT}
cd ${DISTROOT}
DMG_SOURCES="./../mac-build/$APP_BUNDLE_NAME"
DMG_SOURCES="./../mac-build/${APP_BUNDLE_NAME}"
DMG_LICENCE=./../pkg/mac/licence.rtf
DMG_VOLUME_NAME=$APP_NAME
DMG_NAME=`echo $DMG_VOLUME_NAME | sed 's/ //g' | awk '{print tolower($0)}'`
DMG_IMAGE=$DMG_NAME-$APP_LONG_VERSION.dmg
DMG_VOLUME_NAME=${APP_NAME}
DMG_NAME=`echo ${DMG_VOLUME_NAME} | sed 's/ //g' | awk '{print tolower($0)}'`
DMG_IMAGE=${DMG_NAME}-${APP_LONG_VERSION}.dmg
HDIUTIL=/usr/bin/hdiutil
REZ="/usr/bin/Rez"
DMG_DIR=./$DMG_IMAGE.src
DMG_DIR=./${DMG_IMAGE}.src
if test -e "$DMG_DIR"; then
echo "Directory $DMG_DIR already exists. Please delete it manually." >&2
if test -e "${DMG_DIR}"; then
echo "Directory ${DMG_DIR} already exists. Please delete it manually." >&2
exit 1
fi
echo "Cleaning up"
rm -f "$DMG_IMAGE" || exit 1
mkdir "$DMG_DIR" || exit 1
rm -f "${DMG_IMAGE}" || exit 1
mkdir "${DMG_DIR}" || exit 1
echo "Copying data into temporary directory"
for src in "$DMG_SOURCES"; do
cp -R "$src" "$DMG_DIR" || exit 1
for src in "${DMG_SOURCES}"; do
cp -R "${src}" "${DMG_DIR}" || exit 1
done
echo "Creating image"
$HDIUTIL create -quiet -srcfolder "$DMG_DIR" -format UDZO -volname "$DMG_VOLUME_NAME" -ov "$DMG_IMAGE" || exit 1
rm -rf "$DMG_DIR" || exit 1
${HDIUTIL} create -quiet -srcfolder "$DMG_DIR" -format UDZO -volname "${DMG_VOLUME_NAME}" -ov "${DMG_IMAGE}" || exit 1
rm -rf "${DMG_DIR}" || exit 1
echo "Attaching License to image"
python ./../pkg/mac/dmg-license.py "$DMG_IMAGE" "$DMG_LICENCE" -c bz2
python ./../pkg/mac/dmg-license.py "${DMG_IMAGE}" "${DMG_LICENCE}" -c bz2

View File

@ -21,7 +21,7 @@ find "${BUNDLE}/Contents/Frameworks"/*framework -type d -name "Versions" | while
# Create framework 'Current' soft link
VERSION_NUMBER=`ls -1`
ln -s $VERSION_NUMBER Current || { echo "link creation in framework-config.sh failed"; exit 1; }
ln -s ${VERSION_NUMBER} Current || { echo "link creation in framework-config.sh failed"; exit 1; }
# Create "Resources" subdirectory
if [ ! -d Current/Resources ]; then

View File

@ -24,16 +24,16 @@ fi
APP_RELEASE=`grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //'`
APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
APP_SHORT_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
APP_SHORT_VERSION=`echo ${APP_LONG_VERSION} | cut -d . -f1,2`
APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
if [ ! -z $APP_SUFFIX ]; then
export APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
if [ ! -z ${APP_SUFFIX} ]; then
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
fi
TARBALL_NAME=`echo $APP_NAME-$APP_LONG_VERSION | sed 's/ //g' | awk '{print tolower($0)}'`
TARBALL_NAME=`echo ${APP_NAME}-${APP_LONG_VERSION} | sed 's/ //g' | awk '{print tolower($0)}'`
# Output basic details to show we're working
echo Building tarballs for $APP_NAME version $APP_LONG_VERSION...
echo Building tarballs for ${APP_NAME} version ${APP_LONG_VERSION}...
# Create/clearout the build directory
echo Creating/cleaning required directories...
@ -52,9 +52,9 @@ mkdir pip-build/pgadmin4/docs
cd web
for FILE in `git ls-files`
do
echo Adding $FILE
echo Adding ${FILE}
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
tar cf - $FILE | (cd ../pip-build/pgadmin4; tar xf -)
tar cf - ${FILE} | (cd ../pip-build/pgadmin4; tar xf -)
done
yarn install
@ -62,32 +62,32 @@ yarn run bundle
for FILE in `ls -d pgadmin/static/js/generated/*`
do
echo Adding $FILE
tar cf - $FILE | (cd ../pip-build/pgadmin4; tar xf -)
echo Adding ${FILE}
tar cf - ${FILE} | (cd ../pip-build/pgadmin4; tar xf -)
done
cd ../docs
for FILE in `git ls-files`
do
echo Adding $FILE
echo Adding ${FILE}
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
tar cf - $FILE | (cd ../pip-build/pgadmin4/docs; tar xf -)
tar cf - ${FILE} | (cd ../pip-build/pgadmin4/docs; tar xf -)
done
for DIR in `ls -d ??_??/`
do
if [ -d $DIR/_build/html ]; then
mkdir -p ../pip-build/pgadmin4/docs/$DIR/_build
cp -R $DIR/_build/html ../pip-build/pgadmin4/docs/$DIR/_build
if [ -d ${DIR}/_build/html ]; then
mkdir -p ../pip-build/pgadmin4/docs/${DIR}/_build
cp -R ${DIR}/_build/html ../pip-build/pgadmin4/docs/${DIR}/_build
fi
done
cd ../
for FILE in LICENSE README libraries.txt
do
echo Adding $FILE
echo Adding ${FILE}
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
tar cf - $FILE | (cd pip-build/pgadmin4; tar xf -)
tar cf - ${FILE} | (cd pip-build/pgadmin4; tar xf -)
done
# Create the distro config

View File

@ -24,17 +24,17 @@ fi
APP_RELEASE=`grep "^APP_RELEASE" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_REVISION=`grep "^APP_REVISION" web/config.py | cut -d"=" -f2 | sed 's/ //g'`
APP_NAME=`grep "^APP_NAME" web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //'`
APP_LONG_VERSION=$APP_RELEASE.$APP_REVISION
APP_SHORT_VERSION=`echo $APP_LONG_VERSION | cut -d . -f1,2`
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
APP_SHORT_VERSION=`echo ${APP_LONG_VERSION} | cut -d . -f1,2`
APP_SUFFIX=`grep "^APP_SUFFIX" web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
if [ ! -z $APP_SUFFIX ]; then
export APP_LONG_VERSION=$APP_LONG_VERSION-$APP_SUFFIX
if [ ! -z ${APP_SUFFIX} ]; then
export APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
fi
TARBALL_NAME=`echo $APP_NAME-$APP_LONG_VERSION | sed 's/ //g' | awk '{print tolower($0)}'`
DOC_TARBALL_NAME=`echo $APP_NAME-$APP_LONG_VERSION-docs | sed 's/ //g' | awk '{print tolower($0)}'`
TARBALL_NAME=`echo ${APP_NAME}-${APP_LONG_VERSION} | sed 's/ //g' | awk '{print tolower($0)}'`
DOC_TARBALL_NAME=`echo ${APP_NAME}-${APP_LONG_VERSION}-docs | sed 's/ //g' | awk '{print tolower($0)}'`
# Output basic details to show we're working
echo Building tarballs for $APP_NAME version $APP_LONG_VERSION...
echo Building tarballs for ${APP_NAME} version ${APP_LONG_VERSION}...
# Create/clearout the build directory
echo Creating/cleaning required directories...
@ -42,31 +42,31 @@ if [ ! -d src-build ]; then
mkdir src-build
fi
if [ -d src-build/$TARBALL_NAME ]; then
rm -rf src-build/$TARBALL_NAME
if [ -d src-build/${TARBALL_NAME} ]; then
rm -rf src-build/${TARBALL_NAME}
fi
mkdir src-build/$TARBALL_NAME
mkdir src-build/${TARBALL_NAME}
# Create the output directory if not present
if [ ! -d dist ]; then
mkdir dist
fi
if [ -f dist/$TARBALL_NAME.tar.gz ]; then
rm -f dist/$TARBALL_NAME.tar.gz
if [ -f dist/${TARBALL_NAME}.tar.gz ]; then
rm -f dist/${TARBALL_NAME}.tar.gz
fi
if [ -f dist/$DOC_TARBALL_NAME.tar.gz ]; then
rm -f dist/$DOC_TARBALL_NAME.tar.gz
if [ -f dist/${DOC_TARBALL_NAME}.tar.gz ]; then
rm -f dist/${DOC_TARBALL_NAME}.tar.gz
fi
# Build the clean tree
for FILE in `git ls-files`
do
echo Adding $FILE
echo Adding ${FILE}
# We use tar here to preserve the path, as Mac (for example) doesn't support cp --parents
tar cf - $FILE | (cd src-build/$TARBALL_NAME; tar xf -)
tar cf - ${FILE} | (cd src-build/${TARBALL_NAME}; tar xf -)
done
pushd web
@ -75,25 +75,25 @@ pushd web
for FILE in `ls -d pgadmin/static/js/generated/*`
do
echo Adding $FILE
tar cf - $FILE | (cd ../src-build/$TARBALL_NAME/web; tar xf -)
echo Adding ${FILE}
tar cf - ${FILE} | (cd ../src-build/${TARBALL_NAME}/web; tar xf -)
done
popd
# Create the tarball
echo Creating tarball...
cd src-build
tar zcvf ../dist/$TARBALL_NAME.tar.gz $TARBALL_NAME
tar zcvf ../dist/${TARBALL_NAME}.tar.gz ${TARBALL_NAME}
cd ..
# Create the docs
echo Creating docs...
cd src-build/$TARBALL_NAME/docs/en_US
cd src-build/${TARBALL_NAME}/docs/en_US
make -f Makefile.sphinx html
cd _build
mv html $DOC_TARBALL_NAME
tar zcvf ../../../../../dist/$DOC_TARBALL_NAME.tar.gz $DOC_TARBALL_NAME
mv html ${DOC_TARBALL_NAME}
tar zcvf ../../../../../dist/${DOC_TARBALL_NAME}.tar.gz ${DOC_TARBALL_NAME}
cd ../../../../../
# Fin!
echo Created tarball dist/$TARBALL_NAME.tar.gz and dist/$DOC_TARBALL_NAME.tar.gz
echo Created tarball dist/${TARBALL_NAME}.tar.gz and dist/${DOC_TARBALL_NAME}.tar.gz