From 80d095fcbf7b312472922a8c4963bc1d6aba10a6 Mon Sep 17 00:00:00 2001
From: Mogens Jensen <mogens-jensen@protonmail.com>
Date: Sat, 14 May 2022 12:30:27 +0000
Subject: [PATCH] testing/mitmproxy: downgrade to 7.0.4

8.0.0 depends on cryptography>=36

This reverts commit 2bd040850bd93266d847f6b5a3740b99b26ee0cc.
---
 testing/mitmproxy/APKBUILD                    | 12 +++----
 testing/mitmproxy/skip-broken-tests.patch     | 31 -------------------
 .../mitmproxy/skip-test-optmanager-x86.patch  | 13 ++++++++
 3 files changed, 18 insertions(+), 38 deletions(-)
 delete mode 100644 testing/mitmproxy/skip-broken-tests.patch
 create mode 100644 testing/mitmproxy/skip-test-optmanager-x86.patch

diff --git a/testing/mitmproxy/APKBUILD b/testing/mitmproxy/APKBUILD
index 0c0304dba38c..9c3631885d52 100644
--- a/testing/mitmproxy/APKBUILD
+++ b/testing/mitmproxy/APKBUILD
@@ -2,8 +2,8 @@
 # Contributor: Michał Polański <michal@polanski.me>
 # Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
 pkgname=mitmproxy
-pkgver=8.0.0
-pkgrel=0
+pkgver=7.0.4
+pkgrel=2
 pkgdesc="Interactive TLS-capable intercepting HTTP proxy"
 url="https://mitmproxy.org/"
 license="MIT"
@@ -45,12 +45,10 @@ checkdepends="
 	py3-requests
 	"
 source="$pkgname-$pkgver.tar.gz::https://github.com/mitmproxy/mitmproxy/archive/v$pkgver.tar.gz
-	skip-broken-tests.patch
+	skip-test-optmanager-x86.patch
 	"
 
 # secfixes:
-#   8.0.0-r0:
-#     - CVE-2022-24766
 #   7.0.3-r0:
 #     - CVE-2021-39214
 
@@ -77,6 +75,6 @@ package() {
 }
 
 sha512sums="
-abb0855322ca74ef34756db860f491b49057fd8d4fb26ffafc4038e40fe30444c6736fcff7b683e32c21a2d7339ebfeeb6eaf7b9e586b965d191a59eddfe15b6  mitmproxy-8.0.0.tar.gz
-5c6854a72ac576f12098424cfe11fccb9898bb1d520308ff9369f8525ca310816cd9ea46345aba4a55a21e8a09a591ab9e69bd7919b65ad18aa37eab33fc2d54  skip-broken-tests.patch
+4224b44e609f84b974b5419c6ceb576845957968c786ee437bffb5fa5df685ce0712d5ef8c402d40c568406242f44692cc7f04037fadd19ecece8b112d73b7ae  mitmproxy-7.0.4.tar.gz
+30d677fe7899394e096d20f16d5522dc962518bebf4e23eaa954507a2dd99af61e568e6515363c74fd606d43cce21bc4c3272c6f08d2cf97d88981449cf9d1a2  skip-test-optmanager-x86.patch
 "
diff --git a/testing/mitmproxy/skip-broken-tests.patch b/testing/mitmproxy/skip-broken-tests.patch
deleted file mode 100644
index 709ab238ed28..000000000000
--- a/testing/mitmproxy/skip-broken-tests.patch
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/test/mitmproxy/addons/test_tlsconfig.py
-+++ b/test/mitmproxy/addons/test_tlsconfig.py
-@@ -58,6 +58,7 @@
-             tctx.configure(ta, certs=[tdata.path("mitmproxy/net/data/verificationcerts/trusted-leaf.pem")])
-             assert ta.certstore.certs
- 
-+    @pytest.mark.skip(reason="Test is broken")
-     def test_get_cert(self, tdata):
-         """Test that we generate a certificate matching the connection's context."""
-         ta = tlsconfig.TlsConfig()
---- a/test/mitmproxy/proxy/layers/http/test_http_fuzz.py
-+++ b/test/mitmproxy/proxy/layers/http/test_http_fuzz.py
-@@ -282,6 +282,7 @@
- @example([b'\x00\x00\x07\x05\x04\x00\x00\x00\x01\x00\x00\x00\x02\x84\x86\x82'])
- @example([b'\x00\x00\x06\x014\x00\x01\x00\x00\x00\x00\x01@\x80\x81c\x86\x82'])
- @example([b'\x00\x00\x06\x01\x04\x00\x00\x00\x01@\x80\x81c\x86\x82'])
-+@pytest.mark.skip(reason="Test is broken")
- def test_fuzz_h2_response_chunks(chunks):
-     _h2_response(chunks)
- 
---- a/test/mitmproxy/test_optmanager.py
-+++ b/test/mitmproxy/test_optmanager.py
-@@ -186,6 +186,8 @@
-     assert t.called
- 
- 
-+import platform
-+@pytest.mark.skipif(platform.machine() == "i686", reason="Test is flaky on x86")
- def test_rollback():
-     o = TO()
- 
diff --git a/testing/mitmproxy/skip-test-optmanager-x86.patch b/testing/mitmproxy/skip-test-optmanager-x86.patch
new file mode 100644
index 000000000000..0300d9b9867b
--- /dev/null
+++ b/testing/mitmproxy/skip-test-optmanager-x86.patch
@@ -0,0 +1,13 @@
+diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py
+index d0f0567..e24e378 100644
+--- a/test/mitmproxy/test_optmanager.py
++++ b/test/mitmproxy/test_optmanager.py
+@@ -186,6 +186,8 @@ def test_subscribe():
+     assert t.called
+ 
+ 
++import platform
++@pytest.mark.skipif(platform.machine() == "i686", reason="Test is flaky")
+ def test_rollback():
+     o = TO()
+ 
-- 
GitLab