4811N/A# If invoked with -v FUNCTION=name, then just print $1 (s|/|---|).
4811N/A# Otherwise we expect to be invoked with TARGET=<whatever>, then if
4811N/A# s|/|---| on $1 matches TARGET, we generate a manifest.
4811N/A{
4811N/A if (substr($1, 1, 1) == "#") { # Skip comments.
4811N/A continue
4811N/A }
4811N/A fmri=$1
4811N/A split(fmri, a, "@")
4811N/A gsub("/", "---", a[1])
4811N/A target = sprintf("%s.p5m", a[1])
4811N/A if (FUNCTION == "name") {
4811N/A printf "%s\n", target
4811N/A continue
4811N/A }
4811N/A if (target != TARGET) {
4811N/A continue
4811N/A }
4811N/A printf "set name=pkg.fmri value=pkg:/%s\n", fmri
5569N/A if ($NF ~ /^incorporate=/) {
5569N/A incorporate=$NF;
5569N/A NF--;
5569N/A }
4811N/A if (NF == 2) {
4811N/A print "set name=pkg.renamed value=true"
4811N/A printf "depend type=require fmri=%s\n", $2
4811N/A } else {
4811N/A print "set name=pkg.obsolete value=true"
4811N/A }
5569N/A if (incorporate) {
5569N/A printf "set name=org.opensolaris.consolidation %s value=$(CONSOLIDATION)\n",
5569N/A incorporate
5569N/A } else {
5569N/A print "set name=org.opensolaris.consolidation value=$(CONSOLIDATION)"
5569N/A }
4811N/A exit 0 # We're done; no point continuing.
4811N/A}