diff options
author | Flakebi <flakebi@t-online.de> | 2023-12-02 16:39:55 +0100 |
---|---|---|
committer | Flakebi <flakebi@t-online.de> | 2023-12-02 17:08:10 +0100 |
commit | 06feb44c1ab13a2cc42826c1d114f7c16fa00e00 (patch) | |
tree | d407bf98987715f216079a227557abd578a8d6fc /pkgs/applications/networking/powerdns-admin/default.nix | |
parent | ec9f89a840e82ae930af77333ede0d3098105019 (diff) |
powerdns-admin: use patch files
Diffstat (limited to 'pkgs/applications/networking/powerdns-admin/default.nix')
-rw-r--r-- | pkgs/applications/networking/powerdns-admin/default.nix | 38 |
1 files changed, 13 insertions, 25 deletions
diff --git a/pkgs/applications/networking/powerdns-admin/default.nix b/pkgs/applications/networking/powerdns-admin/default.nix index d029c90680237..61a728d983b36 100644 --- a/pkgs/applications/networking/powerdns-admin/default.nix +++ b/pkgs/applications/networking/powerdns-admin/default.nix @@ -19,10 +19,9 @@ let lima lxml passlib pyasn1 pytimeparse pyyaml jinja2 itsdangerous webcolors werkzeug zipp zxcvbn ]; - all_post_patch = '' - # flask 2.3: 'Blueprint' object has no attribute 'before_app_first_request' - substituteInPlace powerdnsadmin/routes/index.py --replace '@index_bp.before_app_first_request' "" - ''; + all_patches = [ + ./0001-Fix-flask-2.3-issue.patch + ]; assets = mkYarnPackage { inherit src version; @@ -40,10 +39,9 @@ let }; nativeBuildInputs = pythonDeps; - patchPhase = '' - sed -i -r -e "s|'rcssmin',\s?'cssrewrite'|'rcssmin'|g" powerdnsadmin/assets.py - ${all_post_patch} - ''; + patches = all_patches ++ [ + ./0002-Remove-cssrewrite-filter.patch + ]; buildPhase = '' # The build process expects the directory to be writable # with node_modules at a specific path @@ -92,25 +90,15 @@ in stdenv.mkDerivation { exec python -m gunicorn.app.wsgiapp "powerdnsadmin:create_app()" "$@" ''; + patches = all_patches ++ [ + ./0003-Fix-flask-migrate-4.0-compatibility.patch + ./0004-Fix-flask-session-and-powerdns-admin-compatibility.patch + ./0005-Use-app-context-to-create-routes.patch + ./0006-Register-modules-before-starting.patch + ]; + postPatch = '' rm -r powerdnsadmin/static powerdnsadmin/assets.py - # flask-migrate 4.0 compatibility: https://github.com/PowerDNS-Admin/PowerDNS-Admin/issues/1376 - substituteInPlace migrations/env.py --replace "render_as_batch=config.get_main_option('sqlalchemy.url').startswith('sqlite:')," "" - # flask-session and powerdns-admin both try to add sqlalchemy to flask. - # Reuse the database for flask-session - substituteInPlace powerdnsadmin/__init__.py --replace "sess = Session(app)" "app.config['SESSION_SQLALCHEMY'] = models.base.db; sess = Session(app)" - # Routes creates session database tables, so it needs a context - substituteInPlace powerdnsadmin/__init__.py --replace "routes.init_app(app)" "with app.app_context(): routes.init_app(app)" - - # flask 2.3: 'Blueprint' object has no attribute 'before_app_first_request' - # Run code before app.run() instead - substituteInPlace run.py \ - --replace 'from powerdnsadmin import create_app' 'from powerdnsadmin import create_app - from .powerdnsadmin.routes.index import register_modules' \ - --replace 'app = create_app()' 'app = create_app() - with app.app_context(): - register_modules()' - ${all_post_patch} ''; installPhase = '' |