Download raw body.
bsd.port.mk: CHECKSUM_QUIET
'checksum' is noisy, especially when working on ports with lots of distfiles.
Take net/go-ipfs for example with 1996(!) files in distinfo:
$ cat checksum.sh
make checksum "$@" | awk '
/up to date/ {up++; if (up > 1) next}
/SHA256.*OK/ {ok++; if (ok > 1) next}
{print}
END {print "skipped up/ok", up, ok}
'
$ sh ./checksum.sh CHECKSUM_QUIET=No
===> Checking files for kubo-0.26.0
`/home/distfiles/kubo-v0.26.0.zip' is up to date.
>> (SHA256) kubo-v0.26.0.zip: OK
skipped up/ok 1996 1996
In this usual case, I'd like to see all good cases folded so the output fits
on a page, even for monster ports.
Here's a WIP diff instrumenting cksum(1) -q for the SHA256 lines:
$ sh ./checksum.sh CHECKSUM_QUIET=Yes
===> Checking files for kubo-0.26.0
`/home/distfiles/kubo-v0.26.0.zip' is up to date.
>> (SHA256) all files: OK
skipped up/ok 1996 1
Errors, e.g. incorrect checksum, are still printed:
$ sed -i 1s/.=$/a=/ distinfo
$ sh ./checksum.sh CHECKSUM_QUIET=Yes
===> Checking files for kubo-0.26.0
`/home/distfiles/kubo-v0.26.0.zip' is up to date.
>> (SHA256) go_modules/bazil.org/fuse/@v/v0.0.0-20200117225306-7b5117fecadc.mod: FAILED
Make sure the Makefile and /p/net/go-ipfs/distinfo
from the OpenBSD main archive, type
make REFETCH=true [other args]
*** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2652 '_internal-checksum': @cd /home/distfiles; OK=true; list=''; files=''; set ...)
*** Error 2 in /p/net/go-ipfs (/usr/ports/infrastructure/mk/bsd.port.mk:2717 'checksum': @lock=kubo-0.26.0; export _LOCKS_HELD=" kubo-0.26....)
skipped up/ok 1997
So far so good, I haven't looked into the 'up to date' part, yet.
Anyone interested in such an opt-in?
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
diff -u -p -r1.1639 bsd.port.mk
--- bsd.port.mk 6 Oct 2024 10:24:24 -0000 1.1639
+++ bsd.port.mk 6 Oct 2024 20:06:42 -0000
@@ -737,6 +737,11 @@ _PMAKE_COOKIE = ${_PBUILD} ${_MAKE_COOKI
GMAKE ?= gmake
+_CKSUM = cksum
+CHECKSUM_QUIET ?= No
+.if ${CHECKSUM_QUIET:L} == "yes"
+_CKSUM += -q
+.endif
CHECKSUM_FILE ?= ${.CURDIR}/distinfo
# Current digest algorithm
@@ -2614,11 +2619,11 @@ _internal-checksum: _internal-fetch
exit 1; \
fi
@cd ${DISTDIR}; OK=true; list=''; files=''; \
+ set -o pipefail; \
for file in ${CHECKSUMFILES}; do \
if set -- $$(grep "^${_CIPHER:U} ($$file)" ${CHECKSUM_FILE}); \
then \
- echo -n '>> '; \
- if ! echo "$$@" | cksum -c; then \
+ if ! echo "$$@" | ${_CKSUM} -c | sed 's/^/>> /'; then \
list="$$list $$file ${_CIPHER} $$4"; \
files="$$files ${DISTDIR}/$$file"; \
OK=false; \
@@ -2642,6 +2647,8 @@ _internal-checksum: _internal-fetch
echo "\tmake REFETCH=true [other args]"; \
exit 1; \
fi; \
+ elif [ ${CHECKSUM_QUIET:L} = yes ]; then \
+ ${ECHO_MSG} ">> (${_CIPHER:U}) all files: OK"; \
fi
. endif
. endif
bsd.port.mk: CHECKSUM_QUIET