tools/userland-incorporator
branchs11-update
changeset 2855 576d5a7857b7
parent 830 bb9a661e5885
child 3476 c35c8f1a6df1
--- a/tools/userland-incorporator	Wed Dec 18 04:50:56 2013 -0800
+++ b/tools/userland-incorporator	Wed Dec 18 10:04:53 2013 -0800
@@ -19,7 +19,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
 #
 #
 # incorporator - an utility to incorporate packages in a repo
@@ -38,8 +38,11 @@
 	while (<$fp>) {
 
 		# lines should be in the form:
-		#   publisher   package   [r|o] version,branch:timestamp
-		if (/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+),[\d.]+-([\d.]+):.+$/) {
+		#   publisher   package   [r|o] version,5.12-branch:timestamp
+		# or lines should be in the form:
+		#   publisher   package   [r|o] version-branch:timestamp
+		if ((/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+),[\d.]+-([\d.]+):.+$/) ||
+		   (/^(\S+)\s+(\S+)\s+\S?\s+([\d.]+)-([\d.]+):.+$/)) { 
 			my ($package) = ();
 
 			$package->{publisher} = $1;
@@ -47,9 +50,11 @@
 			$package->{version} = $3;
 			$package->{branch} = $4;
 
-			push(@packages, $package);
+			if ($package->{name} !~ m/incorporation/) {
+				push(@packages, $package);
+			} 
 		} else {
-			printf STDERR "SKIP: %s", $_;
+			die "error: cannot handle: ", $_;
 		}
 	}
 
@@ -68,6 +73,7 @@
 }
 
 my ($repository, $fmri, $summary, $description, $consolidation) = ();
+my %seen = ();
 
 $consolidation = 'userland';
 
@@ -89,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};
+		$_->{name}, $_->{version}, $_->{branch},
+		"facet.version-lock.".$_->{name}; 
+	$seen->{$_->{name}} = 1;
 }