changeset 442:7843d118427a

1307 oi-build needs package-install target
author Alasdair Lumsden <al@everycity.co.uk>
date Sun, 31 Jul 2011 17:44:17 +0100
parents c37ad6b4b3b0
children 3ff5ea57dd2b
files make-rules/ips.mk make-rules/shared-macros.mk
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/make-rules/ips.mk	Sun Jul 31 17:43:23 2011 +0100
+++ b/make-rules/ips.mk	Sun Jul 31 17:44:17 2011 +0100
@@ -95,6 +95,7 @@
 DEPENDED=$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend)
 RESOLVED=$(CANONICAL_MANIFESTS:%.p5m=$(MANIFEST_BASE)-%.depend.res)
 PUBLISHED=$(RESOLVED:%.depend.res=%.published)
+PKGINSTALLED=$(PUBLISHED:%.published=%.installed)
 
 COPYRIGHT_FILE ?=	$(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright
 IPS_COMPONENT_VERSION ?=	$(COMPONENT_VERSION)
@@ -109,6 +110,8 @@
 
 publish:		build install $(PUBLISH_STAMP)
 
+package-install:	publish $(BUILD_DIR)/.package-installed
+
 sample-manifest:	$(GENERATED).p5m
 
 $(GENERATED).p5m:	install
@@ -165,6 +168,14 @@
 $(BUILD_DIR)/.published-$(MACH):	$(PUBLISHED)
 	$(TOUCH) $@
 
+$(MANIFEST_BASE)-%.installed:	$(MANIFEST_BASE)-%.published
+	@echo "Installing package from manifest: $<"
+	@export PACKAGEFMRI=`cat $< | $(GSED) ':a;N;$!ba;s/\\\n/ /g' | \
+		grep '^set name=pkg.fmri' | $(GSED) 's/.*value=//g'` && \
+		echo "Installing package $$PACKAGEFMRI" && \
+		$(PRIV_CMD) pkg install -v $$PACKAGEFMRI
+	$(TOUCH) $@
+
 print-package-names:	canonical-manifests
 	@cat $(CANONICAL_MANIFESTS) $(WS_TOP)/transforms/print-pkgs | \
 		$(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \
@@ -207,5 +218,7 @@
 
 pre-prep:	required-pkgs.mk
 
+$(BUILD_DIR)/.package-installed:	$(PKGINSTALLED)
+	$(TOUCH) $@
 
 CLEAN_PATHS +=	required-pkgs.mk
--- a/make-rules/shared-macros.mk	Sun Jul 31 17:43:23 2011 +0100
+++ b/make-rules/shared-macros.mk	Sun Jul 31 17:44:17 2011 +0100
@@ -51,6 +51,8 @@
 
 ROOT =			/
 
+PRIV_CMD =		sudo
+
 OS_VERSION =		$(shell uname -r)
 SOLARIS_VERSION =	$(OS_VERSION:5.%=2.%)
 BUILD_NUM =		1.1