Unverified Commit 78be2f87 authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

mitmproxy: 11.1.3 -> 12.0.0 (#403044)

parents 44e674e9 f69a189f
Loading
Loading
Loading
Loading
+17 −25
Original line number Diff line number Diff line
@@ -2,23 +2,15 @@
  lib,
  buildPythonPackage,
  bpf-linker,
  fetchFromGitHub,
  rustPlatform,
  mitmproxy,
  mitmproxy-rs,
}:

buildPythonPackage rec {
buildPythonPackage {
  pname = "mitmproxy-linux";
  version = "0.11.5";
  inherit (mitmproxy-rs) version src cargoDeps;
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mitmproxy";
    repo = "mitmproxy_rs";
    tag = "v${version}";
    hash = "sha256-vC+Vsv7UWjkO+6lm7gAb91Ig04Y7r9gYQoz6R9xpxsA=";
  };

  postPatch = ''
    substituteInPlace mitmproxy-linux/build.rs \
      --replace-fail '"-Z",' "" \
@@ -26,12 +18,12 @@ buildPythonPackage rec {

    substituteInPlace mitmproxy-linux-ebpf/.cargo/config.toml \
      --replace-fail 'build-std = ["core"]' ""
  '';

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-CFsefq1zQLIYjZcfoy3afYfP/0MlBoi9kVx7FVGEKr0=";
  };
    cp ${./fix-mitmproxy-linux-redirector-path.diff} tmp.diff
    substituteInPlace tmp.diff \
      --replace-fail @mitmproxy-linux-redirector@ $out/bin/mitmproxy-linux-redirector
    patch -p1 < tmp.diff
  '';

  RUSTFLAGS = "-C target-feature=";
  RUSTC_BOOTSTRAP = 1;
@@ -49,13 +41,13 @@ buildPythonPackage rec {

  pythonImportsCheck = [ "mitmproxy_linux" ];

  meta = {
    description = "Rust bits in mitmproxy";
  meta =
    {
      inherit (mitmproxy-rs.meta) changelog license maintainers;
    }
    // {
      description = "Linux Rust bits in mitmproxy";
      homepage = "https://github.com/mitmproxy/mitmproxy_rs/tree/main/mitmproxy-linux";
    changelog = "https://github.com/mitmproxy/mitmproxy_rs/blob/${src.rev}/CHANGELOG.md#${
      lib.replaceStrings [ "." ] [ "" ] version
    }";
    license = lib.licenses.mit;
    inherit (mitmproxy.meta) maintainers;
      platforms = lib.platforms.linux;
    };
}
+13 −0
Original line number Diff line number Diff line
diff --git a/mitmproxy-linux/mitmproxy_linux/__init__.py b/mitmproxy-linux/mitmproxy_linux/__init__.py
index 7c50254..68aea37 100644
--- a/mitmproxy-linux/mitmproxy_linux/__init__.py
+++ b/mitmproxy-linux/mitmproxy_linux/__init__.py
@@ -12,6 +12,8 @@ def executable_path() -> Path:
     for development setups this may invoke cargo to build it.
     """
 
+    return "@mitmproxy-linux-redirector@"
+
     if getattr(sys, 'frozen', False) and (pyinstaller_dir := getattr(sys, '_MEIPASS')):
         return Path(pyinstaller_dir) / "mitmproxy-linux-redirector"
     else:
+3 −2
Original line number Diff line number Diff line
@@ -2,11 +2,12 @@
  lib,
  buildPythonPackage,
  fetchPypi,
  mitmproxy-rs,
}:

buildPythonPackage rec {
  pname = "mitmproxy-macos";
  version = "0.11.5";
  inherit (mitmproxy-rs) version;
  format = "wheel";

  src = fetchPypi {
@@ -15,7 +16,7 @@ buildPythonPackage rec {
    format = "wheel";
    dist = "py3";
    python = "py3";
    hash = "sha256-j3qqZGrMZLpHkKf01Gy5+/18sEEbm3pWfbBASGS/8o0=";
    hash = "sha256-sNguT3p72v9+FU5XFLYV6p0fO6WvGYerPy68GINwbyA=";
  };

  # repo has no python tests
+4 −4
Original line number Diff line number Diff line
@@ -11,21 +11,21 @@

buildPythonPackage rec {
  pname = "mitmproxy-rs";
  version = "0.11.5";
  version = "0.12.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mitmproxy";
    repo = "mitmproxy_rs";
    rev = "v${version}";
    hash = "sha256-vC+Vsv7UWjkO+6lm7gAb91Ig04Y7r9gYQoz6R9xpxsA=";
    tag = "v${version}";
    hash = "sha256-bWvSaUx5nv8d17eOWyYlhSDi71rHycrFoDGRuQEL7LU=";
  };

  buildAndTestSubdir = "mitmproxy-rs";

  cargoDeps = rustPlatform.fetchCargoVendor {
    inherit pname version src;
    hash = "sha256-CFsefq1zQLIYjZcfoy3afYfP/0MlBoi9kVx7FVGEKr0=";
    hash = "sha256-9J5RVGCXyMOcCYUP+LS92Xv1krA+feoMqFgeFExxxqY=";
  };

  nativeBuildInputs = [
+14 −16
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  buildPythonPackage,
  # Mitmproxy requirements
  aioquic,
  argon2-cffi,
  asgiref,
  brotli,
  buildPythonPackage,
  certifi,
  cryptography,
  fetchFromGitHub,
  flask,
  h11,
  h2,
  hyperframe,
  hypothesis,
  kaitaistruct,
  ldap3,
  mitmproxy-linux,
  mitmproxy-rs,
  msgpack,
  passlib,
@@ -22,41 +23,38 @@
  pyopenssl,
  pyparsing,
  pyperclip,
  pytest-asyncio,
  pytest-timeout,
  pytest-xdist,
  pytestCheckHook,
  requests,
  ruamel-yaml,
  setuptools,
  sortedcontainers,
  stdenv,
  tornado,
  urwid,
  wsproto,
  zstandard,
  # Additional check requirements
  hypothesis,
  pytest-asyncio,
  pytest-timeout,
  pytest-xdist,
  pytestCheckHook,
  requests,
}:

buildPythonPackage rec {
  pname = "mitmproxy";
  version = "11.1.3";
  version = "12.0.0";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "mitmproxy";
    repo = "mitmproxy";
    tag = "v${version}";
    hash = "sha256-gTeXxNQWVMQYiGdIyy7SS6JcuYG16KLnjxBBdjhi+lE=";
    hash = "sha256-2dEoPgT8g59sLRV5gMPo7XII0XjTrn2cVdYetxDj/V0=";
  };

  pythonRelaxDeps = [
    "h11" # https://github.com/NixOS/nixpkgs/pull/399393
    "h2"
    "passlib"
    "protobuf"
    "pyparsing"
    "ruamel.yaml"
    "urwid"
    "typing-extensions" # https://github.com/NixOS/nixpkgs/pull/397082
  ];

  build-system = [ setuptools ];