packmanager

package
v0.5.2-112-g1b0d4b3 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: BSD-3-Clause Imports: 9 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, opts ...any) 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 NewManagerConstructor added in v0.5.0

type NewManagerConstructor func(context.Context, ...any) (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 PackArgs added in v0.5.2

func PackArgs(args ...string) PackOption

PackArgs sets the arguments to be passed to the application.

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) Args added in v0.5.2

func (popts *PackOptions) Args() []string

Args returns the arguments to pass to the kernel.

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, ...QueryOption) ([]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, ...QueryOption) (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 Query added in v0.6.0

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

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

func NewQuery added in v0.6.0

func NewQuery(qopts ...QueryOption) *Query

NewQuery returns the finalized query given the provided options.

func (*Query) Auths added in v0.6.0

func (query *Query) Auths() map[string]config.AuthConfig

Auth returns authentication configuration for a given domain or nil if the domain does not have (or require) any authentication.

func (*Query) Fields added in v0.6.0

func (query *Query) Fields() map[string]interface{}

func (*Query) Name added in v0.6.0

func (query *Query) Name() string

Name specifies the name of the package

func (*Query) Source added in v0.6.0

func (query *Query) Source() string

Source specifies where the origin of the package

func (Query) String added in v0.6.0

func (cq Query) String() string

func (*Query) Types added in v0.6.0

func (query *Query) Types() []unikraft.ComponentType

Types specifies the associated list of possible types for the package

func (*Query) UseCache added in v0.6.0

func (query *Query) UseCache() bool

UseCache indicates whether the package manager should use any existing cache.

func (*Query) Version added in v0.6.0

func (query *Query) Version() string

Version specifies the version of the package

type QueryOption added in v0.6.0

type QueryOption func(*Query)

QueryOption is a method-option which sets a specific query parameter.

func WithAuthConfig added in v0.6.0

func WithAuthConfig(auths map[string]config.AuthConfig) QueryOption

WithAuthConfig sets the the required authorization for when making the query.

func WithCache added in v0.6.0

func WithCache(useCache bool) QueryOption

WithCache sets whether to use local caching when making the query.

func WithName added in v0.6.0

func WithName(name string) QueryOption

WithName sets the query parameter for the name of the package.

func WithSource added in v0.6.0

func WithSource(source string) QueryOption

WithSource sets the query parameter for the origin source of the package.

func WithTypes added in v0.6.0

func WithTypes(types ...unikraft.ComponentType) QueryOption

WithTypes sets the query parameter for the specific Unikraft types to search for.

func WithVersion added in v0.6.0

func WithVersion(version string) QueryOption

WithVersion sets the query parameter for the version of the package.

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