tech-pkg archive

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

Re: Minor annoyance with bmake



Am 04.05.2019 um 19:29 schrieb Roland Illig:
> Am 04.05.2019 um 17:59 schrieb Jason Bacon:
>> There's been an intermittent issue running multiple targets with bmake
>> for as long as I can remember:
>>
>> Sometimes only the first target runs and sometimes all targets work.
>
> It's not really sometimes. It's only surprising when any of the "clean"
> targets is involved.

To fix at least the 99% of the most common workflows involving one of
the "clean" targets, the appended patch looks whether one of the "clean"
targets is given in the command line, and if it is, it treats all cookie
files as nonexistent, assuming the "clean" targets will remove them
early enough.

This makes "bmake clean depends" equivalent to "bmake clean && bmake
depends".

It doesn't work for "bmake wrapper clean build", but that command hasn't
worked before either and is most probably not in anyone's workflow. If I
were wrong, I'd like to know.

I can only think of these legitimate workflows, which are all covered:

1. first clean, then do something productive
2. first clean, then do something productive, then clean again
3. do something productive, then clean
Index: mk/bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.403
diff -u -p -T -r1.403 bsd.prefs.mk
--- mk/bsd.prefs.mk	6 Jan 2019 12:51:45 -0000	1.403
+++ mk/bsd.prefs.mk	4 May 2019 18:15:09 -0000
@@ -61,6 +61,11 @@ MAKEFLAGS+=	_MAKE=${_MAKE:Q}
	.endif
	MAKE:=	${_MAKE}
	
+	# Whether bmake has been called with one of the "clean" targets followed by
+	# another non-cleaning target like "depends" or "build". This is to make
+	# the call "bmake clean depends" equivalent to "bmake clean && bmake depends".
+	_CLEANING:=	${"${.TARGETS:C,( [[:alnum:]-]*clean[[:alnum:]-]*)+$,,W:M*clean*}":?yes:}
+	
	.if exists(/usr/bin/uname)
	UNAME=/usr/bin/uname
	.elif exists(/bin/uname)
Index: mk/cwrappers.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/cwrappers.mk,v
retrieving revision 1.30
diff -u -p -T -r1.30 cwrappers.mk
--- mk/cwrappers.mk	8 Nov 2017 03:52:50 -0000	1.30
+++ mk/cwrappers.mk	4 May 2019 18:15:09 -0000
@@ -101,7 +101,7 @@ _COOKIE.wrapper=	${WRKDIR}/.wrapper_done
	
	.PHONY: wrapper
	.if !target(wrapper)
-	.  if exists(${_COOKIE.wrapper})
+	.  if exists(${_COOKIE.wrapper}) && !${_CLEANING}
	wrapper:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -115,7 +115,7 @@ wrapper: barrier
	acquire-wrapper-lock: acquire-lock
	release-wrapper-lock: release-lock
	
-	.if exists(${_COOKIE.wrapper})
+	.if exists(${_COOKIE.wrapper}) && !${_CLEANING}
	${_COOKIE.wrapper}:
		@${DO_NADA}
	.else
Index: mk/build/bsd.build.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/build/bsd.build.mk,v
retrieving revision 1.12
diff -u -p -T -r1.12 bsd.build.mk
--- mk/build/bsd.build.mk	1 Jun 2017 02:15:10 -0000	1.12
+++ mk/build/bsd.build.mk	4 May 2019 18:15:09 -0000
@@ -32,7 +32,7 @@ _COOKIE.test=	${WRKDIR}/.test_done
	.if !defined(NO_BUILD)
	.  include "build.mk"
	.elif !target(build)
-	.  if exists(${_COOKIE.build})
+	.  if exists(${_COOKIE.build}) && !${_CLEANING}
	build:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
Index: mk/build/build.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/build/build.mk,v
retrieving revision 1.25
diff -u -p -T -r1.25 build.mk
--- mk/build/build.mk	17 Mar 2019 03:59:11 -0000	1.25
+++ mk/build/build.mk	4 May 2019 18:15:09 -0000
@@ -77,7 +77,7 @@ _BUILD_TARGETS+=	pkginstall
	
	.PHONY: build
	.if !target(build)
-	.  if exists(${_COOKIE.build})
+	.  if exists(${_COOKIE.build}) && !${_CLEANING}
	build:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -91,7 +91,7 @@ build: barrier
	acquire-build-lock: acquire-lock
	release-build-lock: release-lock
	
-	.if exists(${_COOKIE.build})
+	.if exists(${_COOKIE.build}) && !${_CLEANING}
	${_COOKIE.build}:
		@${DO_NADA}
	.else
Index: mk/build/test.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/build/test.mk,v
retrieving revision 1.20
diff -u -p -T -r1.20 test.mk
--- mk/build/test.mk	30 Nov 2018 18:38:19 -0000	1.20
+++ mk/build/test.mk	4 May 2019 18:15:09 -0000
@@ -67,7 +67,7 @@ _TEST_TARGETS+=	release-test-lock
	
	.PHONY: test
	.if !target(test)
-	.  if exists(${_COOKIE.test})
+	.  if exists(${_COOKIE.test}) && !${_CLEANING}
	test:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -81,7 +81,7 @@ test: barrier
	acquire-test-lock: acquire-lock
	release-test-lock: release-lock
	
-	.if exists(${_COOKIE.test})
+	.if exists(${_COOKIE.test}) && !${_CLEANING}
	${_COOKIE.test}:
		@${DO_NADA}
	.else
Index: mk/configure/bsd.configure.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/configure/bsd.configure.mk,v
retrieving revision 1.11
diff -u -p -T -r1.11 bsd.configure.mk
--- mk/configure/bsd.configure.mk	4 Jan 2008 01:46:26 -0000	1.11
+++ mk/configure/bsd.configure.mk	4 May 2019 18:15:09 -0000
@@ -23,7 +23,7 @@ _COOKIE.configure=	${WRKDIR}/.configure_
	.if !defined(NO_CONFIGURE)
	.  include "configure.mk"
	.elif !target(configure)
-	.  if exists(${_COOKIE.configure})
+	.  if exists(${_COOKIE.configure}) && !${_CLEANING}
	configure:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
Index: mk/configure/configure.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/configure/configure.mk,v
retrieving revision 1.28
diff -u -p -T -r1.28 configure.mk
--- mk/configure/configure.mk	28 Apr 2019 13:18:18 -0000	1.28
+++ mk/configure/configure.mk	4 May 2019 18:15:09 -0000
@@ -99,7 +99,7 @@ _CONFIGURE_TARGETS+=	release-configure-l
	
	.PHONY: configure
	.if !target(configure)
-	.  if exists(${_COOKIE.configure})
+	.  if exists(${_COOKIE.configure}) && !${_CLEANING}
	configure:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -113,7 +113,7 @@ configure: barrier
	acquire-configure-lock: acquire-lock
	release-configure-lock: release-lock
	
-	.if exists(${_COOKIE.configure})
+	.if exists(${_COOKIE.configure}) && !${_CLEANING}
	${_COOKIE.configure}:
		@${DO_NADA}
	.else
Index: mk/depends/bsd.depends.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/depends/bsd.depends.mk,v
retrieving revision 1.29
diff -u -p -T -r1.29 bsd.depends.mk
--- mk/depends/bsd.depends.mk	4 May 2019 11:45:14 -0000	1.29
+++ mk/depends/bsd.depends.mk	4 May 2019 18:15:09 -0000
@@ -72,7 +72,7 @@ DEPENDS_TARGET=		reinstall
	.if ${SKIP_DEPENDS:M[Nn][Oo]} != ""
	.  include "depends.mk"
	.elif !target(depends)
-	.  if exists(${_COOKIE.depends})
+	.  if exists(${_COOKIE.depends}) && !${_CLEANING}
	depends:
		@${DO_NADA}
	.  else
Index: mk/depends/depends.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/depends/depends.mk,v
retrieving revision 1.18
diff -u -p -T -r1.18 depends.mk
--- mk/depends/depends.mk	14 Jan 2014 12:28:47 -0000	1.18
+++ mk/depends/depends.mk	4 May 2019 18:15:09 -0000
@@ -12,7 +12,7 @@ _DEPENDS_TARGETS+=	release-depends-lock
	
	.PHONY: depends
	.if !target(depends)
-	.  if exists(${_COOKIE.depends})
+	.  if exists(${_COOKIE.depends}) && !${_CLEANING}
	depends:
		@${DO_NADA}
	.  else
@@ -24,7 +24,7 @@ depends: ${_DEPENDS_TARGETS}
	acquire-depends-lock: acquire-lock
	release-depends-lock: release-lock
	
-	.if exists(${_COOKIE.depends})
+	.if exists(${_COOKIE.depends}) && !${_CLEANING}
	${_COOKIE.depends}:
		@${DO_NADA}
	.else
Index: mk/extract/extract.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/extract/extract.mk,v
retrieving revision 1.37
diff -u -p -T -r1.37 extract.mk
--- mk/extract/extract.mk	2 Mar 2014 09:45:42 -0000	1.37
+++ mk/extract/extract.mk	4 May 2019 18:15:09 -0000
@@ -71,7 +71,7 @@ _EXTRACT_TARGETS+=	release-extract-lock
	
	.PHONY: extract
	.if !target(extract)
-	.  if exists(${_COOKIE.extract})
+	.  if exists(${_COOKIE.extract}) && !${_CLEANING}
	extract:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -85,7 +85,7 @@ extract: barrier
	acquire-extract-lock: acquire-lock
	release-extract-lock: release-lock
	
-	.if exists(${_COOKIE.extract})
+	.if exists(${_COOKIE.extract}) && !${_CLEANING}
	${_COOKIE.extract}:
		@${DO_NADA}
	.else
Index: mk/install/bsd.install.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/bsd.install.mk,v
retrieving revision 1.16
diff -u -p -T -r1.16 bsd.install.mk
--- mk/install/bsd.install.mk	10 Apr 2016 15:58:02 -0000	1.16
+++ mk/install/bsd.install.mk	4 May 2019 18:15:09 -0000
@@ -38,7 +38,7 @@ install: package-install
	.if !defined(NO_INSTALL)
	.  include "install.mk"
	.else
-	.  if exists(${_COOKIE.install})
+	.  if exists(${_COOKIE.install}) && !${_CLEANING}
	stage-install:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
Index: mk/install/install.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/install/install.mk,v
retrieving revision 1.75
diff -u -p -T -r1.75 install.mk
--- mk/install/install.mk	12 Nov 2018 14:22:58 -0000	1.75
+++ mk/install/install.mk	4 May 2019 18:15:09 -0000
@@ -77,7 +77,7 @@ _INSTALL_TARGETS+=	release-install-lock
	
	.PHONY: stage-install
	.if !target(stage-install)
-	.  if exists(${_COOKIE.install})
+	.  if exists(${_COOKIE.install}) && !${_CLEANING}
	stage-install:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -91,7 +91,7 @@ stage-install: barrier
	acquire-install-lock: acquire-lock
	release-install-lock: release-lock
	
-	.if exists(${_COOKIE.install})
+	.if exists(${_COOKIE.install}) && !${_CLEANING}
	${_COOKIE.install}:
		@${DO_NADA}
	.else
Index: mk/package/package.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/package/package.mk,v
retrieving revision 1.26
diff -u -p -T -r1.26 package.mk
--- mk/package/package.mk	14 Jul 2016 14:43:55 -0000	1.26
+++ mk/package/package.mk	4 May 2019 18:15:09 -0000
@@ -18,7 +18,7 @@ _PACKAGE_TARGETS+=	release-package-lock
	
	.PHONY: package
	.if !target(package)
-	.  if exists(${_COOKIE.package})
+	.  if exists(${_COOKIE.package}) && !${_CLEANING}
	package:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -32,7 +32,7 @@ package: barrier
	acquire-package-lock: acquire-lock
	release-package-lock: release-lock
	
-	.if exists(${_COOKIE.package})
+	.if exists(${_COOKIE.package}) && !${_CLEANING}
	${_COOKIE.package}:
		@${DO_NADA}
	.else
Index: mk/patch/patch.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/patch/patch.mk,v
retrieving revision 1.18
diff -u -p -T -r1.18 patch.mk
--- mk/patch/patch.mk	17 Mar 2009 21:43:54 -0000	1.18
+++ mk/patch/patch.mk	4 May 2019 18:15:09 -0000
@@ -66,7 +66,7 @@ _PATCH_TARGETS+=	release-patch-lock
	
	.PHONY: patch
	.if !target(patch)
-	.  if exists(${_COOKIE.patch})
+	.  if exists(${_COOKIE.patch}) && !${_CLEANING}
	patch:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -80,7 +80,7 @@ patch: barrier
	acquire-patch-lock: acquire-lock
	release-patch-lock: release-lock
	
-	.if exists(${_COOKIE.patch})
+	.if exists(${_COOKIE.patch}) && !${_CLEANING}
	${_COOKIE.patch}:
		@${DO_NADA}
	.else
Index: mk/tools/bsd.tools.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/tools/bsd.tools.mk,v
retrieving revision 1.58
diff -u -p -T -r1.58 bsd.tools.mk
--- mk/tools/bsd.tools.mk	22 Mar 2019 16:17:50 -0000	1.58
+++ mk/tools/bsd.tools.mk	4 May 2019 18:15:09 -0000
@@ -62,7 +62,7 @@ _TOOLS_TARGETS+=	release-tools-lock
	
	.PHONY: tools
	.if !target(tools)
-	.  if exists(${_COOKIE.tools})
+	.  if exists(${_COOKIE.tools}) && !${_CLEANING}
	tools:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -76,7 +76,7 @@ tools: barrier
	acquire-tools-lock: acquire-lock
	release-tools-lock: release-lock
	
-	.if exists(${_COOKIE.tools})
+	.if exists(${_COOKIE.tools}) && !${_CLEANING}
	${_COOKIE.tools}:
		@${DO_NADA}
	.else
Index: mk/wrapper/bsd.wrapper.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/wrapper/bsd.wrapper.mk,v
retrieving revision 1.100
diff -u -p -T -r1.100 bsd.wrapper.mk
--- mk/wrapper/bsd.wrapper.mk	22 Aug 2018 20:48:37 -0000	1.100
+++ mk/wrapper/bsd.wrapper.mk	4 May 2019 18:15:09 -0000
@@ -54,7 +54,7 @@ PREPEND_PATH+=		${WRAPPER_BINDIR}
	###
	### BEGIN: after the barrier
	###
-	.if exists(${_COOKIE.barrier})
+	.if exists(${_COOKIE.barrier}) && !${_CLEANING}
	
	_WRAPPER_DEBUG?=	no
	CONFIGURE_ENV+=		WRAPPER_DEBUG=${_WRAPPER_DEBUG:Q}
@@ -708,7 +708,7 @@ _COOKIE.wrapper=	${WRKDIR}/.wrapper_done
	
	.PHONY: wrapper
	.if !target(wrapper)
-	.  if exists(${_COOKIE.wrapper})
+	.  if exists(${_COOKIE.wrapper}) && !${_CLEANING}
	wrapper:
		@${DO_NADA}
	.  elif defined(_PKGSRC_BARRIER)
@@ -722,7 +722,7 @@ wrapper: barrier
	acquire-wrapper-lock: acquire-lock
	release-wrapper-lock: release-lock
	
-	.if exists(${_COOKIE.wrapper})
+	.if exists(${_COOKIE.wrapper}) && !${_CLEANING}
	${_COOKIE.wrapper}:
		@${DO_NADA}
	.else


Home | Main Index | Thread Index | Old Index