tech-pkg archive

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

Re: grafana hits pkgsrc limits again



On Tue, Jul 09, 2024 at 04:15:00PM +0100, Jonathan Perkin wrote:
> Does adding mk/pthread.buildlink3.mk to digest's Makefile help?

jperkin updated the diff, and I've added pthread.buildlink3.mk to
digest/Makefile and it builds now.

> > For 'make distinfo' we create a file in the pkgsrc directory of the package.
> 
> We do, but for 'make checksum' we can't do that (would break read-only
> source trees) and we don't have a WRKDIR available for temporary files.
> 
> I'd do something like replacing:
> 
>   if cd ${DISTDIR} && ${_CHECKSUM_CMD} ${DISTINFO_FILE:tA} ${_CKSUMFILES}; then \
> 
> with:
> 
>   cd ${DISTDIR}; { \
>     ${_CKSUMFILES:@f@echo ${f};@} \
>   } | ${_CHECKSUM_CMD} ${DISTINFO_FILE:tA}; \
> 
> and update checksum.awk to handle files from stdin instead.

I tried that, but there seems to be a problem with the exit status in
a simple test case. With the attached diff:

/usr/pkgsrc/archivers/libzip> make checksum
=> Bootstrap dependency digest>=20211023: found digest-20220214
=> Checksum BLAKE2s OK for libzip-1.10.1.tar.xz
=> Checksum SHA512 OK for libzip-1.10.1.tar.xz
ERROR: Make sure the Makefile and checksum file (/usr/pkgsrc/archivers/libzip/distinfo)
ERROR: are up to date.  If you want to override this check, type
ERROR: "/usr/bin/make NO_CHECKSUM=yes [other args]".
*** Error code 1

Stop.

So the output of digest looks ok, but make falls into the case for
error exit code.

This happens with the current digest(1) too, so not a problem in
jperkin's patch. Does anyone see what I'm doing wrong?
 Thomas
Index: checksum.awk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/checksum/checksum.awk,v
retrieving revision 1.3
diff -u -r1.3 checksum.awk
--- checksum.awk	7 Oct 2020 18:09:52 -0000	1.3
+++ checksum.awk	10 Jul 2024 11:14:16 -0000
@@ -50,6 +50,7 @@
 	only_alg = ""
 	distinfo = ""
 	exitcode = 0
+	stdin = 0
 	patch = 0
 	suffix = ""
 
@@ -74,12 +75,14 @@
 		}
 	}
 
-	if (arg >= ARGC) {
+	if (arg > ARGC) {
 		usage()
 		exit 3
 	}
-
 	distinfo = ARGV[arg++]
+	if (arg == ARGC) {
+		stdin = 1
+	}
 	cmd = sprintf("test -f %s", distinfo)
 	if (system(cmd) != 0) {
 		err(sprintf("%s: distinfo file missing: %s", progname,
@@ -92,8 +95,16 @@
 	# order to keep things simple, distfiles[] is also used when operating
 	# in patch mode (-p).
 	#
+	arg_count = 0
+	if (stdin > 0) {
+		while (getline < "-") { arg_list[arg_count++] = $0 }
+	}
 	while (arg < ARGC) {
-		distfile = ARGV[arg++]
+		arg_list[arg_count++] = ARGV[arg++]
+	}
+	i = 0
+	while (i < arg_count) {
+		distfile = arg_list[i++]
 		sfile = distfile
 		if (suffix) {
 			sfile = strip_suffix(sfile)
@@ -241,8 +252,8 @@
 			    distfile)
 			seen[distfile] = 1
 		} else {
-			err(sprintf("%s: Checksum %s mismatch for %s",
-			    progname, algorithm, distfile))
+			err(sprintf("%s: Checksum %s mismatch for %s: expected %s, computed %s",
+				    progname, algorithm, distfile, checksum, checksums[algorithm,distfile]))
 			exit 1
 		}
 	}
@@ -276,7 +287,7 @@
 
 function usage()
 {
-	err(sprintf("usage: %s [-a algorithm] [-p] [-s suffix]" \
+	err(sprintf("usage: %s [-p] [-a algorithm] [-s suffix]" \
 		    " distinfo [file ...]", progname))
 }
 
Index: checksum.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/checksum/checksum.mk,v
retrieving revision 1.30
diff -u -r1.30 checksum.mk
--- checksum.mk	15 May 2024 08:31:35 -0000	1.30
+++ checksum.mk	10 Jul 2024 11:14:16 -0000
@@ -40,7 +40,9 @@
 	case ${.TARGET:Q} in						\
 	*-phase)	${TEST} ! -f ${_COOKIE.checksum} || exit 0 ;;	\
 	esac;								\
-	if cd ${DISTDIR} && ${_CHECKSUM_CMD} ${DISTINFO_FILE:tA} ${_CKSUMFILES}; then \
+	if cd ${DISTDIR}; {						\
+		${_CKSUMFILES:@f@echo ${f};@}				\
+	    } | ${_CHECKSUM_CMD} ${DISTINFO_FILE:tA}; then		\
 		${TRUE};						\
 	else								\
 		${ERROR_MSG} "Make sure the Makefile and checksum file (${DISTINFO_FILE})"; \


Home | Main Index | Thread Index | Old Index