Marcel Telka
2024-04-07 1a5c849d0ca5e5c35e5cfd042c09cc9e05480caa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# If invoked with -v FUNCTION=name, then just print $1 (s|/|---|).
# Otherwise we expect to be invoked with TARGET=<whatever>, then if
# s|/|---| on $1 matches TARGET, we generate a manifest.
{
  if (substr($1, 1, 1) == "#") { # Skip comments.
    next
  }
  fmri=$1
  split(fmri, a, "@")
  gsub("/", "---", a[1])
  target = sprintf("%s.p5m", a[1])
  if (FUNCTION == "name") {
    printf "%s\n", target
    next
  }
  if (target != TARGET) {
    next
  }
  printf "set name=pkg.fmri value=pkg:/%s\n", fmri
  
  if (NF == 3 || (NF ==2  && $2 != "noincorporate")) {
    print "set name=pkg.renamed value=true"
    printf "depend type=require fmri=%s\n", $2
  } else {
    print "set name=pkg.obsolete value=true"
  }
  
  if ($NF == "noincorporate") {
    print "set name=pkg.tmp.noincorporate value=true"
  }
  print "set name=org.opensolaris.consolidation value=$(CONSOLIDATION)"
  exit 0 # We're done; no point continuing.
}