I got curious and investigated a bit. I must first admit that the contents of this post are purely speculation as a result of experimentation and looking at makefile fragments and
pkg-create(8). If you need more authoritative information, you're likely going to need to review the C source for
ports-mgmt/pkg. The lack of additional documentation is probably because some implementation details are subject to change; perhaps
pkg-create(8) will one day switch to TOML or some other file format in the future for example.
A package consists of two JSON files named
+COMPACT_MANIFEST and
+MANIFEST (in that order), followed by the actual files installed by the package. If you're wondering why there are two manifest files inside a package, consider the fact that some packages install hundreds or even thousands of files;
x11-themes/flat-remix-icon-themes has a
pkg-plist that is 322236 lines long for example! If using
pkg-rquery(8) over a slow network connection, that's potentially a significant waste of time and resources for the server sending unneeded information. That is one possible reason why
pkg-rquery(8) cannot fetch a list of files and also why
+COMPACT_MANIFEST is written to the archive first, though that is once again mere speculation on my part since I have not reviewed the C source.
Further digging seems to indicate that
pkg-create(8) is responsible for creating those manifest files, but they are actually generated from other input files. As confusing as it may be, one of those input files is also named
+MANIFEST. It's easier to see an example of that input file than for me to describe it, so below is the one generated by the default config for
ports-mgmt/poudriere. Compare the contents with "MANIFEST FILE DETAILS" in
pkg-create(8):
Code:
sh$ make -C /usr/ports/ports-mgmt/poudriere 'WRKDIR=/tmp/poudriere-work' create-manifest
sh$ cat /tmp/poudriere-work/.metadir/+MANIFEST
name: "poudriere"
version: "3.3.6"
origin: ports-mgmt/poudriere
comment: <<EOD
Port build and test system
EOD
maintainer: bdrewery@FreeBSD.org
prefix: /usr/local
categories: [ ports-mgmt, ]
licenselogic: single
licenses: [ BSD2CLAUSE, ]
deps: {
"ca_root_nss": {origin: "security/ca_root_nss", version: "3.63"}
"dialog4ports": {origin: "ports-mgmt/dialog4ports", version: "0.1.6"}
"freebsd-release-manifests": {origin: "misc/freebsd-release-manifests", version: "20210413"}
}
options: {
BASH: on,
CERTS: on,
DIALOG4PORTS: on,
EXAMPLES: on,
QEMU: off,
ZSH: on,
}
You might notice how JSON-like that is already.
pkg-create(8) seems to convert that imperfect JSON to valid JSON and combines that with some other information to create the
+COMPACT_MANIFEST file; the
+MANIFEST file included in the package is essentially the same file as
+COMPACT_MANIFEST, except there is some additional information like the list of files installed and installation/deinstallation scripts, and
pkg-repository(5) describes another use for
+MANIFEST files.