pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk prevent OPSYS_VERSION_CMD going wrong if minor or p...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3cbdde1e691c
branches:  trunk
changeset: 378238:3cbdde1e691c
user:      tnn <tnn%pkgsrc.org@localhost>
date:      Sat Apr 30 21:27:57 2022 +0000

description:
prevent OPSYS_VERSION_CMD going wrong if minor or patch is >= 100

Clamp the version to 99 in that case, which is less wrong than expanding
the fixed-width field.

diffstat:

 mk/bsd.prefs.mk |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r cac1a3bc7e67 -r 3cbdde1e691c mk/bsd.prefs.mk
--- a/mk/bsd.prefs.mk   Sat Apr 30 21:15:44 2022 +0000
+++ b/mk/bsd.prefs.mk   Sat Apr 30 21:27:57 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.prefs.mk,v 1.419 2022/04/24 17:55:55 gutteridge Exp $
+# $NetBSD: bsd.prefs.mk,v 1.420 2022/04/30 21:27:57 tnn Exp $
 #
 # This file includes the mk.conf file, which contains the user settings.
 #
@@ -112,7 +112,7 @@
 #
 .if !defined(OPSYS_VERSION)
 _OPSYS_VERSION_CMD=    ${UNAME} -r | \
-                       awk -F. '{printf "%02d%02d%02d", $$1, $$2, $$3}'
+                       awk -F. '{major=int($$1); minor=int($$2); if (minor>=100) minor=99; patch=int($$3); if (patch>=100) patch=99; printf "%02d%02d%02d", major, minor, patch}'
 OPSYS_VERSION=         ${_OPSYS_VERSION_CMD:sh}
 MAKEFLAGS+=            OPSYS_VERSION=${OPSYS_VERSION:Q}
 .endif
@@ -186,7 +186,7 @@
 LOWER_OPSYS_VERSUFFIX= ${OS_VERSION:C/([0-9]*).*/\1/}
 LOWER_VENDOR?=         apple
 _OPSYS_VERSION_CMD=    sw_vers -productVersion | \
-                       awk -F. '{printf("%02d%02d%02d", $$1, $$2, $$3)}'
+                       awk -F. '{major=int($$1); minor=int($$2); if (minor>=100) minor=99; patch=int($$3); if (patch>=100) patch=99; printf "%02d%02d%02d", major, minor, patch}'
 
 .elif ${OPSYS} == "DragonFly"
 OS_VERSION:=           ${OS_VERSION:C/-.*$//}



Home | Main Index | Thread Index | Old Index