Tuesday, October 01, 2024

bsd.port.mk: PATCH_QUIET

I don't like flooding terminal backlog with stuff I already no.

Our patch(1) is generally quite verbose, but this helps a lot:

-s, --quiet, --silent
Makes patch do its work silently, unless an error occurs.

For devel/git 'make patch' would silently print only 11 instead of 61 lines.

$ make extract >/dev/null
$ make PATCH_QUIET=yes patch
===> Patching for git-2.46.2
===> Applying OpenBSD patch patch-builtin_gc_c
===> Ignoring patchfile patch-builtin_gc_c.orig
===> Applying OpenBSD patch patch-config_mak_uname
===> Ignoring patchfile patch-config_mak_uname.orig
===> Applying OpenBSD patch patch-gitweb_gitweb_perl
===> Applying OpenBSD patch patch-thread-utils_c
===> Compiler link: clang -> env CCACHE_DIR=/usr/ports/pobj/.ccache ccache /usr/bin/clang
===> Compiler link: clang++ -> env CCACHE_DIR=/usr/ports/pobj/.ccache ccache /usr/bin/clang++
===> Compiler link: cc -> env CCACHE_DIR=/usr/ports/pobj/.ccache ccache /usr/bin/cc
===> Compiler link: c++ -> env CCACHE_DIR=/usr/ports/pobj/.ccache ccache /usr/bin/c++


And if I break a patch, it still prints enough info (for me):

$ sed -i /@/d patches/patch-builtin_gc_c
$ make patch
===> Patching for git-2.46.2
===> Applying OpenBSD patch patch-builtin_gc_c
I can't seem to find a patch in there anywhere.
***> patch-builtin_gc_c did not apply cleanly
===> Ignoring patchfile patch-builtin_gc_c.orig
===> Applying OpenBSD patch patch-config_mak_uname
===> Ignoring patchfile patch-config_mak_uname.orig
===> Applying OpenBSD patch patch-gitweb_gitweb_perl
===> Applying OpenBSD patch patch-thread-utils_c
===> Failed patches:
patch-builtin_gc_c

*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2937 '/usr/ports/pobj/git-2.46.2/.patch_done': @if cd /p/devel/git/patches 2>/dev...)
*** Error 2 in /p/devel/git (/usr/ports/infrastructure/mk/bsd.port.mk:2710 'patch': @lock=git-2.46.2; export _LOCKS_HELD=" git-2.46.2"; do...)


Back then I added the "Failed patches:" summary in similar vain: errors
usually just scroll by and searching for them in all the success noise is
too much hassle... somehow I thought of the silent approach much later.

If this is something others like as well, I'm happy to write the manual bits.

Feedback? OK?


Index: infrastructure/mk//bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
diff -u -p -r1.1638 bsd.port.mk
--- infrastructure/mk//bsd.port.mk 29 Feb 2024 21:20:51 -0000 1.1638
+++ infrastructure/mk//bsd.port.mk 1 Oct 2024 21:24:42 -0000
@@ -110,6 +110,7 @@ NONBINMODE = 644


PATCH_CHECK_ONLY ?= No
+PATCH_QUIET ?= No
EDIT_PATCHES ?= Yes
REFETCH ?= false

@@ -775,6 +776,11 @@ PATCH_DIST_ARGS ?= -z ${DISTORIG} -d ${W
.if ${PATCH_CHECK_ONLY:L} == "yes"
PATCH_ARGS += -C
PATCH_DIST_ARGS += -C
+.endif
+
+.if ${PATCH_QUIET:L} == "yes"
+PATCH_ARGS += -s
+PATCH_DIST_ARGS += -s
.endif

TAR ?= /bin/tar

No comments:

Post a Comment