mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Sonarqube fixes for macOS
This commit is contained in:
parent
8b7ce2c276
commit
c0c4524ec3
@ -1,22 +1,24 @@
|
|||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
_setup_env() {
|
_setup_env() {
|
||||||
FUNCS_DIR=$(cd `dirname $0` && pwd)/../..
|
FUNCS_DIR=$(cd $(dirname "$0") && pwd)/../..
|
||||||
APP_RELEASE=`grep "^APP_RELEASE" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g'`
|
APP_RELEASE=$(grep "^APP_RELEASE" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_REVISION=`grep "^APP_REVISION" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g'`
|
APP_REVISION=$(grep "^APP_REVISION" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g')
|
||||||
APP_NAME=`grep "^APP_NAME" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //'`
|
APP_NAME=$(grep "^APP_NAME" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed "s/'//g" | sed 's/^ //')
|
||||||
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
APP_LONG_VERSION=${APP_RELEASE}.${APP_REVISION}
|
||||||
APP_SUFFIX=`grep "^APP_SUFFIX" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g"`
|
APP_SUFFIX=$(grep "^APP_SUFFIX" ${FUNCS_DIR}/web/config.py | cut -d"=" -f2 | sed 's/ //g' | sed "s/'//g")
|
||||||
if [ ! -z ${APP_SUFFIX} ]; then
|
if [ -n "${APP_SUFFIX}" ]; then
|
||||||
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
APP_LONG_VERSION=${APP_LONG_VERSION}-${APP_SUFFIX}
|
||||||
fi
|
fi
|
||||||
BUNDLE_DIR="${BUILD_ROOT}/${APP_NAME}.app"
|
BUNDLE_DIR="${BUILD_ROOT}/${APP_NAME}.app"
|
||||||
DMG_NAME="${DIST_ROOT}/$(echo ${APP_NAME} | sed 's/ //g' | awk '{print tolower($0)}')-${APP_LONG_VERSION}.dmg"
|
DMG_NAME="${DIST_ROOT}"/$(echo "${APP_NAME}" | sed 's/ //g' | awk '{print tolower($0)}')-"${APP_LONG_VERSION}.dmg"
|
||||||
}
|
}
|
||||||
|
|
||||||
_cleanup() {
|
_cleanup() {
|
||||||
echo Cleaning up the old environment and app bundle...
|
echo Cleaning up the old environment and app bundle...
|
||||||
rm -rf "${BUILD_ROOT}"
|
rm -rf "${BUILD_ROOT}"
|
||||||
rm -rf "${TEMP_DIR}"
|
rm -rf "${TEMP_DIR}"
|
||||||
rm -f ${DIST_ROOT}/*.dmg
|
rm -f "${DIST_ROOT}"/*.dmg
|
||||||
}
|
}
|
||||||
|
|
||||||
_build_runtime() {
|
_build_runtime() {
|
||||||
@ -38,13 +40,13 @@ _build_runtime() {
|
|||||||
# NW_VERSION=$(yarn info nw | grep latest | awk -F "'" '{ print $2}')
|
# NW_VERSION=$(yarn info nw | grep latest | awk -F "'" '{ print $2}')
|
||||||
NW_VERSION="0.62.2"
|
NW_VERSION="0.62.2"
|
||||||
|
|
||||||
pushd "${BUILD_ROOT}" > /dev/null
|
pushd "${BUILD_ROOT}" > /dev/null || exit
|
||||||
while true;do
|
while true;do
|
||||||
wget https://dl.nwjs.io/v${NW_VERSION}/nwjs-v${NW_VERSION}-osx-x64.zip && break
|
wget "https://dl.nwjs.io/v${NW_VERSION}/nwjs-v${NW_VERSION}-osx-x64.zip" && break
|
||||||
rm nwjs-v${NW_VERSION}-osx-x64.zip
|
rm "nwjs-v${NW_VERSION}-osx-x64.zip"
|
||||||
done
|
done
|
||||||
unzip nwjs-v${NW_VERSION}-osx-x64.zip
|
unzip "nwjs-v${NW_VERSION}-osx-x64.zip"
|
||||||
popd > /dev/null
|
popd > /dev/null || exit
|
||||||
# WGET END
|
# WGET END
|
||||||
|
|
||||||
# YARN:
|
# YARN:
|
||||||
@ -76,7 +78,7 @@ _create_python_env() {
|
|||||||
PATH=$PATH:/usr/local/pgsql/bin python \
|
PATH=$PATH:/usr/local/pgsql/bin python \
|
||||||
"${BUILD_ROOT}/relocatable_python/make_relocatable_python_framework.py" \
|
"${BUILD_ROOT}/relocatable_python/make_relocatable_python_framework.py" \
|
||||||
--upgrade-pip \
|
--upgrade-pip \
|
||||||
--python-version ${PGADMIN_PYTHON_VERSION} \
|
--python-version "${PGADMIN_PYTHON_VERSION}" \
|
||||||
--pip-requirements "${SOURCE_DIR}/requirements.txt" \
|
--pip-requirements "${SOURCE_DIR}/requirements.txt" \
|
||||||
--destination "${BUNDLE_DIR}/Contents/Frameworks/"
|
--destination "${BUNDLE_DIR}/Contents/Frameworks/"
|
||||||
|
|
||||||
@ -84,26 +86,26 @@ _create_python_env() {
|
|||||||
# so they get properly signed later
|
# so they get properly signed later
|
||||||
OLD_IFS=${IFS}
|
OLD_IFS=${IFS}
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for i in $(find . -type f -name *.so -exec file "{}" \; | grep -v "(for architecture" | grep -E "Mach-O executable|Mach-O 64-bit executable|Mach-O 64-bit bundle|Mach-O 64-bit dynamically linked shared library" | awk -F":" '{print $1}' | uniq)
|
for i in $(find . -type f -name '*.so' -exec file "{}" \; | grep -v "(for architecture" | grep -E "Mach-O executable|Mach-O 64-bit executable|Mach-O 64-bit bundle|Mach-O 64-bit dynamically linked shared library" | awk -F":" '{print $1}' | uniq)
|
||||||
do
|
do
|
||||||
chmod +x "${i}"
|
chmod +x "${i}"
|
||||||
done
|
done
|
||||||
IFS=${OLD_IFS}
|
IFS=${OLD_IFS}
|
||||||
|
|
||||||
# Fixup shebangs
|
# Fixup shebangs
|
||||||
cd "${BUNDLE_DIR}/Contents/Frameworks/Python.framework/Versions/Current/bin"
|
cd "${BUNDLE_DIR}/Contents/Frameworks/Python.framework/Versions/Current/bin" || exit
|
||||||
grep -RiIl 'mac-build' * | xargs sed -i '' 's/\/.*\/python3\./\$(dirname \"$0\")\/python3./g'
|
grep -RiIl 'mac-build' ./* | xargs sed -i '' 's/\/.*\/python3\./\$(dirname \"$0\")\/python3./g'
|
||||||
|
|
||||||
# Remove some things we don't need
|
# Remove some things we don't need
|
||||||
cd "${BUNDLE_DIR}/Contents/Frameworks/Python.framework"
|
cd "${BUNDLE_DIR}/Contents/Frameworks/Python.framework" || exit
|
||||||
find . -name test -type d -print0 | xargs -0 rm -rf
|
find . -name test -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name tkinter -type d -print0 | xargs -0 rm -rf
|
find . -name tkinter -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name turtle.py -type f -print0 | xargs -0 rm -rf
|
find . -name turtle.py -type f -print0 | xargs -0 rm -rf
|
||||||
find . -name turtledemo -type d -print0 | xargs -0 rm -rf
|
find . -name turtledemo -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name tcl* -type d -print0 | xargs -0 rm -rf
|
find . -name "tcl*" -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name tk* -type d -print0 | xargs -0 rm -rf
|
find . -name "tk*" -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name tdbc* -type d -print0 | xargs -0 rm -rf
|
find . -name "tdbc*" -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name itcl* -type d -print0 | xargs -0 rm -rf
|
find . -name "itcl*" -type d -print0 | xargs -0 rm -rf
|
||||||
rm -f Versions/Current/lib/Tk.*
|
rm -f Versions/Current/lib/Tk.*
|
||||||
rm -f Versions/Current/lib/libtcl*.dylib
|
rm -f Versions/Current/lib/libtcl*.dylib
|
||||||
rm -f Versions/Current/lib/libtk*.dylib
|
rm -f Versions/Current/lib/libtk*.dylib
|
||||||
@ -122,15 +124,16 @@ _build_docs() {
|
|||||||
# Create a temporary venv for the doc build, so we don't contaminate the one
|
# Create a temporary venv for the doc build, so we don't contaminate the one
|
||||||
# that we're going to ship.
|
# that we're going to ship.
|
||||||
"${BUNDLE_DIR}/Contents/Frameworks/Python.framework/Versions/Current/bin/python3" -m venv "${BUILD_ROOT}/venv"
|
"${BUNDLE_DIR}/Contents/Frameworks/Python.framework/Versions/Current/bin/python3" -m venv "${BUILD_ROOT}/venv"
|
||||||
|
# shellcheck disable=SC1091
|
||||||
source "${BUILD_ROOT}/venv/bin/activate"
|
source "${BUILD_ROOT}/venv/bin/activate"
|
||||||
pip3 install --upgrade pip
|
pip3 install --upgrade pip
|
||||||
pip3 install -r "${SOURCE_DIR}/requirements.txt"
|
pip3 install -r "${SOURCE_DIR}/requirements.txt"
|
||||||
pip3 install sphinx
|
pip3 install sphinx
|
||||||
|
|
||||||
cd "${SOURCE_DIR}"
|
cd "${SOURCE_DIR}" || exit
|
||||||
make docs
|
make docs
|
||||||
|
|
||||||
cd "${SOURCE_DIR}/docs/en_US"
|
cd "${SOURCE_DIR}/docs/en_US" || exit
|
||||||
test -d "${BUNDLE_DIR}/Contents/Resources/docs/en_US" || mkdir -p "${BUNDLE_DIR}/Contents/Resources/docs/en_US"
|
test -d "${BUNDLE_DIR}/Contents/Resources/docs/en_US" || mkdir -p "${BUNDLE_DIR}/Contents/Resources/docs/en_US"
|
||||||
cp -r _build/html "${BUNDLE_DIR}/Contents/Resources/docs/en_US/"
|
cp -r _build/html "${BUNDLE_DIR}/Contents/Resources/docs/en_US/"
|
||||||
|
|
||||||
@ -146,7 +149,7 @@ _fixup_imports() {
|
|||||||
pushd "$1" > /dev/null
|
pushd "$1" > /dev/null
|
||||||
|
|
||||||
# Find all the files that may need tweaks
|
# Find all the files that may need tweaks
|
||||||
TODO=$(file `find . -perm +0111 -type f` | \
|
TODO=$(file $(find . -perm +0111 -type f) | \
|
||||||
grep -v "Frameworks/Python.framework" | \
|
grep -v "Frameworks/Python.framework" | \
|
||||||
grep -v "Frameworks/nwjs" | \
|
grep -v "Frameworks/nwjs" | \
|
||||||
grep -E "Mach-O 64-bit" | \
|
grep -E "Mach-O 64-bit" | \
|
||||||
@ -154,7 +157,7 @@ _fixup_imports() {
|
|||||||
uniq)
|
uniq)
|
||||||
|
|
||||||
# Add anything in the site-packages Python directory
|
# Add anything in the site-packages Python directory
|
||||||
TODO+=$(file `find ./Contents/Frameworks/Python.framework/Versions/Current/lib/python*/site-packages -perm +0111 -type f` | \
|
TODO+=$(file $(find ./Contents/Frameworks/Python.framework/Versions/Current/lib/python*/site-packages -perm +0111 -type f) | \
|
||||||
grep -E "Mach-O 64-bit" | \
|
grep -E "Mach-O 64-bit" | \
|
||||||
awk -F ':| ' '{ORS=" "; print $1}' | \
|
awk -F ':| ' '{ORS=" "; print $1}' | \
|
||||||
uniq)
|
uniq)
|
||||||
@ -182,9 +185,9 @@ _fixup_imports() {
|
|||||||
|
|
||||||
# Find all libraries ${TODO_OBJ} depends on, but skip system libraries
|
# Find all libraries ${TODO_OBJ} depends on, but skip system libraries
|
||||||
for LIB in $(
|
for LIB in $(
|
||||||
otool -L ${TODO_OBJ} | \
|
otool -L "${TODO_OBJ}" | \
|
||||||
sed -n 's|^.*[[:space:]]\([^[:space:]]*\.dylib\).*$|\1|p' | \
|
sed -n 's|^.*[[:space:]]\([^[:space:]]*\.dylib\).*$|\1|p' | \
|
||||||
egrep -v '^(/usr/lib)|(/System)|@executable_path|@loader_path|/DLC/PIL/' \
|
grep -E -v '^(/usr/lib)|(/System)|@executable_path|@loader_path|/DLC/PIL/' \
|
||||||
); do
|
); do
|
||||||
# Copy in any required dependencies
|
# Copy in any required dependencies
|
||||||
LIB_BN="$(basename "${LIB}")" ;
|
LIB_BN="$(basename "${LIB}")" ;
|
||||||
@ -224,12 +227,12 @@ _fixup_imports() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
echo "Imports updated on the core appbundle."
|
echo "Imports updated on the core appbundle."
|
||||||
popd > /dev/null
|
popd > /dev/null || exit
|
||||||
}
|
}
|
||||||
|
|
||||||
_complete_bundle() {
|
_complete_bundle() {
|
||||||
echo "Completing the appbundle..."
|
echo "Completing the appbundle..."
|
||||||
cd ${SCRIPT_DIR}
|
cd "${SCRIPT_DIR}" || exit
|
||||||
|
|
||||||
# Copy the binary utilities into place
|
# Copy the binary utilities into place
|
||||||
mkdir -p "${BUNDLE_DIR}/Contents/SharedSupport/"
|
mkdir -p "${BUNDLE_DIR}/Contents/SharedSupport/"
|
||||||
@ -265,39 +268,41 @@ _complete_bundle() {
|
|||||||
_fixup_imports "${BUNDLE_DIR}"
|
_fixup_imports "${BUNDLE_DIR}"
|
||||||
|
|
||||||
# Build node modules
|
# Build node modules
|
||||||
pushd "${SOURCE_DIR}/web" > /dev/null
|
pushd "${SOURCE_DIR}/web" > /dev/null || exit
|
||||||
yarn install
|
yarn install
|
||||||
yarn run bundle
|
yarn run bundle
|
||||||
|
|
||||||
curl https://curl.se/ca/cacert.pem -o cacert.pem -s
|
curl https://curl.se/ca/cacert.pem -o cacert.pem -s
|
||||||
popd > /dev/null
|
popd > /dev/null || exit
|
||||||
|
|
||||||
# copy the web directory to the bundle as it is required by runtime
|
# copy the web directory to the bundle as it is required by runtime
|
||||||
cp -r "${SOURCE_DIR}/web" "${BUNDLE_DIR}/Contents/Resources/"
|
cp -r "${SOURCE_DIR}/web" "${BUNDLE_DIR}/Contents/Resources/"
|
||||||
cd "${BUNDLE_DIR}/Contents/Resources/web"
|
cd "${BUNDLE_DIR}/Contents/Resources/web" || exit
|
||||||
rm -f pgadmin4.db config_local.*
|
rm -f pgadmin4.db config_local.*
|
||||||
rm -rf karma.conf.js package.json node_modules/ regression/ tools/ pgadmin/static/js/generated/.cache
|
rm -rf karma.conf.js package.json node_modules/ regression/ tools/ pgadmin/static/js/generated/.cache
|
||||||
find . -name "tests" -type d -print0 | xargs -0 rm -rf
|
find . -name "tests" -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name "feature_tests" -type d -print0 | xargs -0 rm -rf
|
find . -name "feature_tests" -type d -print0 | xargs -0 rm -rf
|
||||||
find . -name ".DS_Store" -print0 | xargs -0 rm -f
|
find . -name ".DS_Store" -print0 | xargs -0 rm -f
|
||||||
|
|
||||||
echo "SERVER_MODE = False" > config_distro.py
|
{
|
||||||
echo "HELP_PATH = '../../../docs/en_US/html/'" >> config_distro.py
|
echo "SERVER_MODE = False"
|
||||||
echo "DEFAULT_BINARY_PATHS = {" >> config_distro.py
|
echo "HELP_PATH = '../../../docs/en_US/html/'"
|
||||||
echo " 'pg': '\$DIR/../../SharedSupport'," >> config_distro.py
|
echo "DEFAULT_BINARY_PATHS = {"
|
||||||
echo " 'ppas': ''" >> config_distro.py
|
echo " 'pg': '\$DIR/../../SharedSupport',"
|
||||||
echo "}" >> config_distro.py
|
echo " 'ppas': ''"
|
||||||
|
echo "}"
|
||||||
|
} > config_distro.py
|
||||||
|
|
||||||
# License files
|
# License files
|
||||||
cp -r ${SOURCE_DIR}/LICENSE "${BUNDLE_DIR}/Contents/"
|
cp -r "${SOURCE_DIR}/LICENSE" "${BUNDLE_DIR}/Contents/"
|
||||||
cp -r ${SOURCE_DIR}/DEPENDENCIES "${BUNDLE_DIR}/Contents/"
|
cp -r "${SOURCE_DIR}/DEPENDENCIES" "${BUNDLE_DIR}/Contents/"
|
||||||
|
|
||||||
# Remove the .pyc files if any
|
# Remove the .pyc files if any
|
||||||
find "${BUNDLE_DIR}" -name "*.pyc" -print0 | xargs -0 rm -f
|
find "${BUNDLE_DIR}" -name "*.pyc" -print0 | xargs -0 rm -f
|
||||||
}
|
}
|
||||||
|
|
||||||
_codesign_binaries() {
|
_codesign_binaries() {
|
||||||
if [ ${CODESIGN} -eq 0 ]; then
|
if [ "${CODESIGN}" -eq 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -308,10 +313,10 @@ _codesign_binaries() {
|
|||||||
|
|
||||||
# Create the entitlements file
|
# Create the entitlements file
|
||||||
cp "${SCRIPT_DIR}/entitlements.plist.in" "${BUILD_ROOT}/entitlements.plist"
|
cp "${SCRIPT_DIR}/entitlements.plist.in" "${BUILD_ROOT}/entitlements.plist"
|
||||||
TEAM_ID=$(echo ${DEVELOPER_ID} | awk -F"[()]" '{print $2}')
|
TEAM_ID=$(echo "${DEVELOPER_ID}" | awk -F"[()]" '{print $2}')
|
||||||
sed -i '' "s/%TEAMID%/${TEAM_ID}/g" "${BUILD_ROOT}/entitlements.plist"
|
sed -i '' "s/%TEAMID%/${TEAM_ID}/g" "${BUILD_ROOT}/entitlements.plist"
|
||||||
|
|
||||||
echo Signing ${BUNDLE_DIR} binaries...
|
echo Signing "${BUNDLE_DIR}" binaries...
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for i in $(find "${BUNDLE_DIR}" -type f -perm +111 -exec file "{}" \; | \
|
for i in $(find "${BUNDLE_DIR}" -type f -perm +111 -exec file "{}" \; | \
|
||||||
grep -v "(for architecture" | \
|
grep -v "(for architecture" | \
|
||||||
@ -328,7 +333,7 @@ _codesign_binaries() {
|
|||||||
"$i"
|
"$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
echo Signing ${BUNDLE_DIR} libraries...
|
echo Signing "${BUNDLE_DIR}" libraries...
|
||||||
for i in $(find "${BUNDLE_DIR}" -type f -name "*.dylib*")
|
for i in $(find "${BUNDLE_DIR}" -type f -name "*.dylib*")
|
||||||
do
|
do
|
||||||
codesign --deep --force --verify --verbose --timestamp \
|
codesign --deep --force --verify --verbose --timestamp \
|
||||||
@ -341,12 +346,12 @@ _codesign_binaries() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_codesign_bundle() {
|
_codesign_bundle() {
|
||||||
if [ ${CODESIGN} -eq 0 ]; then
|
if [ "${CODESIGN}" -eq 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Sign the .app
|
# Sign the .app
|
||||||
echo Signing ${BUNDLE_DIR}...
|
echo Signing "${BUNDLE_DIR}"...
|
||||||
codesign --deep --force --verify --verbose --timestamp \
|
codesign --deep --force --verify --verbose --timestamp \
|
||||||
--options runtime \
|
--options runtime \
|
||||||
--entitlements "${BUILD_ROOT}/entitlements.plist" \
|
--entitlements "${BUILD_ROOT}/entitlements.plist" \
|
||||||
@ -357,7 +362,7 @@ _codesign_bundle() {
|
|||||||
|
|
||||||
_create_dmg() {
|
_create_dmg() {
|
||||||
# move to the directory where we want to create the DMG
|
# move to the directory where we want to create the DMG
|
||||||
test -d ${DIST_ROOT} || mkdir ${DIST_ROOT}
|
test -d "${DIST_ROOT}" || mkdir "${DIST_ROOT}"
|
||||||
|
|
||||||
echo "Checking out create-dmg..."
|
echo "Checking out create-dmg..."
|
||||||
git clone https://github.com/create-dmg/create-dmg.git "${BUILD_ROOT}/create-dmg"
|
git clone https://github.com/create-dmg/create-dmg.git "${BUILD_ROOT}/create-dmg"
|
||||||
@ -381,7 +386,7 @@ _create_dmg() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_codesign_dmg() {
|
_codesign_dmg() {
|
||||||
if [ ${CODESIGN} -eq 0 ]; then
|
if [ "${CODESIGN}" -eq 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -396,7 +401,7 @@ _codesign_dmg() {
|
|||||||
|
|
||||||
|
|
||||||
_notarize_pkg() {
|
_notarize_pkg() {
|
||||||
if [ ${CODESIGN} -eq 0 ]; then
|
if [ "${CODESIGN}" -eq 0 ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -405,10 +410,10 @@ _notarize_pkg() {
|
|||||||
echo "Uploading DMG for notarisation (attempt ${i} of 3)..."
|
echo "Uploading DMG for notarisation (attempt ${i} of 3)..."
|
||||||
STATUS=$(xcrun altool --notarize-app \
|
STATUS=$(xcrun altool --notarize-app \
|
||||||
-f "${DMG_NAME}" \
|
-f "${DMG_NAME}" \
|
||||||
--asc-provider ${DEVELOPER_NAME} \
|
--asc-provider "${DEVELOPER_NAME}" \
|
||||||
--primary-bundle-id org.pgadmin.pgadmin4 \
|
--primary-bundle-id org.pgadmin.pgadmin4 \
|
||||||
-u ${DEVELOPER_USER} \
|
-u "${DEVELOPER_USER}" \
|
||||||
-p ${DEVELOPER_ASP} 2>&1)
|
-p "${DEVELOPER_ASP}" 2>&1)
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
|
|
||||||
if [ ${RETVAL} != 0 ]; then
|
if [ ${RETVAL} != 0 ]; then
|
||||||
@ -426,7 +431,7 @@ _notarize_pkg() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Get the request ID
|
# Get the request ID
|
||||||
REQUEST_UUID=$(echo ${STATUS} | awk '/RequestUUID/ { print $NF; }')
|
REQUEST_UUID=$(echo "${STATUS}" | awk '/RequestUUID/ { print $NF; }')
|
||||||
echo "Notarization request ID: ${REQUEST_UUID}"
|
echo "Notarization request ID: ${REQUEST_UUID}"
|
||||||
|
|
||||||
# Now we need to wait for the results. Try 60 times.
|
# Now we need to wait for the results. Try 60 times.
|
||||||
@ -435,9 +440,9 @@ _notarize_pkg() {
|
|||||||
sleep 30
|
sleep 30
|
||||||
|
|
||||||
echo "Requesting notarisation result (attempt ${i} of 60)..."
|
echo "Requesting notarisation result (attempt ${i} of 60)..."
|
||||||
REQUEST_STATUS=$(xcrun altool --notarization-info ${REQUEST_UUID} \
|
REQUEST_STATUS=$(xcrun altool --notarization-info "${REQUEST_UUID}" \
|
||||||
--username ${DEVELOPER_USER} \
|
--username "${DEVELOPER_USER}" \
|
||||||
--password ${DEVELOPER_ASP} 2>&1 | \
|
--password "${DEVELOPER_ASP}" 2>&1 | \
|
||||||
awk -F ': ' '/Status:/ { print $2; }' )
|
awk -F ': ' '/Status:/ { print $2; }' )
|
||||||
|
|
||||||
if [[ "${REQUEST_STATUS}" == "success" ]]; then
|
if [[ "${REQUEST_STATUS}" == "success" ]]; then
|
||||||
@ -446,9 +451,9 @@ _notarize_pkg() {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Print status information
|
# Print status information
|
||||||
xcrun altool --notarization-info ${REQUEST_UUID} \
|
xcrun altool --notarization-info "${REQUEST_UUID}" \
|
||||||
--username ${DEVELOPER_USER} \
|
--username "${DEVELOPER_USER}" \
|
||||||
--password ${DEVELOPER_ASP}
|
--password "${DEVELOPER_ASP}"
|
||||||
|
|
||||||
if [[ "${REQUEST_STATUS}" != "success" ]]; then
|
if [[ "${REQUEST_STATUS}" != "success" ]]; then
|
||||||
echo "Notarization failed."
|
echo "Notarization failed."
|
||||||
@ -457,10 +462,8 @@ _notarize_pkg() {
|
|||||||
|
|
||||||
# Staple the notarization
|
# Staple the notarization
|
||||||
echo "Stapling the notarization to the pgAdmin DMG..."
|
echo "Stapling the notarization to the pgAdmin DMG..."
|
||||||
xcrun stapler staple "${DMG_NAME}"
|
if ! xcrun stapler staple "${DMG_NAME}"; then
|
||||||
|
echo "Stapling failed."
|
||||||
if [ $? != 0 ]; then
|
|
||||||
echo "Stapling failed."
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,14 +8,19 @@ set -e -E
|
|||||||
# Debugging shizz
|
# Debugging shizz
|
||||||
trap 'ERRCODE=$? && if [ ${ERRCODE} -ne 0 ]; then echo "The command \"${BASH_COMMAND}\" failed in \"${FUNCNAME}\" with exit code ${ERRCODE}."; fi' EXIT
|
trap 'ERRCODE=$? && if [ ${ERRCODE} -ne 0 ]; then echo "The command \"${BASH_COMMAND}\" failed in \"${FUNCNAME}\" with exit code ${ERRCODE}."; fi' EXIT
|
||||||
|
|
||||||
export SCRIPT_DIR=$(cd `dirname $0` && pwd)
|
SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
|
||||||
export SOURCE_DIR=$(realpath ${SCRIPT_DIR}/../..)
|
export SCRIPT_DIR
|
||||||
export BUILD_ROOT=$(realpath ${SCRIPT_DIR}/../..)/mac-build
|
SOURCE_DIR=$(realpath "${SCRIPT_DIR}"/../..)
|
||||||
export TEMP_DIR=$(realpath ${SCRIPT_DIR}/../..)/mac-temp
|
export SOURCE_DIR
|
||||||
export DIST_ROOT=$(realpath ${SCRIPT_DIR}/../..)/dist
|
BUILD_ROOT=$(realpath "${SCRIPT_DIR}"/../..)/mac-build
|
||||||
|
export BUILD_ROOT
|
||||||
|
TEMP_DIR=$(realpath "${SCRIPT_DIR}"/../..)/mac-temp
|
||||||
|
export TEMP_DIR
|
||||||
|
DIST_ROOT=$(realpath "${SCRIPT_DIR}"/../..)/dist
|
||||||
|
export DIST_ROOT
|
||||||
|
|
||||||
export CODESIGN=1
|
export CODESIGN=1
|
||||||
if [ ! -f ${SCRIPT_DIR}/codesign.conf ]; then
|
if [ ! -f "${SCRIPT_DIR}/codesign.conf" ]; then
|
||||||
echo
|
echo
|
||||||
echo "******************************************************************"
|
echo "******************************************************************"
|
||||||
echo "* pkg/mac/codesign.conf not found. NOT signing the binaries."
|
echo "* pkg/mac/codesign.conf not found. NOT signing the binaries."
|
||||||
@ -24,11 +29,12 @@ if [ ! -f ${SCRIPT_DIR}/codesign.conf ]; then
|
|||||||
export CODESIGN=0
|
export CODESIGN=0
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
source ${SCRIPT_DIR}/codesign.conf
|
# shellcheck disable=SC1091
|
||||||
|
source "${SCRIPT_DIR}/codesign.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export NOTARIZE=1
|
export NOTARIZE=1
|
||||||
if [ ! -f ${SCRIPT_DIR}/notarization.conf ]; then
|
if [ ! -f "${SCRIPT_DIR}/notarization.conf" ]; then
|
||||||
echo
|
echo
|
||||||
echo "******************************************************************"
|
echo "******************************************************************"
|
||||||
echo "* pkg/mac/notarization.conf not found. NOT notarizing the package."
|
echo "* pkg/mac/notarization.conf not found. NOT notarizing the package."
|
||||||
@ -37,20 +43,21 @@ if [ ! -f ${SCRIPT_DIR}/notarization.conf ]; then
|
|||||||
export NOTARIZE=0
|
export NOTARIZE=0
|
||||||
sleep 2
|
sleep 2
|
||||||
else
|
else
|
||||||
source ${SCRIPT_DIR}/notarization.conf
|
# shellcheck disable=SC1091
|
||||||
|
source "${SCRIPT_DIR}/notarization.conf"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${PGADMIN_POSTGRES_DIR}" == "x" ]; then
|
if [ "${PGADMIN_POSTGRES_DIR}" == "" ]; then
|
||||||
echo "PGADMIN_POSTGRES_DIR not set. Setting it to the default: /usr/local/pgsql"
|
echo "PGADMIN_POSTGRES_DIR not set. Setting it to the default: /usr/local/pgsql"
|
||||||
export PGADMIN_POSTGRES_DIR=/usr/local/pgsql
|
export PGADMIN_POSTGRES_DIR=/usr/local/pgsql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${PGADMIN_PYTHON_VERSION}" == "x" ]; then
|
if [ "${PGADMIN_PYTHON_VERSION}" == "" ]; then
|
||||||
echo "PGADMIN_PYTHON_VERSION not set. Setting it to the default: 3.9.9"
|
echo "PGADMIN_PYTHON_VERSION not set. Setting it to the default: 3.9.9"
|
||||||
export PGADMIN_PYTHON_VERSION=3.9.9
|
export PGADMIN_PYTHON_VERSION=3.9.9
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source ${SCRIPT_DIR}/build-functions.sh
|
source "${SCRIPT_DIR}/build-functions.sh"
|
||||||
|
|
||||||
_setup_env
|
_setup_env
|
||||||
_cleanup
|
_cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user