7064724 userland should deliver a consolidation incorporation
authorNorm Jacobs <Norm.Jacobs@Oracle.COM>
Mon, 29 Aug 2011 21:35:26 -0700
changeset 500 3d451539794b
parent 499 fea5d407097b
child 501 3cac4bd957e8
7064724 userland should deliver a consolidation incorporation 7083577 php build doesn't completely 'clean' up after itself
components/Makefile
components/php-5_2/Makefile
tools/userland-incorporator
--- a/components/Makefile	Mon Aug 29 19:48:54 2011 -0700
+++ b/components/Makefile	Mon Aug 29 21:35:26 2011 -0700
@@ -113,6 +113,13 @@
 
 publish:
 	$(PKGREPO) rebuild -s $(PKG_REPO)
+	$(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
+	  -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)-incorporation@0.$(OS_VERSION),$(BUILD_VERSION) \
+	  -s "$(CONSOLIDATION) consolidation incorporation" \
+	  -d "This incorporation constrains packages from the $(CONSOLIDATION) consolidation" \
+	  -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
+	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
+	  $(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
 # pkglint all of the published manifests in one batch.
 ifdef CANONICAL_REPO
 	@echo 'pkglinting all package manifests...'
--- a/components/php-5_2/Makefile	Mon Aug 29 19:48:54 2011 -0700
+++ b/components/php-5_2/Makefile	Mon Aug 29 21:35:26 2011 -0700
@@ -157,6 +157,7 @@
 download prep install test publish: $(SUBDIRS)
 
 clean:		$(SUBDIRS)
+	$(RM) -r $(BUILD_DIR)
 
 clobber:	$(SUBDIRS) clean
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/userland-incorporator	Mon Aug 29 21:35:26 2011 -0700
@@ -0,0 +1,91 @@
+#!/usr/bin/perl
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+#
+# incorporator - an utility to incorporate packages in a repo
+#
+
+use Getopt::Long;
+
+sub enumerate_packages {
+	local ($repository, @fmris) = @_;
+        my @packages = ();
+
+	#printf "/usr/bin/pkg list -ng $repository @fmris\n";
+	open($fp, "-|", "/usr/bin/pkg", "list", "-ng", $repository, @fmris) ||
+                  die "pkg: $!";
+	while (<$fp>) {
+
+		if (/^(\S+)\s\((\S+)\)\s+([\d.]+)-([\d.]+)\s+...$/) {
+			my ($package) = ();
+
+			$package->{name} = $1;
+			$package->{publisher} = $2;
+			$package->{version} = $3;
+			$package->{branch} = $4;
+
+			push(@packages, $package);
+		}
+	}
+
+	#printf "returning %s\n", $_->{name} for (@packages);
+
+	return @packages;
+}
+
+sub print_incorporate {
+	local (%package) = @_;
+	my $facet = "facet.version-lock.$package->{name}";
+
+	printf "depend fmri=%s@%s-%s %s=true type=incorporate\n",
+		$package->{name}, $package->{version}, $package->{branch},
+		$facet;
+}
+
+my ($repository, $fmri, $summary, $description, $consolidation) = ();
+
+$consolidation = 'userland';
+
+GetOptions("R|repository=s" => \$repository, "v|version=s" => \$version,
+	   "s|summary=s" => \$summary, "d|description=s" => \$description,
+	   "p|package=s" => \$fmri, "f|fmri=s" => \@fmris,
+	   "c|consolidation=s" => \$consolidation);
+
+#
+# print the incorporation
+#
+printf "set name=pkg.fmri value=%s\n", $fmri;
+printf "set name=pkg.summary value='%s'\n", $summary;
+printf "set name=pkg.description value='%s'\n", $description;
+printf "set name=org.opensolaris.consolidation value=%s\n",
+		$consolidation;
+printf "set name=pkg.depend.install-hold value=core-os.%s\n",
+		$consolidation;
+printf "set name=info.classification value='org.opensolaris.category.2008:Meta Packages/Incorporations'\n";
+
+@packages = enumerate_packages($repository, @fmris);
+for (@packages) {
+	printf "depend fmri=pkg:/%s@%s-%s %s=true type=incorporate\n",
+		%$_->{name}, %$_->{version}, %$_->{branch},
+		"facet.version-lock.".%$_->{name};
+}