packmanager

package
v0.5.1-19-g7ccf18b Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2023 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Overview

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file expect in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors. Licensed under the BSD-3-Clause License (the "License"). You may not use this file except in compliance with the License.

Index

Constants

View Source
const UmbrellaFormat pack.PackageFormat = "umbrella"

Variables

View Source
var (
	// G is an alias for FromContext.
	//
	// We may want to define this locally to a package to get package tagged
	// package manager.
	G = FromContext

	// PM is the system-access umbrella package manager.
	PM = umbrella{}
)

Functions

func PackageManagers

func PackageManagers() map[pack.PackageFormat]PackageManager

func RegisterPackageManager

func RegisterPackageManager(ctxk pack.PackageFormat, constructor NewManagerConstructor) error

func WithPackageManager added in v0.2.0

func WithPackageManager(ctx context.Context, pm PackageManager) context.Context

WithPackageManager returns a new context with the provided package manager.

Types

type CatalogQuery

type CatalogQuery struct {
	// Source specifies where the origin of the package
	Source string

	// Types specifies the associated list of possible types for the package
	Types []unikraft.ComponentType

	// Name specifies the name of the package
	Name string

	// Version specifies the version of the package
	Version string

	// NoCache forces the package manager to update values in-memory without
	// interacting with any underlying cache
	NoCache bool
}

CatalogQuery is the request structure with associated attributes which are used to search the package manager's catalog

func (CatalogQuery) String

func (cq CatalogQuery) String() string

type NewManagerConstructor added in v0.5.0

type NewManagerConstructor func(context.Context) (PackageManager, error)

NewManagerConstructor represents the prototype that all implementing package managers must use during their instantiation. This standardizes their input and output during "construction", particularly providing access to a referencable context with which they can access (within the context of KraftKit) the logging, IOStreams and Config subsystems.

type PackOption added in v0.4.0

type PackOption func(*PackOptions)

PackOption is an option function which is used to modify PackOptions.

func PackAppSourceFiles added in v0.4.0

func PackAppSourceFiles(pack bool) PackOption

PackAppSourceFiles marks to include application source files

func PackInitrd added in v0.4.0

func PackInitrd(initrd string) PackOption

PackInitrd includes the provided path to an initrd file in the package.

func PackKConfig added in v0.4.0

func PackKConfig(kconfig bool) PackOption

PackKConfig marks to include the kconfig `.config` file into the package.

func PackKernelLibraryIntermediateObjects added in v0.4.0

func PackKernelLibraryIntermediateObjects(pack bool) PackOption

PackKernelLibraryIntermediateObjects marks to include intermediate library object files, e.g. libnolibc/errno.o

func PackKernelLibraryObjects added in v0.4.0

func PackKernelLibraryObjects(pack bool) PackOption

PackKernelLibraryObjects marks to include library object files, e.g. nolibc.o

func PackKernelSourceFiles added in v0.4.0

func PackKernelSourceFiles(pack bool) PackOption

PackKernelSourceFiles marks that all source files which make up the build from the Unikraft build side are to be included. Including these files will enable a reproducible build.

func PackOutput added in v0.4.0

func PackOutput(output string) PackOption

PackOutput sets the location of the output artifact package.

func PackWithKernelVersion added in v0.5.0

func PackWithKernelVersion(version string) PackOption

PackWithKernelVersion sets the version of the Unikraft core.

type PackOptions added in v0.4.0

type PackOptions struct {
	// contains filtered or unexported fields
}

PackOptions contains the list of options which can be set when packaging a component.

func (*PackOptions) Initrd added in v0.4.0

func (popts *PackOptions) Initrd() string

Initrd returns the path of the initrd file that should be packaged.

func (*PackOptions) KernelVersion added in v0.5.0

func (popts *PackOptions) KernelVersion() string

KernelVersion returns the version of the kernel

func (*PackOptions) Output added in v0.4.0

func (popts *PackOptions) Output() string

Output returns the location of the package.

func (*PackOptions) PackAppSourceFiles added in v0.4.0

func (popts *PackOptions) PackAppSourceFiles() bool

PackAppSourceFiles returns whether the application source files should be packaged.

func (*PackOptions) PackKConfig added in v0.4.0

func (popts *PackOptions) PackKConfig() bool

PackKConfig returns whether the .config file should be packaged.

func (*PackOptions) PackKernelLibraryIntermediateObjects added in v0.4.0

func (popts *PackOptions) PackKernelLibraryIntermediateObjects() bool

PackKernelLibraryIntermediateObjects returns whether to package intermediate kernel library object files.

func (*PackOptions) PackKernelLibraryObjects added in v0.4.0

func (popts *PackOptions) PackKernelLibraryObjects() bool

PackKernelLibraryObjects returns whether to package kernel library objects.

func (*PackOptions) PackKernelSourceFiles added in v0.4.0

func (popts *PackOptions) PackKernelSourceFiles() bool

PackKernelSourceFiles returns the whether to package kernel source files.

type PackageManager

type PackageManager interface {
	// Update retrieves and stores locally a cache of the upstream registry.
	Update(context.Context) error

	// Pack turns the provided component into the distributable package.  Since
	// components can comprise of other components, it is possible to return more
	// than one package.  It is possible to disable this and "flatten" a component
	// into a single package by setting a relevant `pack.PackOption`.
	Pack(context.Context, component.Component, ...PackOption) ([]pack.Package, error)

	// Unpack turns a given package into a usable component.  Since a package can
	// compromise of a multiple components, it is possible to return multiple
	// components.
	Unpack(context.Context, pack.Package, ...UnpackOption) ([]component.Component, error)

	// Catalog returns all packages known to the manager via given query
	Catalog(context.Context, CatalogQuery) ([]pack.Package, error)

	// Add a source to the package manager
	AddSource(context.Context, string) error

	// Remove a source from the package manager
	RemoveSource(context.Context, string) error

	// IsCompatible checks whether the provided source is compatible with the
	// package manager
	IsCompatible(context.Context, string) (PackageManager, bool, error)

	// From is used to retrieve a sub-package manager.  For now, this is a small
	// hack used for the umbrella.
	From(pack.PackageFormat) (PackageManager, error)

	// Format returns the name of the implementation.
	Format() pack.PackageFormat
}

func FromContext added in v0.2.0

func FromContext(ctx context.Context) PackageManager

FromContext returns the package manager in the context, or access to the umbrella package manager which iterates over all registered package managers.

func NewUmbrellaManager added in v0.4.0

func NewUmbrellaManager(ctx context.Context) (PackageManager, error)

NewUmbrellaManager returns a `PackageManager` which can be used to manipulate multiple `PackageManager`s. The purpose is to be able to package, unpackage, search and generally manipulate packages of multiple types simultaneously.

type UnpackOption added in v0.4.0

type UnpackOption func(*UnpackOptions) error

UnpackOption is an option function which is used to modify UnpackOptions.

func WithUnpackWorkdir added in v0.4.0

func WithUnpackWorkdir(workdir string) UnpackOption

WithUnpackWorkdir sets the directory to unpack the package to

type UnpackOptions added in v0.4.0

type UnpackOptions struct {
	// contains filtered or unexported fields
}

UnpackOptions contains the list of options which can be used to unpackage an a component.

Jump to

Keyboard shortcuts

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