Tuesday, February 28, 2023

arch-defines SYSTEM_VERSION handling for lang/go compiler updates?

Currently there's no easy way to force compiled go packages to be
updated when the compiler is updated; only bumping REVISION in 130-odd
ports. As a result, especially combined with the lack of library
dependencies, compiled go packages tend to stick around for a long
time after a compiler update.

This diff gives a way to pass a value from go.port.mk through to
arch-defines which is added to the package version when the lang/go
module is used.

Without the diff:

$ make show=_PKG_ARGS_VERSION
-V 1 -V 7 -V 1

resulting in 1+7+1=9 -> @version 9 in +CONTENTS.

With the diff:

$ make show=_PKG_ARGS_VERSION
-V 1 -V 7 -V 1 -V 1

-> @version 10.

There is a corner case - if a port stops using go - but this will need
to be associated with a REVISION or version bump anyway, and @version
comparisons don't matter if that happens, they're an extra way to
trigger an update if the version doesn't change.

Does anyone see a problem I've missed? If not - OK?


Index: lang/go/go.port.mk
===================================================================
RCS file: /cvs/ports/lang/go/go.port.mk,v
retrieving revision 1.54
diff -u -p -r1.54 go.port.mk
--- lang/go/go.port.mk 10 Nov 2022 12:16:26 -0000 1.54
+++ lang/go/go.port.mk 28 Feb 2023 13:52:24 -0000
@@ -1,3 +1,7 @@
+# increment after a go compiler update to trigger updates of
+# compiled go packages
+MODGO_SYSTEM_VERSION = 1
+
ONLY_FOR_ARCHS ?= ${GO_ARCHS}

MODGO_BUILDDEP ?= Yes
Index: infrastructure/mk/arch-defines.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/arch-defines.mk,v
retrieving revision 1.95
diff -u -p -r1.95 arch-defines.mk
--- infrastructure/mk/arch-defines.mk 30 Jan 2023 12:45:34 -0000 1.95
+++ infrastructure/mk/arch-defines.mk 28 Feb 2023 13:52:24 -0000
@@ -99,6 +99,12 @@ _SYSTEM_VERSION-${ARCH} ?= 0
# added to version for all clang arches
_SYSTEM_VERSION-clang = 1

+# defined in go.port.mk; added to version for all go arches so that
+# go-compiled packages can be updated easily for a new go compiler
+.if defined(MODULES) && ${MODULES:Mlang/go}
+_SYSTEM_VERSION-go = ${MODGO_SYSTEM_VERSION}
+.endif
+
# @version = ${_SYSTEM_VERSION} + ${_SYSTEM_VERSION-${MACHINE_ARCH}}
_PKG_ARGS_VERSION += -V ${_SYSTEM_VERSION} -V ${_SYSTEM_VERSION-${MACHINE_ARCH}}
.if ${ARCH} != ${MACHINE_ARCH}

No comments:

Post a Comment