From 3a3e15f9986e428b4421f3c192bc26f64cefb59a Mon Sep 17 00:00:00 2001 From: Gaetan Lepage Date: Tue, 18 Feb 2025 09:14:22 +0100 Subject: [PATCH] python312Packages.graphite-web: 1.1.10 -> 1.1.10-unstable-2025-02-24 --- .../python-modules/graphite-web/default.nix | 112 +++++++++++------- 1 file changed, 67 insertions(+), 45 deletions(-) diff --git a/pkgs/development/python-modules/graphite-web/default.nix b/pkgs/development/python-modules/graphite-web/default.nix index cda30828836d..61fd0f7ba22b 100644 --- a/pkgs/development/python-modules/graphite-web/default.nix +++ b/pkgs/development/python-modules/graphite-web/default.nix @@ -1,53 +1,61 @@ { lib, + stdenv, + pkgs, buildPythonPackage, - python, + fetchFromGitHub, + + # dependencies cairocffi, django, django-tagging, - fetchFromGitHub, - fetchpatch, gunicorn, - mock, pyparsing, python-memcached, - pythonOlder, pytz, six, txamqp, urllib3, whisper, + + # tests + mock, + redis, + rrdtool, + writableTmpDirAsHomeHook, + python, + + # passthru nixosTests, }: -buildPythonPackage rec { +buildPythonPackage { pname = "graphite-web"; - version = "1.1.10"; - format = "setuptools"; - - disabled = pythonOlder "3.7"; + version = "1.1.10-unstable-2025-02-24"; + pyproject = true; src = fetchFromGitHub { owner = "graphite-project"; - repo = pname; - rev = version; - hash = "sha256-2HgCBKwLfxJLKMopoIdsEW5k/j3kNAiifWDnJ98a7Qo="; + repo = "graphite-web"; + rev = "49c28e2015d605ad9ec93524f7076dd924a4731a"; + hash = "sha256-TxsQPhnI5WhQvKKkDEYZ8xnyg/qf+N9Icej6d6A0jC0="; }; - patches = [ - (fetchpatch { - name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-1.patch"; - url = "https://github.com/graphite-project/graphite-web/commit/9c626006eea36a9fd785e8f811359aebc9774970.patch"; - hash = "sha256-JMmdhLqsaRhUG2FsH+yPNl+cR7O2YLfKFliL2GU0aAk="; - }) - (fetchpatch { - name = "CVE-2022-4730.CVE-2022-4729.CVE-2022-4728.part-2.patch"; - url = "https://github.com/graphite-project/graphite-web/commit/2f178f490e10efc03cd1d27c72f64ecab224eb23.patch"; - hash = "sha256-NL7K5uekf3NlLa58aFFRPJT9ktjqBeNlWC4Htd0fRQ0="; - }) - ]; + postPatch = + '' + substituteInPlace webapp/graphite/settings.py \ + --replace-fail \ + "join(WEBAPP_DIR, 'content')" \ + "join('$out/webapp', 'content')" + '' + + lib.optionalString stdenv.hostPlatform.isDarwin '' + substituteInPlace webapp/tests/test_dashboard.py \ + --replace-fail "test_dashboard_email" "_dont_test_dashboard_email" + substituteInPlace webapp/tests/test_render.py \ + --replace-fail "test_render_view" "_dont_test_render_view" + ''; - propagatedBuildInputs = [ + dependencies = [ cairocffi django django-tagging @@ -61,31 +69,39 @@ buildPythonPackage rec { whisper ]; - postPatch = '' - substituteInPlace setup.py \ - --replace "Django>=1.8,<3.1" "Django" \ - --replace "django-tagging==0.4.3" "django-tagging" - ''; + pythonRelaxDeps = [ + "django" + "django-tagging" + ]; - # Carbon-s default installation is /opt/graphite. This env variable ensures - # carbon is installed as a regular Python module. - GRAPHITE_NO_PREFIX = "True"; + env = { + # Carbon-s default installation is /opt/graphite. This env variable ensures + # carbon is installed as a regular Python module. + GRAPHITE_NO_PREFIX = "True"; - preConfigure = '' - substituteInPlace webapp/graphite/settings.py \ - --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')" - ''; + REDIS_HOST = "127.0.0.1"; + }; + + nativeCheckInputs = [ + mock + redis + rrdtool + writableTmpDirAsHomeHook + ]; + + preCheck = + # Start a redis server + '' + ${pkgs.valkey}/bin/redis-server & + REDIS_PID=$! + ''; - checkInputs = [ mock ]; checkPhase = '' runHook preCheck pushd webapp/ # avoid confusion with installed module rm -r graphite - # redis not practical in test environment - substituteInPlace tests/test_tags.py \ - --replace test_redis_tagdb _dont_test_redis_tagdb DJANGO_SETTINGS_MODULE=tests.settings ${python.interpreter} manage.py test popd @@ -93,17 +109,23 @@ buildPythonPackage rec { runHook postCheck ''; + postCheck = '' + kill $REDIS_PID + ''; + + __darwinAllowLocalNetworking = true; + pythonImportsCheck = [ "graphite" ]; passthru.tests = { inherit (nixosTests) graphite; }; - meta = with lib; { + meta = { description = "Enterprise scalable realtime graphing"; homepage = "http://graphiteapp.org/"; - license = licenses.asl20; - maintainers = with maintainers; [ + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ offline basvandijk ];