pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

py-mitmproxy_rs: Add some patch to just fix the build



Module Name:	pkgsrc-wip
Committed By:	Leonardo Taccari <leot%NetBSD.org@localhost>
Pushed By:	leot
Date:		Tue Jan 2 00:26:30 2024 +0100
Changeset:	1802f88d42bbd2fc9197fe3268f623d53b82089a

Modified Files:
	py-mitmproxy_rs/PLIST
	py-mitmproxy_rs/TODO
Added Files:
	py-mitmproxy_rs/patches/patch-vendor_boringtun.xxx
	py-mitmproxy_rs/patches/patch-vendor_smoltcp.xxx

Log Message:
py-mitmproxy_rs: Add some patch to just fix the build

The patches are likely wrong and still needs to be manually applied!

I need to double-check them and find some way to patch such vendors file.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=1802f88d42bbd2fc9197fe3268f623d53b82089a

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 py-mitmproxy_rs/PLIST                              | 23 +++++++
 py-mitmproxy_rs/TODO                               | 73 +---------------------
 py-mitmproxy_rs/patches/patch-vendor_boringtun.xxx | 16 +++++
 py-mitmproxy_rs/patches/patch-vendor_smoltcp.xxx   | 43 +++++++++++++
 4 files changed, 85 insertions(+), 70 deletions(-)

diffs:
diff --git a/py-mitmproxy_rs/PLIST b/py-mitmproxy_rs/PLIST
index 48d96a5493..626c631c81 100644
--- a/py-mitmproxy_rs/PLIST
+++ b/py-mitmproxy_rs/PLIST
@@ -1 +1,24 @@
 @comment $NetBSD$
+${PYSITELIB}/${WHEEL_INFODIR}/METADATA
+${PYSITELIB}/${WHEEL_INFODIR}/RECORD
+${PYSITELIB}/${WHEEL_INFODIR}/WHEEL
+${PYSITELIB}/${WHEEL_INFODIR}/entry_points.txt
+${PYSITELIB}/${WHEEL_INFODIR}/license_files/LICENSE
+${PYSITELIB}/mitmproxy_rs/__init__.py
+${PYSITELIB}/mitmproxy_rs/__init__.pyc
+${PYSITELIB}/mitmproxy_rs/__init__.pyi
+${PYSITELIB}/mitmproxy_rs/__init__.pyo
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/__init__.py
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/__init__.pyc
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/__init__.pyo
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_macos.py
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_macos.pyc
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_macos.pyo
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_rs.py
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_rs.pyc
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_rs.pyo
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_windows.py
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_windows.pyc
+${PYSITELIB}/mitmproxy_rs/_pyinstaller/hook-mitmproxy_windows.pyo
+${PYSITELIB}/mitmproxy_rs/mitmproxy_rs.abi3.so
+${PYSITELIB}/mitmproxy_rs/py.typed
diff --git a/py-mitmproxy_rs/TODO b/py-mitmproxy_rs/TODO
index 6d957f9cf1..ab31010d5f 100644
--- a/py-mitmproxy_rs/TODO
+++ b/py-mitmproxy_rs/TODO
@@ -1,70 +1,3 @@
-Fails to build due:
-
-   Compiling exr v1.71.0
-error[E0425]: cannot find value `BIOCSETIF` in this scope
-  --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:79:29
-   |
-79 |         try_ioctl!(self.fd, BIOCSETIF, &mut self.ifreq);
-   |                             ^^^^^^^^^ not found in this scope
-   |
-help: consider importing one of these items
-   |
-1  + use crate::phy::sys::bpf::libc::BIOCSETIF;
-   |
-1  + use libc::BIOCSETIF;
-   |
-
-error[E0425]: cannot find value `BIOCIMMEDIATE` in this scope
-   --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:107:29
-    |
-107 |         try_ioctl!(self.fd, BIOCIMMEDIATE, &mut bufsize as *mut libc::c_int);
-    |                             ^^^^^^^^^^^^^ not found in this scope
-    |
-help: consider importing one of these items
-    |
-1   + use crate::phy::sys::bpf::libc::BIOCIMMEDIATE;
-    |
-1   + use libc::BIOCIMMEDIATE;
-    |
-
-error[E0425]: cannot find value `BIOCGBLEN` in this scope
-   --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:108:29
-    |
-108 |         try_ioctl!(self.fd, BIOCGBLEN, &mut bufsize as *mut libc::c_int);
-    |                             ^^^^^^^^^ not found in this scope
-    |
-help: consider importing one of these items
-    |
-1   + use crate::phy::sys::bpf::libc::BIOCGBLEN;
-    |
-1   + use libc::BIOCGBLEN;
-    |
-
-error[E0425]: cannot find value `BPF_HDRLEN` in this scope
-   --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:121:35
-    |
-121 |             if len == -1 || len < BPF_HDRLEN as isize {
-    |                                   ^^^^^^^^^^ not found in this scope
-
-error[E0425]: cannot find value `BPF_HDRLEN` in this scope
-   --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:129:25
-    |
-129 |                 &buffer[BPF_HDRLEN] as *const u8 as *const libc::c_void,
-    |                         ^^^^^^^^^^ not found in this scope
-
-error[E0425]: cannot find value `BPF_HDRLEN` in this scope
-   --> .../pkgsrc/wip/py-mitmproxy_rs/work/vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs:130:23
-    |
-130 |                 len - BPF_HDRLEN,
-    |                       ^^^^^^^^^^ not found in this scope
-
-   Compiling gif v0.12.0
-For more information about this error, try `rustc --explain E0425`.
-error: could not compile `smoltcp` (lib) due to 6 previous errors
-warning: build failed, waiting for other jobs to finish...
-💥 maturin failed
-  Caused by: Failed to build a native library through cargo
-  Caused by: Cargo build finished with "exit status: 101": `PYO3_ENVIRONMENT_SIGNATURE="cpython-3.11-64bit" PYO3_PYTHON="/usr/pkg/bin/python3.11" PYTHON_SYS_EXECUTABLE="/usr/pkg/bin/python3.11" "cargo" "rustc" "--message-format" "json-render-diagnostics" "--manifest-path" ".../pkgsrc/wip/py-mitmproxy_rs/work/mitmproxy_rs-0.5.1/mitmproxy-rs/Cargo.toml" "--release" "--lib"`
-Error: command ['maturin-3.11', 'pep517', 'build-wheel', '-i', '/usr/pkg/bin/python3.11', '--compatibility', 'off'] returned non-zero exit status 1
-
-ERROR Backend subprocess exited when trying to invoke build_wheel
+- Currently it only build by manually applying the patches in patches/
+- Review patches/*.xxx, they were only build-tested but are likely wrong
+- Properly patch such files
diff --git a/py-mitmproxy_rs/patches/patch-vendor_boringtun.xxx b/py-mitmproxy_rs/patches/patch-vendor_boringtun.xxx
new file mode 100644
index 0000000000..a6a887ab45
--- /dev/null
+++ b/py-mitmproxy_rs/patches/patch-vendor_boringtun.xxx
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- ./vendor/boringtun-0.6.0/src/sleepyinstant/unix.rs.orig	2024-01-01 23:15:11.332028854 +0000
++++ ./vendor/boringtun-0.6.0/src/sleepyinstant/unix.rs
+@@ -3,9 +3,9 @@ use std::time::Duration;
+ use nix::sys::time::TimeSpec;
+ use nix::time::{clock_gettime, ClockId};
+ 
+-#[cfg(any(target_os = "macos", target_os = "ios"))]
++#[cfg(any(target_os = "macos", target_os = "ios", target_os = "netbsd"))]
+ const CLOCK_ID: ClockId = ClockId::CLOCK_MONOTONIC;
+-#[cfg(not(any(target_os = "macos", target_os = "ios")))]
++#[cfg(not(any(target_os = "macos", target_os = "ios", target_os = "netbsd")))]
+ const CLOCK_ID: ClockId = ClockId::CLOCK_BOOTTIME;
+ 
+ #[derive(Clone, Copy, Debug)]
diff --git a/py-mitmproxy_rs/patches/patch-vendor_smoltcp.xxx b/py-mitmproxy_rs/patches/patch-vendor_smoltcp.xxx
new file mode 100644
index 0000000000..0bf8cbf7d0
--- /dev/null
+++ b/py-mitmproxy_rs/patches/patch-vendor_smoltcp.xxx
@@ -0,0 +1,43 @@
+$NetBSD$
+
+--- ./vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs.orig	2024-01-01 23:09:33.311396101 +0000
++++ ./vendor/smoltcp-0.10.0/src/phy/sys/bpf.rs
+@@ -9,24 +9,24 @@ use crate::phy::Medium;
+ use crate::wire::ETHERNET_HEADER_LEN;
+ 
+ /// set interface
+-#[cfg(any(target_os = "macos", target_os = "openbsd"))]
++#[cfg(any(target_os = "macos", target_os = "netbsd", target_os = "openbsd"))]
+ const BIOCSETIF: libc::c_ulong = 0x8020426c;
+ /// get buffer length
+-#[cfg(any(target_os = "macos", target_os = "openbsd"))]
++#[cfg(any(target_os = "macos", target_os = "netbsd", target_os = "openbsd"))]
+ const BIOCGBLEN: libc::c_ulong = 0x40044266;
+ /// set immediate/nonblocking read
+-#[cfg(any(target_os = "macos", target_os = "openbsd"))]
++#[cfg(any(target_os = "macos", target_os = "netbsd", target_os = "openbsd"))]
+ const BIOCIMMEDIATE: libc::c_ulong = 0x80044270;
+ /// set bpf_hdr struct size
+ #[cfg(target_os = "macos")]
+ const SIZEOF_BPF_HDR: usize = 18;
+ /// set bpf_hdr struct size
+-#[cfg(target_os = "openbsd")]
++#[cfg(any(target_os = "netbsd", target_os = "openbsd"))]
+ const SIZEOF_BPF_HDR: usize = 24;
+ /// The actual header length may be larger than the bpf_hdr struct due to aligning
+ /// see https://github.com/openbsd/src/blob/37ecb4d066e5566411cc16b362d3960c93b1d0be/sys/net/bpf.c#L1649
+ /// and https://github.com/apple/darwin-xnu/blob/8f02f2a044b9bb1ad951987ef5bab20ec9486310/bsd/net/bpf.c#L3580
+-#[cfg(any(target_os = "macos", target_os = "openbsd"))]
++#[cfg(any(target_os = "macos", target_os = "netbsd", target_os = "openbsd"))]
+ const BPF_HDRLEN: usize = (((SIZEOF_BPF_HDR + ETHERNET_HEADER_LEN) + mem::align_of::<u32>() - 1)
+     & !(mem::align_of::<u32>() - 1))
+     - ETHERNET_HEADER_LEN;
+@@ -170,7 +170,7 @@ mod test {
+     }
+ 
+     #[test]
+-    #[cfg(target_os = "openbsd")]
++    #[cfgany((target_os = "netbsd", target_os = "openbsd"))]
+     fn test_aligned_bpf_hdr_len() {
+         assert_eq!(26, BPF_HDRLEN);
+     }


Home | Main Index | Thread Index | Old Index