One pain point with the cargo module is 'make update-patches'.  The
problem is that crates.io normalizes the Cargo.toml files to maximize
compatibility with all versions of Cargo and to use crates.io paths for
dependencies.  All DISTFILES in ${DISTFILES}/cargo contain both a
Cargo.toml and Cargo.toml.orig, which cripples 'make update-patches'
unless PATCHORIG is set. For this reason, about a third of the Rust
ports set the PATCHORIG variable (all of them unconditionally).

I suggest that we add a PATCHORIG ?= line to cargo.port.mk. This way,
the user setting in /etc/mk.conf is respected and not overridden by the
port Makefiles. The majority set PATCHORIG = .openbsd.orig, so I chose
that as a default. The diff below also removes all PATCHORIG lines from
the cargo ports.

Index: ./devel/cargo/cargo.port.mk
===================================================================
RCS file: /cvs/ports/devel/cargo/cargo.port.mk,v
retrieving revision 1.24
diff -u -p -r1.24 cargo.port.mk
--- ./devel/cargo/cargo.port.mk 11 Sep 2021 07:13:13 -0000      1.24
+++ ./devel/cargo/cargo.port.mk 8 Nov 2021 13:39:34 -0000
@@ -25,6 +25,10 @@ MODCARGO_VENDOR_DIR ?= ${WRKSRC}/modcarg
 # Default path for cargo manifest.
 MODCARGO_CARGOTOML ?= ${WRKSRC}/Cargo.toml
 
+# unconfuse make update-patches: crates.io normalizes Cargo.toml and
+# its DISTFILES contain both a Cargo.toml and a Cargo.toml.orig.
+PATCHORIG ?= .openbsd.orig
+
 # Define MASTER_SITES_CRATESIO for crates.io
 MASTER_SITES_CRATESIO =        https://crates.io/api/v1/crates/
 
Index: ./devel/cbindgen/Makefile
===================================================================
RCS file: /cvs/ports/devel/cbindgen/Makefile,v
retrieving revision 1.37
diff -u -p -r1.37 Makefile
--- ./devel/cbindgen/Makefile   4 Oct 2021 06:35:40 -0000       1.37
+++ ./devel/cbindgen/Makefile   8 Nov 2021 13:23:26 -0000
@@ -74,6 +74,4 @@ WANTLIB += c c++abi pthread
 
 TEST_ENV =     CC=${CC} CXX=${CXX}
 
-PATCHORIG =    .ports.orig
-
 .include <bsd.port.mk>
Index: ./devel/cargo-audit/Makefile
===================================================================
RCS file: /cvs/ports/devel/cargo-audit/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- ./devel/cargo-audit/Makefile        13 Sep 2021 20:51:37 -0000      1.1.1.1
+++ ./devel/cargo-audit/Makefile        8 Nov 2021 13:23:30 -0000
@@ -29,7 +29,6 @@ MODULES =             devel/cargo
 
 CONFIGURE_STYLE =      cargo
 SEPARATE_BUILD =       Yes
-PATCHORIG =            .openbsd.orig
 
 WRKSRC =               ${WRKDIR}/${PKGNAME}
 
Index: ./net/bore/Makefile
===================================================================
RCS file: /cvs/ports/net/bore/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- ./net/bore/Makefile 6 Jul 2021 20:14:10 -0000       1.1.1.1
+++ ./net/bore/Makefile 8 Nov 2021 13:23:34 -0000
@@ -15,7 +15,6 @@ WANTLIB += c c++abi pthread
 
 MASTER_SITES =         https://bitbucket.org/delan/nonymous/get/
 DISTFILES =            bore-{}${V}${EXTRACT_SUFX}
-PATCHORIG =            .openbsd.orig
 
 MODULES =              devel/cargo
 SEPARATE_BUILD =       Yes
Index: ./security/py-cryptography/Makefile
===================================================================
RCS file: /cvs/ports/security/py-cryptography/Makefile,v
retrieving revision 1.55
diff -u -p -r1.55 Makefile
--- ./security/py-cryptography/Makefile 8 Nov 2021 14:46:55 -0000       1.55
+++ ./security/py-cryptography/Makefile 8 Nov 2021 15:43:58 -0000
@@ -9,8 +9,6 @@ DISTFILES=      cryptography-${MODPY_EGG_VERS
 PKGNAME=       ${MODPY_PY_PREFIX}${DISTNAME}
 .include "crates.inc"
 
-PATCHORIG=     .patch.orig
-
 CATEGORIES=    security devel
 
 HOMEPAGE=      https://cryptography.io/
Index: ./security/sn0int/Makefile
===================================================================
RCS file: /cvs/ports/security/sn0int/Makefile,v
retrieving revision 1.10
diff -u -p -r1.10 Makefile
--- ./security/sn0int/Makefile  30 Apr 2021 09:15:11 -0000      1.10
+++ ./security/sn0int/Makefile  8 Nov 2021 13:23:39 -0000
@@ -35,7 +35,6 @@ RUN_DEPENDS =         net/libmaxminddb,-asn \
 .include "crates.mk"
 
 CONFIGURE_STYLE =      cargo
-PATCHORIG =            .openbsd.orig
 SEPARATE_BUILD =       Yes
 
 MODCARGO_RUSTFLAGS =   -C debuginfo=0
Index: ./sysutils/czkawka/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/czkawka/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- ./sysutils/czkawka/Makefile 31 Aug 2021 21:01:09 -0000      1.1.1.1
+++ ./sysutils/czkawka/Makefile 8 Nov 2021 13:23:43 -0000
@@ -23,7 +23,6 @@ DISTFILES +=            ${DISTNAME}${EXT
 MODULES =              devel/cargo
 
 CONFIGURE_STYLE =      cargo
-PATCHORIG =            .openbsd.orig
 SEPARATE_BUILD =       Yes
 
 WANTLIB-main +=                c c++abi m pthread
Index: ./sysutils/bat/Makefile
===================================================================
RCS file: /cvs/ports/sysutils/bat/Makefile,v
retrieving revision 1.6
diff -u -p -r1.6 Makefile
--- ./sysutils/bat/Makefile     15 Sep 2021 08:27:44 -0000      1.6
+++ ./sysutils/bat/Makefile     8 Nov 2021 13:23:45 -0000
@@ -21,7 +21,6 @@ WANTLIB += c c++abi git2 m onig pthread
 
 CONFIGURE_STYLE =      cargo
 SEPARATE_BUILD =       Yes
-PATCHORIG =            .openbsd.orig
 
 LIB_DEPENDS +=         devel/libgit2/libgit2 \
                        textproc/oniguruma
Index: ./textproc/ripgrep/Makefile
===================================================================
RCS file: /cvs/ports/textproc/ripgrep/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- ./textproc/ripgrep/Makefile 24 Oct 2021 17:42:14 -0000      1.20
+++ ./textproc/ripgrep/Makefile 8 Nov 2021 13:23:48 -0000
@@ -21,7 +21,6 @@ BUILD_DEPENDS =               textproc/asciidoc
 
 CONFIGURE_STYLE =      cargo
 
-PATCHORIG =            .openbsd.orig
 SEPARATE_BUILD =       Yes
 
 MODCARGO_RUSTFLAGS =   -C debuginfo=0
Index: ./textproc/tree-sitter/Makefile
===================================================================
RCS file: /cvs/ports/textproc/tree-sitter/Makefile,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 Makefile
--- ./textproc/tree-sitter/Makefile     30 Apr 2021 16:16:46 -0000      1.1.1.1
+++ ./textproc/tree-sitter/Makefile     8 Nov 2021 13:23:51 -0000
@@ -120,8 +120,6 @@ MODCARGO_CRATES +=  winapi-i686-pc-window
 MODCARGO_CRATES +=     winapi-util     0.1.5   # Unlicense/MIT
 MODCARGO_CRATES +=     winapi-x86_64-pc-windows-gnu    0.4.0   # MIT/Apache-2.0
 
-PATCHORIG =            .openbsd.orig
-
 MAKE_ENV =             DESTDIR="" \
                        LIBDIR="${LOCALBASE}/lib" \
                        INCLUDEDIR="${LOCALBASE}/include"
Index: ./www/zola/Makefile
===================================================================
RCS file: /cvs/ports/www/zola/Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile
--- ./www/zola/Makefile 14 Apr 2020 21:45:41 -0000      1.5
+++ ./www/zola/Makefile 8 Nov 2021 13:23:54 -0000
@@ -326,8 +326,6 @@ MODCARGO_CRATES +=  ws2_32-sys      0.2.1   # MI
 MODCARGO_CRATES +=     xml-rs  0.8.0   # MIT
 MODCARGO_CRATES +=     yaml-rust       0.4.3   # MIT/Apache-2.0
 
-PATCHORIG =            .openbsd.orig
-
 SEPARATE_BUILD =       Yes
 
 .include <bsd.port.mk>
Index: ./www/nextcloud_notify_push/Makefile
===================================================================
RCS file: /cvs/ports/www/nextcloud_notify_push/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- ./www/nextcloud_notify_push/Makefile        16 Aug 2021 15:00:14 -0000      
1.3
+++ ./www/nextcloud_notify_push/Makefile        8 Nov 2021 13:23:57 -0000
@@ -23,7 +23,6 @@ MODULES =             devel/cargo
 .include "crates.inc"
 
 MODCARGO_CRATES_SQLITE3_BUNDLED = Yes
-PATCHORIG =            .openbsd.orig
 WANTLIB += c c++abi m pthread
 
 CONFIGURE_STYLE =      cargo
Index: ./x11/alacritty/Makefile
===================================================================
RCS file: /cvs/ports/x11/alacritty/Makefile,v
retrieving revision 1.3
diff -u -p -r1.3 Makefile
--- ./x11/alacritty/Makefile    2 Nov 2021 00:02:57 -0000       1.3
+++ ./x11/alacritty/Makefile    8 Nov 2021 13:23:21 -0000
@@ -28,7 +28,6 @@ MAKE_ENV =    ${MODCARGO_ENV}
 
 CONFIGURE_STYLE =      cargo
 
-PATCHORIG =            .openbsd.orig
 SEPARATE_BUILD =       Yes
 
 RELEASE_DIR =  ${MODCARGO_TARGET_DIR}/release

Reply via email to