From eaa71a7c32f8f5d6737f294674042438b9852532 Mon Sep 17 00:00:00 2001 From: dholland Date: Thu, 1 Jan 2015 06:06:06 +0000 Subject: Add support for BROKEN_ON_PLATFORM and BROKEN_EXCEPT_ON_PLATFORM, as per discussion on tech-pkg. BROKEN_ON_PLATFORM and NOT_FOR_PLATFORM are the same, except that (now) BROKEN_ON_PLATFORM sets PKG_FAIL_REASON and NOT_FOR_PLATFORM sets PKG_SKIP_REASON. BROKEN_EXCEPT_FOR_PLATFORM and ONLY_FOR_PLATFORM correspond in the same way. The idea is that going forward we will distinguish unbuildable packages that theoretically ought to be fixed (these are BROKEN) from packages where it doesn't make sense to build (these are NOT_FOR)... examples of the former include most non-64-bit-clean packges; examples of the latter include OS-specific language bindings. A general review of the uses of NOT_FOR_PLATFORM and ONLY_FOR_PLATFORM (converting many of them to BROKEN...) is coming up. Similarly, a general review of the uses of PKG_FAIL_REASON and PKG_SKIP_REASON is coming up. For this to become useful, pbulk needs to be taught to report failing and skipped packages differently - the idea is that failing packages should be reported up front and skipped packages don't need to be. This has not been done yet, but one set of things at a time... --- mk/bsd.pkg.mk | 40 ++++++++++++++++++++++++++++++++++++---- mk/bsd.prefs.mk | 8 ++++---- mk/help/notonly.help | 33 +++++++++++++++++++++++---------- mk/misc/can-be-built-here.mk | 28 +++++++++++++++++++++++++++- 4 files changed, 90 insertions(+), 19 deletions(-) (limited to 'mk') diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index af767bb06eb..7a6038d4447 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.2007 2014/12/30 15:13:19 wiz Exp $ +# $NetBSD: bsd.pkg.mk,v 1.2008 2015/01/01 06:06:06 dholland Exp $ # # This file is in the public domain. # @@ -488,7 +488,24 @@ PKG_FAIL_REASON+= "${PKGNAME} is marked as broken:" ${BROKEN:Q} .include "license.mk" -# Define __PLATFORM_OK only if the OS matches the pkg's allowed list. +# +# Check for packages broken or inappropriate on this platform. +# Set __PLATFORM_OK and __PLATFORM_WORKS only if the platform passes +# both the NOT_FOR/ONLY_FOR and BROKEN_ON lists (respectively). +# + +# 1. BROKEN_EXCEPT_ON_PLATFORM +. if defined(BROKEN_EXCEPT_ON_PLATFORM) && !empty(BROKEN_EXCEPT_ON_PLATFORM) +. for __tmp__ in ${BROKEN_EXCEPT_ON_PLATFORM} +. if ${MACHINE_PLATFORM:M${__tmp__}} != "" +__PLATFORM_WORKS?= yes +. endif # MACHINE_PLATFORM +. endfor # __tmp__ +. else # !BROKEN_EXCEPT_ON_PLATFORM +__PLATFORM_WORKS?= yes +. endif # BROKEN_EXCEPT_ON_PLATFORM + +# 2. ONLY_FOR_PLATFORM . if defined(ONLY_FOR_PLATFORM) && !empty(ONLY_FOR_PLATFORM) . for __tmp__ in ${ONLY_FOR_PLATFORM} . if ${MACHINE_PLATFORM:M${__tmp__}} != "" @@ -498,15 +515,30 @@ __PLATFORM_OK?= yes . else # !ONLY_FOR_PLATFORM __PLATFORM_OK?= yes . endif # ONLY_FOR_PLATFORM + +# 3. BROKEN_ON_PLATFORM +. for __tmp__ in ${BROKEN_ON_PLATFORM} +. if ${MACHINE_PLATFORM:M${__tmp__}} != "" +. undef __PLATFORM_WORKS +. endif # MACHINE_PLATFORM +. endfor # __tmp__ + +# 4. NOT_FOR_PLATFORM . for __tmp__ in ${NOT_FOR_PLATFORM} . if ${MACHINE_PLATFORM:M${__tmp__}} != "" . undef __PLATFORM_OK . endif # MACHINE_PLATFORM . endfor # __tmp__ + +# Check OK (NOT_FOR/ONLY_FOR) before WORKS (BROKEN_ON) . if !defined(__PLATFORM_OK) -PKG_FAIL_REASON+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}" +PKG_SKIP_REASON+= "${PKGNAME} is not available for ${MACHINE_PLATFORM}" . endif # !__PLATFORM_OK -.endif +. if !defined(__PLATFORM_WORKS) +PKG_FAIL_REASON+= "${PKGNAME} is marked broken on ${MACHINE_PLATFORM}" +. endif # !__PLATFORM_WORKS + +.endif # NO_SKIP # Add these defs to the ones dumped into +BUILD_DEFS _BUILD_DEFS+= PKGPATH diff --git a/mk/bsd.prefs.mk b/mk/bsd.prefs.mk index 7bf10df5823..669bf610174 100644 --- a/mk/bsd.prefs.mk +++ b/mk/bsd.prefs.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.prefs.mk,v 1.353 2014/12/30 15:13:19 wiz Exp $ +# $NetBSD: bsd.prefs.mk,v 1.354 2015/01/01 06:06:06 dholland Exp $ # # This file includes the mk.conf file, which contains the user settings. # @@ -796,10 +796,10 @@ _PKG_VARS.dirs= WRKSRC PATCHDIR FILESDIR PKGDIR _SYS_VARS.dirs= WRKDIR DESTDIR PKG_SYSCONFBASEDIR # List of 64bit operating systems with sizeof(int) != sizeof(void *). -# This can be used for software that is not 64bit clean. -# amd64 is for OpenBSD. +# This can be used with BROKEN_ON_PLATFORM for software that is not +# 64bit clean. The "amd64" case is for OpenBSD. # -# Keywords: ONLY_FOR_PLATFORM NOT_FOR_PLATFORM 64bit +# Keywords: BROKEN_ON_PLATFORM 64bit # LP64PLATFORMS= *-*-alpha *-*-sparc64 *-*-x86_64 *-*-amd64 diff --git a/mk/help/notonly.help b/mk/help/notonly.help index 36440616615..bb5337f670a 100644 --- a/mk/help/notonly.help +++ b/mk/help/notonly.help @@ -1,22 +1,35 @@ -# $NetBSD: notonly.help,v 1.2 2007/09/12 09:59:44 rillig Exp $ +# $NetBSD: notonly.help,v 1.3 2015/01/01 06:06:06 dholland Exp $ # === Package-settable variables === # +# BROKEN_ON_PLATFORM +# A list of platforms on which this package doesn't build or +# builds but doesn't run. +# # NOT_FOR_PLATFORM -# A list of platforms (for which this package either doesn't build -# or isn't useful to have. +# A list of platforms for which this package isn't useful to +# have and doesn't make sense to attempt to build. +# # +# BROKEN_EXCEPT_ON_PLATFORM +# If a package only builds and runs on some platforms, they +# should be listed here. This variable should only be used if +# you are sure that the package won't work on other platforms. +# It is almost always better to use BROKEN_ON_PLATFORM. # # ONLY_FOR_PLATFORM -# If a package only builds on some platforms, they should be -# listed here. This variable should only be used if you are sure -# that the package won't work on other platforms. It is almost -# always better to use NOT_FOR_PLATFORM. +# If a package only makes sense on a fixed set of platforms +# (often exactly one), they should be listed here. This variable +# should only be used if you are sure that the package doesn't +# make sense on other platforms. For ordinary cases it is almost +# always better to use NOT_FOR_PLATFORM, and if the package merely +# doesn't work, use BROKEN_ON_PLATFORM. # # Platforms are triples of OPSYS, OS_VERSION and MACHINE_ARCH, separated # by dashes. Each of the components may be the wildcard "*". # -# Whenever you use these variables in a package Makefile, add a comment -# nearby _why_ you are restricting the list of platforms. Otherwise -# these restrictions may be quickly removed by other developers. +# Whenever you use these variables in a package Makefile, add a +# comment nearby explaining _why_ you are restricting the list of +# platforms. Otherwise these restrictions may be quickly removed by +# other developers. # diff --git a/mk/misc/can-be-built-here.mk b/mk/misc/can-be-built-here.mk index 8218687a38c..ba23f0be8bb 100644 --- a/mk/misc/can-be-built-here.mk +++ b/mk/misc/can-be-built-here.mk @@ -1,10 +1,11 @@ -# $NetBSD: can-be-built-here.mk,v 1.7 2014/12/30 15:13:19 wiz Exp $ +# $NetBSD: can-be-built-here.mk,v 1.8 2015/01/01 06:06:06 dholland Exp $ # # This file checks whether a package can be built in the current pkgsrc # environment. It checks the following variables: # # * NOT_FOR_COMPILER, ONLY_FOR_COMPILER # * NOT_FOR_PLATFORM, ONLY_FOR_PLATFORM +# * BROKEN_ON_PLATFORM, BROKEN_EXCEPT_ON_PLATFORM # * NOT_FOR_BULK_PLATFORM # * NOT_FOR_UNPRIVILEGED, ONLY_FOR_UNPRIVILEGED # * PKG_FAIL_REASON, PKG_SKIP_REASON @@ -89,6 +90,31 @@ _CBBH.oplat= yes . endfor .endif +# Check BROKEN_ON_PLATFORM +_CBBH_CHECKS+= bplat +_CBBH_MSGS.bplat= "This package is broken on these platforms: "${BROKEN_ON_PLATFORM:Q}"." + +_CBBH.bplat= yes +.for p in ${BROKEN_ON_PLATFORM} +. if !empty(MACHINE_PLATFORM:M${p}) +_CBBH.bplat= no +. endif +.endfor + +# Check BROKEN_EXCEPT_ON_PLATFORM +_CBBH_CHECKS+= beplat +_CBBH_MSGS.beplat= "This package is broken except on these platforms: "${BROKEN_EXCEPT_ON_PLATFORM:Q}"." + +_CBBH.beplat= yes +.if defined(BROKEN_EXCEPT_ON_PLATFORM) && !empty(BROKEN_EXCEPT_ON_PLATFORM) +_CBBH.beplat= no +. for p in ${BROKEN_EXCEPT_ON_PLATFORM} +. if !empty(MACHINE_PLATFORM:M${p}) +_CBBH.beplat= yes +. endif +. endfor +.endif + # Check NOT_FOR_UNPRIVILEGED _CBBH_CHECKS+= nunpriv _CBBH_MSGS.nunpriv= "This package is not available in unprivileged mode." -- cgit v1.2.3