25815962 components/Makefile should have pkglint target
authorJohn Beck <John.Beck@Oracle.COM>
Tue, 04 Apr 2017 13:32:28 -0700
changeset 7835 20c33a4fd225
parent 7834 4c899d201870
child 7836 2d73177c07ee
25815962 components/Makefile should have pkglint target
components/Makefile
doc/makefile-variables.txt
make-rules/environment.mk
make-rules/ips.mk
make-rules/shared-macros.mk
--- a/components/Makefile	Tue Apr 04 13:18:05 2017 -0700
+++ b/components/Makefile	Tue Apr 04 13:32:28 2017 -0700
@@ -86,7 +86,7 @@
 
 # turn off pkglint for the individual component builds.
 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
-publish:		MAKEFLAGS += PKGLINT=/bin/true
+publish:		MAKEFLAGS += PKGLINTVAR=/bin/true
 endif
 
 # In order to work around an IPS simultaneous publication issue and to improve
@@ -119,7 +119,6 @@
 	$(RM) -r $(WS_REPO) $(WS_HOME) $(WS_LOGS) $(WS_LINT_CACHE) \
 	    $(shell find . -name 'manifest-*.published')
 
-
 setup:	$(WS_MACH) $(WS_LOGS) $(WS_HOME) $(WS_REPO) tools $(WS_LINT_CACHE)
 
 $(WS_MACH) $(WS_LOGS) $(WS_HOME):
@@ -138,7 +137,7 @@
 $(WS_LINT_CACHE):	$(WS_LOGS) tools
 ifdef CANONICAL_REPO
 	@echo "Generating pkglint(1) cache from CANONICAL_REPO $(CANONICAL_REPO)..."
-	@(echo $(DUMMYPKG) | $(PKGLINT) \
+	@(echo $(DUMMYPKG) | $(PKGLINTVAR) \
 		-c $(WS_LINT_CACHE) -r $(CANONICAL_REPO) /dev/fd/0 \
 		>$(WS_LOGS)/naughty-canonical-repo-actions 2>&1 || \
 		( echo "pkglint(1) failed, please see $(WS_LOGS)/naughty-canonical-repo-actions"; \
@@ -172,6 +171,16 @@
 	               $${incorporation} ; \
 	done
 
+# Use PKGLINT below instead of PKGLINTVAR because we know we always want the
+# real one for this set of rules.
+pkglint:
+	@echo 'pkglinting all package manifests...'
+	@$(ENV) PYTHONPATH=$(WS_TOOLS)/python \
+			SOLARIS_VERSION=$(SOLARIS_VERSION) \
+			$(PKGLINT) \
+			-c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
+			$(shell find . -name 'manifest-*.published')
+
 publish:
 	$(PKGREPO) refresh -s $(PKG_REPO)
 # The package below is obsolete in S12/11.4, but cannot yet be removed from
@@ -189,12 +198,7 @@
 endif
 # pkglint all of the published manifests in one batch.
 ifdef CANONICAL_REPO
-	@echo 'pkglinting all package manifests...'
-	@$(ENV) PYTHONPATH=$(WS_TOOLS)/python \
-			SOLARIS_VERSION=$(SOLARIS_VERSION) \
-			$(PKGLINT) \
-			-c $(WS_LINT_CACHE) -f $(WS_TOOLS)/pkglintrc \
-			$(shell find . -name 'manifest-*.published')
+	$(MAKE) pkglint
 endif
 
 $(COMPONENT_DIRS.nosetup):	$(WS_LOGS) FORCE
--- a/doc/makefile-variables.txt	Tue Apr 04 13:18:05 2017 -0700
+++ b/doc/makefile-variables.txt	Tue Apr 04 13:32:28 2017 -0700
@@ -128,8 +128,8 @@
 component by pulling the source from the SCM and creating a tarball from
 the pulled source.  This allows us to automatically store a copy of the
 canonical source that we build from in our source archive cache and not
-continually hammer on the component's SCM repo.  The source archive name
-is automatically generated from the COMPONENT_NAME, COMPONENT_VERSION,
+continually hammer on the SCM repo for that component.  The source archive
+name is automatically generated from the COMPONENT_NAME, COMPONENT_VERSION,
 and {GIT|HG|SVN}_REV values.  Also, the source is archived and unpacked
 in a directory using these values.   You should also define a hash for
 this tarball in your Makefile similar to what you do with downloaded
@@ -346,11 +346,20 @@
   also be before the inclusion of ips.mk.  All variables named after the
   pattern TPNO_% are automatically available for use in package manifests
   and pkgmogrify transform files.
+
 * PKGREPO_REMOVE_BEFORE_PUBLISH allows automatic removal of previously
   published components from PKG_REPO (including obsolete and renamed
   versions). When set as PKGREPO_REMOVE_BEFORE_PUBLISH=yes removal
   occurs immediately prior to pkgsend. default: "no"
 
+* PKGLINT points to the pkglint(1) executable.  PKGLINTVAR points to either
+  PKGLINT or /bin/true depending on the invocation: for individual component
+  builds, we run pkglint at the end of the publish phase.  But for top-down
+  builds, running pkglint for each component would cause locking issues, so
+  we skip that step and run pkglint once at the end.  There is also a pkglint:
+  target in components/Makefile that allows for the direction invocation of
+  this end-of-the-build-pkglint-everything-together step, which makes it much
+  easier to "finish off" a build where a small number of components failed.
 
 ---
 
--- a/make-rules/environment.mk	Tue Apr 04 13:18:05 2017 -0700
+++ b/make-rules/environment.mk	Tue Apr 04 13:32:28 2017 -0700
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
 #
 SUDO =		/usr/bin/sudo
 
@@ -88,7 +88,7 @@
 	$(call separator-line,Build in $(ZONENAME))
 	$(SUDO) /usr/sbin/zlogin -l $${USER} $(ZONENAME) \
 		"cd $(COMPONENT_DIR) ; gmake component-be-check install"
-	#	"cd $(COMPONENT_DIR) ; gmake component-be-check publish PKGLINT=/bin/true"
+	#	"cd $(COMPONENT_DIR) ; gmake component-be-check publish PKGLINTVAR=/bin/true"
 	$(call separator-line,Halt $(ZONENAME))
 	$(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) halt
 	$(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) uninstall -F
--- a/make-rules/ips.mk	Tue Apr 04 13:18:05 2017 -0700
+++ b/make-rules/ips.mk	Tue Apr 04 13:32:28 2017 -0700
@@ -425,7 +425,7 @@
 	@echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
 	$(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
 		SOLARIS_VERSION=$(SOLARIS_VERSION)\
-		$(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
+		$(PKGLINTVAR) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
 			-f $(WS_TOOLS)/pkglintrc $(RESOLVED)
 	$(TOUCH) $@
 
@@ -433,7 +433,7 @@
 	@echo "VALIDATING MANIFEST CONTENT: $(RESOLVED)"
 	$(ENV) PYTHONPATH=$(WS_TOOLS)/python PROTO_PATH="$(PKG_PROTO_DIRS)"\
 		SOLARIS_VERSION=$(SOLARIS_VERSION)\
-		$(PKGLINT) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
+		$(PKGLINTVAR) $(CANONICAL_REPO:%=-c $(WS_LINT_CACHE)) \
 			-f $(WS_TOOLS)/pkglintrc $(RESOLVED)
 
 FRC:
--- a/make-rules/shared-macros.mk	Tue Apr 04 13:18:05 2017 -0700
+++ b/make-rules/shared-macros.mk	Tue Apr 04 13:32:28 2017 -0700
@@ -705,10 +705,11 @@
 PKGREPO =	/usr/bin/pkgrepo
 PKGSEND =	/usr/bin/pkgsend
 PKGMOGRIFY =	/usr/bin/pkgmogrify
+PKGLINT =	/usr/bin/pkglint
 ifeq   ($(strip $(PKGLINT_COMPONENT)),)
-PKGLINT =	/usr/bin/pkglint
+PKGLINTVAR =	$(PKGLINT)
 else
-PKGLINT =	${WS_TOOLS}/pkglint
+PKGLINTVAR =	${WS_TOOLS}/pkglint
 endif
 
 ACLOCAL =	/usr/bin/aclocal-1.10