17852021 userland-incorporator should detect duplicate packages
authorMike Sullivan <Mike.Sullivan@Oracle.COM>
Tue, 10 Dec 2013 10:52:20 -0800
changeset 1591 24aca88f3e99
parent 1590 07e597d0017b
child 1592 1b2aaf6ad5a7
17852021 userland-incorporator should detect duplicate packages
components/Makefile
tools/userland-incorporator
--- a/components/Makefile	Tue Dec 10 08:58:01 2013 -0800
+++ b/components/Makefile	Tue Dec 10 10:52:20 2013 -0800
@@ -134,7 +134,7 @@
 	 $(BASS_O_MATIC) $(TEMPLATE_ZONE:%=--template-zone %) \
 			 $(@:%=--component %) --make $(TARGET) $(LOG)
 
-publish:
+incorporation:
 	$(PKGREPO) refresh -s $(PKG_REPO)
 	$(WS_TOOLS)/userland-incorporator --repository $(PKG_REPO) \
 	  -p pkg:/consolidation/$(CONSOLIDATION)/$(CONSOLIDATION)[email protected]$(OS_VERSION),$(BUILD_VERSION) \
@@ -143,7 +143,9 @@
 	  -c $(CONSOLIDATION) >$(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
 	$(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \
 	  $(WS_LOGS)/$(CONSOLIDATION)-incorporation.p5m
-	$(PKGREPO) refresh -s $(PKG_REPO)
+
+publish:
+	$(MAKE) incorporation
 # pkglint all of the published manifests in one batch.
 ifdef CANONICAL_REPO
 	@echo 'pkglinting all package manifests...'
--- a/tools/userland-incorporator	Tue Dec 10 08:58:01 2013 -0800
+++ b/tools/userland-incorporator	Tue Dec 10 10:52:20 2013 -0800
@@ -54,7 +54,7 @@
 				push(@packages, $package);
 			} 
 		} else {
-			die "cannot handle: ", $_;
+			die "error: cannot handle: ", $_;
 		}
 	}
 
@@ -73,6 +73,7 @@
 }
 
 my ($repository, $fmri, $summary, $description, $consolidation) = ();
+my %seen = ();
 
 $consolidation = 'userland';
 
@@ -94,8 +95,13 @@
 printf "set name=info.classification value='org.opensolaris.category.2008:Meta Packages/Incorporations'\n";
 
 @packages = enumerate_packages($repository, $consolidation, @fmris);
+
 for (@packages) {
+	if ($seen->{$_->{name}} == 1) {
+		die "error: duplicate package ", $_->{name};
+	}
 	printf "depend fmri=pkg:/%[email protected]%s-%s %s=true type=incorporate\n",
 		$_->{name}, $_->{version}, $_->{branch},
 		"facet.version-lock.".$_->{name}; 
+	$seen->{$_->{name}} = 1;
 }