packer

package
v2.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package packer provides unified package building interface for multiple formats.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CrossDepsExtractor

type CrossDepsExtractor interface {
	DownloadAndExtractCrossDeps(ctx context.Context, deps []string, targetArch string) error
}

CrossDepsExtractor is implemented by builders that support downloading and extracting cross-build runtime dependencies without registering them in the package database. This avoids circular dependency conflicts between arch-all meta-packages and their arch-specific transitive dependencies.

type InstallOrExtractor

type InstallOrExtractor interface {
	InstallOrExtract(artifactsPath, buildDir, targetArch string) error
}

InstallOrExtractor is implemented by package builders that extract built artifacts to the root filesystem (/) so that dependent packages can resolve headers and libraries.

type Packer

type Packer interface {
	// BuildPackage starts the package building process and writes the final artifact
	// to the specified output path. It returns the path to the built artifact and an error
	// if any issues occur during the build.
	BuildPackage(ctx context.Context, output string, targetArch string) (string, error)
	// Prepare appends the dependencies required to build all the projects. It
	// returns any error if encountered.
	Prepare(ctx context.Context, depends []string, targetArch string) error
	// PrepareEnvironment reads a flag to install golang tools on request, on the
	// build machine. It returns any error if encountered.
	PrepareEnvironment(ctx context.Context, flag bool, targetArch string) error
	// PrepareFakeroot sets up the environment for building the final artifact in a fakeroot context.
	// It takes an output path where the artifact will be written and returns an error if any issues
	// occur.
	PrepareFakeroot(ctx context.Context, output string, targetArch string) error
	// Update performs a package manager update operation. It returns any error if
	// encountered.
	Update(ctx context.Context) error
}

Packer is the common interface implemented by all package managers.

func GetPackageManager

func GetPackageManager(
	pkgBuild *pkgbuild.PKGBUILD,
	distro string,
	compressionDeb string,
	compressionRpm string,
) (Packer, error)

GetPackageManager returns a Packer interface based on the given package build and distribution.

pkgBuild: A pointer to a pkgbuild.PKGBUILD struct. distro: A string representing the distribution. compressionDeb: Compression algorithm for DEB packages (empty string uses default). compressionRpm: Compression algorithm for RPM packages (empty string uses default). Returns a Packer interface and an error if any issues occur.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL