3
0
Fork 0
forked from mirrors/nixpkgs

pgadmin4: init at 6.3

Signed-off-by: Florian Brandes <florian.brandes@posteo.de>
This commit is contained in:
florian on nixos (Florian Brandes) 2021-07-02 14:22:12 +02:00
parent 607178a179
commit 0dda2d3888
No known key found for this signature in database
GPG key ID: 074048E893713170
7 changed files with 20999 additions and 1 deletions

View file

@ -393,6 +393,7 @@ in
pdns-recursor = handleTest ./pdns-recursor.nix {};
peerflix = handleTest ./peerflix.nix {};
peertube = handleTestOn ["x86_64-linux"] ./web-apps/peertube.nix {};
pgadmin4 = handleTest ./pgadmin4.nix {};
pgjwt = handleTest ./pgjwt.nix {};
pgmanage = handleTest ./pgmanage.nix {};
php = handleTest ./php {};

142
nixos/tests/pgadmin4.nix Normal file
View file

@ -0,0 +1,142 @@
import ./make-test-python.nix ({ pkgs, lib, ... }:
let
pgadmin4SrcDir = "/pgadmin";
pgadmin4Dir = "/var/lib/pgadmin";
pgadmin4LogDir = "/var/log/pgadmin";
python-with-needed-packages = pkgs.python3.withPackages (ps: with ps; [
selenium
testtools
testscenarios
flask
flask-babelex
flask-babel
flask-gravatar
flask_login
flask_mail
flask_migrate
flask_sqlalchemy
flask_wtf
flask-compress
passlib
pytz
simplejson
six
sqlparse
wtforms
flask-paranoid
psutil
psycopg2
python-dateutil
sqlalchemy
itsdangerous
flask-security-too
bcrypt
cryptography
sshtunnel
ldap3
gssapi
flask-socketio
eventlet
httpagentparser
user-agents
wheel
authlib
qrcode
pillow
pyotp
]);
in
{
name = "pgadmin4";
meta.maintainers = with lib.maintainers; [ gador ];
nodes.machine = { pkgs, ... }: {
imports = [ ./common/x11.nix ];
environment.systemPackages = with pkgs; [
pgadmin4
postgresql
python-with-needed-packages
chromedriver
chromium
];
services.postgresql = {
enable = true;
authentication = ''
host all all localhost trust
'';
ensureUsers = [
{
name = "postgres";
ensurePermissions = {
"DATABASE \"postgres\"" = "ALL PRIVILEGES";
};
}
];
};
};
testScript = ''
machine.wait_for_unit("postgresql")
# pgadmin4 needs its data and log directories
machine.succeed(
"mkdir -p ${pgadmin4Dir} \
&& mkdir -p ${pgadmin4LogDir} \
&& mkdir -p ${pgadmin4SrcDir}"
)
machine.succeed(
"tar xvzf ${pkgs.pgadmin4.src} -C ${pgadmin4SrcDir}"
)
machine.wait_for_file("${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/README.md")
# set paths and config for tests
machine.succeed(
"cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version} \
&& cp -v web/regression/test_config.json.in web/regression/test_config.json \
&& sed -i 's|PostgreSQL 9.4|PostgreSQL|' web/regression/test_config.json \
&& sed -i 's|/opt/PostgreSQL/9.4/bin/|${pkgs.postgresql}/bin|' web/regression/test_config.json \
&& sed -i 's|\"headless_chrome\": false|\"headless_chrome\": true|' web/regression/test_config.json"
)
# adapt chrome config to run within a sandbox without GUI
# see https://stackoverflow.com/questions/50642308/webdriverexception-unknown-error-devtoolsactiveport-file-doesnt-exist-while-t#50642913
# add chrome binary path. use spaces to satisfy python indention (tabs throw an error)
# this works for selenium 3 (currently used), but will need to be updated
# to work with "from selenium.webdriver.chrome.service import Service" in selenium 4
machine.succeed(
"cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version} \
&& sed -i '\|options.add_argument(\"--disable-infobars\")|a \ \ \ \ \ \ \ \ options.binary_location = \"${pkgs.chromium}/bin/chromium\"' web/regression/runtests.py \
&& sed -i '\|options.add_argument(\"--no-sandbox\")|a \ \ \ \ \ \ \ \ options.add_argument(\"--headless\")' web/regression/runtests.py \
&& sed -i '\|options.add_argument(\"--disable-infobars\")|a \ \ \ \ \ \ \ \ options.add_argument(\"--disable-dev-shm-usage\")' web/regression/runtests.py \
&& sed -i 's|(chrome_options=options)|(executable_path=\"${pkgs.chromedriver}/bin/chromedriver\", chrome_options=options)|' web/regression/runtests.py \
&& sed -i 's|driver_local.maximize_window()||' web/regression/runtests.py"
)
# don't bother to test LDAP authentification
with subtest("run browser test"):
machine.succeed(
'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
&& ${python-with-needed-packages.interpreter} regression/runtests.py --pkg browser --exclude \
browser.tests.test_ldap_login.LDAPLoginTestCase,browser.tests.test_ldap_login'
)
# fontconfig is necessary for chromium to run
# https://github.com/NixOS/nixpkgs/issues/136207
with subtest("run feature test"):
machine.succeed(
'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
&& export FONTCONFIG_FILE=${pkgs.makeFontsConf { fontDirectories = [];}} \
&& ${python-with-needed-packages.interpreter} regression/runtests.py --pkg feature_tests'
)
with subtest("run resql test"):
machine.succeed(
'cd ${pgadmin4SrcDir}/pgadmin4-${pkgs.pgadmin4.version}/web \
&& ${python-with-needed-packages.interpreter} regression/runtests.py --pkg resql'
)
'';
})

View file

@ -0,0 +1,158 @@
{ stdenv
, lib
, python3
, fetchurl
, zlib
, mkYarnModules
, sphinx
, nixosTests
}:
let
pname = "pgadmin";
version = "6.3";
src = fetchurl {
url = "https://ftp.postgresql.org/pub/pgadmin/pgadmin4/v${version}/source/pgadmin4-${version}.tar.gz";
sha256 = "0xcg5gx6hf4k15idjkxzsnm5s9829fn4li54ga9qbyfqn3wwpg0h";
};
yarnDeps = mkYarnModules {
pname = "${pname}-yarn-deps";
inherit version;
packageJSON = ./package.json;
yarnLock = ./yarn.lock;
yarnNix = ./yarn.nix;
};
in
python3.pkgs.buildPythonApplication rec {
inherit pname version src;
# from Dockerfile
CPPFLAGS = "-DPNG_ARM_NEON_OPT=0";
format = "setuptools";
postPatch = ''
# patching Makefile, so it doesn't try to build sphinx documentation here
# (will do so later)
substituteInPlace Makefile --replace "LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8 $(MAKE) -C docs/en_US -f Makefile.sphinx html" "true"
# fix document which refers a non-existing document and fails
substituteInPlace docs/en_US/contributions.rst --replace "code_snippets" ""
patchShebangs .
# relax dependencies
substituteInPlace requirements.txt \
--replace "Pillow==8.3.*" "Pillow>=8.3.0" \
--replace "psycopg2==2.8.*" "psycopg2>=2.8.0" \
--replace "cryptography==3.*" "cryptography>=3.0" \
--replace "requests==2.25.*" "requests>=2.25.0"
# don't use Server Mode (can be overridden later)
substituteInPlace pkg/pip/setup_pip.py \
--replace "req = req.replace('psycopg2', 'psycopg2-binary')" "req = req" \
--replace "builtins.SERVER_MODE = None" "builtins.SERVER_MODE = False"
'';
preBuild = ''
# Adapted from pkg/pip/build.sh
echo Creating required directories...
mkdir -p pip-build/pgadmin4/docs
# build the documentation
cd docs/en_US
${sphinx}/bin/sphinx-build -W -b html -d _build/doctrees . _build/html
# Build the clean tree
cd ../../web
cp -r * ../pip-build/pgadmin4
cd ../docs
cp -r * ../pip-build/pgadmin4/docs
for DIR in `ls -d ??_??/`
do
if [ -d ''${DIR}_build/html ]; then
mkdir -p ../pip-build/pgadmin4/docs/''${DIR}_build
cp -Rv ''${DIR}_build/html ../pip-build/pgadmin4/docs/''${DIR}_build
fi
done
cd ../
cp -r ${yarnDeps}/* pip-build/pgadmin4
echo Creating distro config...
echo HELP_PATH = \'../../docs/en_US/_build/html/\' > pip-build/pgadmin4/config_distro.py
echo MINIFY_HTML = False >> pip-build/pgadmin4/config_distro.py
echo Creating manifest...
echo recursive-include pgadmin4 \* > pip-build/MANIFEST.in
echo Building wheel...
cd pip-build
# copy non-standard setup.py to local directory
# so setuptools-build-hook can call it
cp -v ../pkg/pip/setup_pip.py setup.py
'';
nativeBuildInputs = [ python3 python3.pkgs.cython python3.pkgs.pip ];
buildInputs = [
zlib
python3.pkgs.wheel
];
# tests need an own data, log directory
# and a working and correctly setup postgres database
# checks will be run through nixos/tests
doCheck = false;
propagatedBuildInputs = with python3.pkgs; [
flask
flask-gravatar
flask_login
flask_mail
flask_migrate
flask_sqlalchemy
flask_wtf
flask-compress
passlib
pytz
simplejson
six
speaklater3
sqlparse
wtforms
flask-paranoid
psutil
psycopg2
python-dateutil
sqlalchemy
itsdangerous
flask-security-too
bcrypt
cryptography
sshtunnel
ldap3
flask-babelex
flask-babel
gssapi
flask-socketio
eventlet
httpagentparser
user-agents
wheel
authlib
qrcode
pillow
pyotp
];
passthru = {
tests = { inherit (nixosTests) pgadmin4; };
};
meta = with lib; {
description = "Administration and development platform for PostgreSQL";
homepage = "https://www.pgadmin.org/";
license = licenses.mit;
maintainers = with maintainers; [ gador ];
};
}

View file

@ -0,0 +1,191 @@
{
"//": [
"IMPORTANT:",
"If runtime or build time dependencies are changed in this file, the ",
"committer *must* ensure the DEB and RPM package maintainers are informed ",
"as soon as possible."
],
"license": "PostgreSQL",
"devDependencies": {
"@babel/core": "^7.10.2",
"@babel/eslint-parser": "^7.12.13",
"@babel/eslint-plugin": "^7.12.13",
"@babel/plugin-proposal-object-rest-spread": "^7.10.1",
"@babel/preset-env": "^7.10.2",
"@babel/preset-typescript": "^7.8.3",
"@emotion/core": "^10.0.14",
"@emotion/memoize": "^0.7.5",
"@emotion/react": "^11.1.5",
"@emotion/styled": "^10.0.14",
"@emotion/utils": "^1.0.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
"autoprefixer": "^10.2.4",
"axios-mock-adapter": "^1.17.0",
"babel-loader": "^8.1.0",
"browserify": "^17.0.0",
"buffer": "^6.0.3",
"copy-webpack-plugin": "^7.0.0",
"core-js": "^3.2.1",
"cross-env": "^7.0.3",
"css-minimizer-webpack-plugin": "^3.0.0",
"enzyme": "^3.11.0",
"eslint": "^7.19.0",
"eslint-plugin-react": "^7.20.5",
"eslint-plugin-react-hooks": "^4.3.0",
"exports-loader": "^2.0.0",
"html-react-parser": "^1.2.7",
"image-minimizer-webpack-plugin": "^2.2.0",
"imagemin-mozjpeg": "^9.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-pngquant": "^9.0.1",
"imagemin-svgo": "^8.0.0",
"is-docker": "^2.1.1",
"jasmine-core": "^3.6.0",
"jasmine-enzyme": "^7.1.2",
"karma": "^6.3.2",
"karma-babel-preprocessor": "^8.0.0",
"karma-browserify": "^8.0.0",
"karma-chrome-launcher": "^3.1.0",
"karma-jasmine": "^4.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"karma-requirejs": "~1.1.0",
"karma-source-map-support": "^1.4.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^5.0.0",
"mini-css-extract-plugin": "^1.3.5",
"popper.js": "^1.16.1",
"postcss-loader": "^5.0.0",
"process": "^0.11.10",
"prop-types": "^15.7.2",
"resize-observer-polyfill": "^1.5.1",
"sass": "^1.24.4",
"sass-loader": "^11.0.0",
"sass-resources-loader": "^2.2.1",
"style-loader": "^2.0.0",
"stylis": "^4.0.7",
"svgo": "^1.1.1",
"svgo-loader": "^2.2.0",
"terser-webpack-plugin": "^5.1.1",
"typescript": "^3.2.2",
"webfonts-loader": "^7.3.0",
"webpack": "^5.21.2",
"webpack-bundle-analyzer": "^4.4.0",
"webpack-cli": "^4.5.0",
"yarn-audit-html": "^2.0.0"
},
"dependencies": {
"@babel/plugin-proposal-class-properties": "^7.10.4",
"@babel/preset-react": "^7.12.13",
"@date-io/core": "^1.3.6",
"@date-io/date-fns": "1.x",
"@emotion/sheet": "^1.0.1",
"@fortawesome/fontawesome-free": "^5.14.0",
"@material-ui/core": "4.11.0",
"@material-ui/icons": "^4.11.2",
"@material-ui/lab": "4.0.0-alpha.58",
"@material-ui/pickers": "^3.2.10",
"@projectstorm/react-diagrams": "^6.6.1",
"@simonwep/pickr": "^1.5.1",
"@tippyjs/react": "^4.2.0",
"@types/classnames": "^2.2.6",
"@types/react": "^16.7.18",
"@types/react-dom": "^16.0.11",
"acitree": "git+https://github.com/imsurinder90/jquery-aciTree.git#rc.7",
"alertifyjs": "git+https://github.com/EnterpriseDB/AlertifyJS/#72c1d794f5b6d4ec13a68d123c08f19021afe263",
"aspen-decorations": "^1.0.2",
"axios": "^0.21.1",
"babelify": "~10.0.0",
"backbone": "1.4.0",
"backform": "^0.2.0",
"backgrid-filter": "^0.3.7",
"backgrid-select-all": "^0.3.5",
"bignumber.js": "^9.0.1",
"bootstrap": "^4.3.1",
"bootstrap-datepicker": "^1.8.0",
"bootstrap4-toggle": "^3.6.1",
"browserfs": "^1.4.3",
"chart.js": "^2.9.3",
"classnames": "^2.2.6",
"closest": "^0.0.1",
"codemirror": "^5.59.2",
"context-menu": "^2.0.0",
"css-loader": "^5.0.1",
"cssnano": "^5.0.2",
"dagre": "^0.8.4",
"date-fns": "^2.24.0",
"diff-arrays-of-objects": "^1.1.8",
"dropzone": "^5.9.3",
"html2canvas": "^1.0.0-rc.7",
"immutability-helper": "^3.0.0",
"imports-loader": "^2.0.0",
"insert-if": "^1.1.0",
"ip-address": "^7.1.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jquery": "^3.6.0",
"jquery-contextmenu": "^2.9.2",
"jquery-ui": "^1.13.0",
"json-bignumber": "^1.0.1",
"jsoneditor": "^9.5.4",
"karma-coverage": "^2.0.3",
"leaflet": "^1.5.1",
"lodash": "4.*",
"ml-matrix": "^6.5.0",
"moment": "^2.29.1",
"moment-timezone": "^0.5.33",
"mousetrap": "^1.6.3",
"notificar": "^1.0.1",
"notistack": "^1.0.10",
"path-fx": "^2.0.0",
"pathfinding": "^0.4.18",
"paths-js": "^0.4.9",
"pgadmin4-tree": "git+https://github.com/EnterpriseDB/pgadmin4-treeview/#90e62d4371d3d25a957b3ffc7c6cb81a928da06f",
"postcss": "^8.2.15",
"raf": "^3.4.1",
"react": "^17.0.1",
"react-aspen": "^1.1.0",
"react-dom": "^17.0.1",
"react-draggable": "^4.4.4",
"react-select": "^4.2.1",
"react-table": "^7.6.3",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.5",
"select2": "^4.0.13",
"shim-loader": "^1.0.1",
"slickgrid": "git+https://github.com/6pac/SlickGrid.git#2.3.16",
"snapsvg-cjs": "^0.0.6",
"socket.io-client": "^4.0.0",
"split.js": "^1.5.10",
"styled-components": "^5.2.1",
"tablesorter": "^2.31.2",
"tempusdominus-bootstrap-4": "^5.1.2",
"tempusdominus-core": "^5.0.3",
"underscore": "^1.13.1",
"url-loader": "^1.1.2",
"valid-filename": "^2.0.1",
"webcabin-docker": "git+https://github.com/EnterpriseDB/wcDocker/#5a5a1c96b89e965cb4900520ca7d5740e6a53afa",
"wkx": "^0.5.0",
"xterm": "^4.11.0",
"xterm-addon-fit": "^0.5.0",
"xterm-addon-search": "^0.8.0",
"xterm-addon-web-links": "^0.4.0"
},
"scripts": {
"linter": "yarn eslint --no-eslintrc -c .eslintrc.js --ext .js --ext .jsx .",
"webpacker": "yarn run webpack --config webpack.config.js --progress",
"webpacker:watch": "yarn run webpack --config webpack.config.js --progress --watch",
"bundle:watch": "yarn run linter && yarn run webpacker:watch",
"bundle:dev": "yarn run linter && yarn run webpacker",
"bundle:analyze": "cross-env NODE_ENV=production ANALYZE=true yarn run bundle:dev",
"bundle": "cross-env NODE_ENV=production yarn run bundle:dev",
"test:karma-once": "yarn run linter && yarn run karma start --single-run",
"test:karma": "yarn run linter && yarn run karma start",
"test:karma-coverage": "yarn run test:karma-once --reporters coverage,progress",
"test:feature": "yarn run bundle && python regression/runtests.py --pkg feature_tests",
"test": "yarn run test:karma-once && yarn run bundle && python regression/runtests.py",
"pep8": "pycodestyle --config=../.pycodestyle ../docs && pycodestyle --config=../.pycodestyle ../pkg && pycodestyle --config=../.pycodestyle ../tools && pycodestyle --config=../.pycodestyle ../web",
"auditjs-html": "yarn audit --json | yarn run yarn-audit-html --output ../auditjs.html",
"auditjs": "yarn audit --groups dependencies",
"auditpy": "safety check --full-report -i 40493",
"audit": "yarn run auditjs && yarn run auditpy"
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -33594,7 +33594,9 @@ with pkgs;
pgmanage = callPackage ../applications/misc/pgmanage { };
pgadmin = callPackage ../applications/misc/pgadmin {
pgadmin4 = callPackage ../tools/admin/pgadmin { };
pgadmin3 = callPackage ../applications/misc/pgadmin {
openssl = openssl_1_0_2;
};