tech-pkg archive

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

Re: [patch] New OS_VARIANT=OpenIndiana in bsd.prefs.mk



Hi Jonathan,

> >+_SUN_RELEASE!=		head -n1 /etc/release
> 
> Please either make this a delayed variable via :sh or do the != inside 
> each OS_VARIANT section.
> 
> Basically you _really_ want to avoid running shell commands unless you 
> absolutely have to - this will cause a reasonable performance hit on 
> SmartOS as it stands.

Thanks for reviewing. Good point. Attached a new version with the 
invocation moved until after the SmartOS branch - from there on /etc/
release is needed at least once. (The checks use the variable so can't 
move inside, and from my understanding :sh would often lead to multiple 
invocations here.)

Sijmen
? mk/.bsd.prefs.mk.swp
Index: mk/bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.436
diff -u -r1.436 bsd.prefs.mk
--- mk/bsd.prefs.mk	30 Jul 2023 19:04:02 -0000	1.436
+++ mk/bsd.prefs.mk	10 Aug 2023 20:33:30 -0000
@@ -290,15 +290,21 @@
 .  if !empty(_UNAME_V:Mjoyent_*)
 OS_VARIANT=		SmartOS
 LOWER_VARIANT_VERSION=	${_UNAME_V:C/joyent_//}
-.  elif !empty(_UNAME_V:Momnios-*)
+.  else
+_SUN_RELEASE!=		head -n1 /etc/release
+.    if !empty(_UNAME_V:Momnios-*)
 OS_VARIANT=		OmniOS
-LOWER_VARIANT_VERSION!=	/usr/bin/awk '{ print $$3; exit 0; }' /etc/release
-.  elif !empty(_UNAME_V:Mtribblix-*)
+LOWER_VARIANT_VERSION=	${_SUN_RELEASE:[3]}
+.    elif !empty(_UNAME_V:Mtribblix-*)
 OS_VARIANT=		Tribblix
-LOWER_VARIANT_VERSION!=	/usr/bin/awk '{ print $$2; exit 0; }' /etc/release
-.  else
+LOWER_VARIANT_VERSION=	${_SUN_RELEASE:[2]}
+.    elif ${_SUN_RELEASE:[1]} == "OpenIndiana"
+OS_VARIANT=		OpenIndiana
+LOWER_VARIANT_VERSION=	${_SUN_RELEASE:[3]}
+.    else
 OS_VARIANT=		Solaris
 LOWER_VARIANT_VERSION=	${_UNAME_V}
+.    endif
 .  endif
 
 .elif ${OPSYS} == "SCO_SV"


Home | Main Index | Thread Index | Old Index