Documentation
¶
Index ¶
- func ArchMap(format, goarch string) string
- func Build(pkg *spec.Packaging, opts BuildOptions) ([]string, error)
- func BuildInfo(pkg *spec.Packaging, format string, opts BuildOptions) (*nfpm.Info, error)
- func FamilyNames(pkg *spec.Packaging) []string
- func InjectOptDepends(path string, optDepends map[string]string) error
- func LoadPackaging(path string) (*spec.Packaging, error)
- func ParsePackaging(data []byte) (*spec.Packaging, error)
- func PluginDepends(pluginsDir string, plugins []string, nfpmFormat, osID string) ([]string, error)
- func ResolveVariant(pkg *spec.Packaging, format, variant string) (name string, v *spec.PackagingVariant, err error)
- func VariantNames(pkg *spec.Packaging) []string
- type BuildOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(pkg *spec.Packaging, opts BuildOptions) ([]string, error)
Build builds the requested formats for one (variant, arch) and returns the written package file paths. Formats defaults to all registered nFPM formats.
func BuildInfo ¶
BuildInfo constructs the nfpm.Info for one (format, variant) from the packaging section + the build options. A variant naming a plugin absent from the plugins dir fails loudly (R4 — never a silently-dropped plugin).
func FamilyNames ¶ added in v0.2026279.2204
FamilyNames returns every package name the packaging section produces, sorted. It is the input the nFPM config uses to declare the family's mutual Provides/Conflicts: every variant installs the SAME paths, so the family members are mutually-exclusive packages over a shared file set, with the base name provided by whichever member is installed and no Replaces between them (a mutual replace makes `-Syu` unresolvable — see nfpm_config.go).
func InjectOptDepends ¶
InjectOptDepends rewrites a .pkg.tar.zst in place, injecting the optdepends into its .PKGINFO. A no-op when optDepends is empty.
func LoadPackaging ¶
LoadPackaging reads the `packaging:` section from a charly.yml on disk.
func ParsePackaging ¶
ParsePackaging parses the `packaging:` section from charly.yml bytes. A candy charly.yml is `candy-name: {candy: {…}}` — the candy name is dynamic, so the parser walks the top-level keys and returns the first `candy.packaging` block.
The document is decoded into a yaml.Node rather than a map[string]struct{…} because a REAL candy charly.yml carries a top-level `version: <calver>` SCALAR alongside the `candy:` map. Unmarshalling the whole document into a typed map fails on that scalar before ever reaching the candy body, so `charly generate-packages` errored on every real candy. Walking the node lets a top-level scalar be tolerated while the `candy:` map is decoded into the CUE-generated spec.Packaging type.
func PluginDepends ¶ added in v0.2026336.1151
PluginDepends returns, in first-seen order without duplicates, the OS packages the listed plugins declare for one nFPM format, resolved for the OS family osID.
The resolution is the candy package cascade: a candy's top `package:` list, then its format-level `distro:` section (deb/rpm/pac/apk), then its section for osID. osID may be empty: then only the OS-agnostic declarations apply, and a plugin that declares an OS-level section FAILS the call by name — its packages would otherwise be dropped silently. Every listed plugin's candy is read for every format; a missing candy, or a section that carries anything a package Depends cannot express (repo, copr, options, exclude, module), fails loudly. An nFPM format no candy can declare packages for (msix) then contributes nothing.
Only the plugin candy's OWN package declarations count: D-CANDY-6 makes a plugin candy's `package:`/`os_override:` the statement of "the OS packages the plugin needs in order to run". The candies it composes (`require:`, inner candies) are image composition, not that statement, so they do not enter the union.
func ResolveVariant ¶
func ResolveVariant(pkg *spec.Packaging, format, variant string) (name string, v *spec.PackagingVariant, err error)
ResolveVariant returns the package name and the variant for a (format, variant) pair. variant == "" selects the variant keyed by the packaging name. The format must be one the section builds (a `formats` entry).
func VariantNames ¶
VariantNames returns the variant keys, the one keyed by the packaging name first and the rest sorted. The distro workflows loop over them.
Types ¶
type BuildOptions ¶
type BuildOptions struct {
Binary string // the charly binary to package
PluginsDir string // the plugins dir to package
Version string // the CalVer
Release string // the package release (pkgrel) for a REPUBLISH; "" keeps nFPM's own naming (no suffix for deb, -1 for rpm/archlinux)
Arch string // GOARCH name (amd64/arm64)
Variant string // the variant name ("" = the format's default)
OS string // the target OS family the variant plugins' packages resolve for ("" = OS-agnostic declarations only, see PluginDepends)
Formats []string // the nFPM formats to build
Out string // the output dir
SigningKey string // deb/rpm GPG key file (passphrase via NFPM_PASSPHRASE)
MSIXPFX string // msix PFX cert file (passphrase via NFPM_MSIX_PASSPHRASE)
MSIXLogo string // msix logo file (required by the msix packager)
}
BuildOptions is the input to a package build: the binary + plugins to package, the version/arch/variant, the formats, and the signing keys.