pkg

package
v0.0.0-...-5918e99 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package pkg provides package management implementations.

Package management

This library abstracts the details of different package managers in order to allow the tool to remain agnostic. Each package manager implementation follows a specific contract through the Manager interface.

Usage

Using a package manager instance is as simple as gaining a reference to it, via the NewPackageManager method.

manager, err := pkg.NewManager(pkg.PackageManagerEopkg)

Placement in the lifecycle

The package manager instance is only called upon after the initial root filesystem has been initialised by the Builder. During this time, every method of the API will be called. Implementations should not expect longevity, as soon as the operation set has been completed, the rootfs is then finalized ready for packing in whichever form is most appropriate to the builder.

Index

Constants

View Source
const (
	// EopkgCacheDirectory is where we'll bind mount to provide package caching
	// to speed up subsequent image builds.
	// This will be mounted at $rootfs/var/cache/eopkg/packages.
	// It uses the evobuild directory for consistency with evobuild, so that
	// Solus developers only need one cache system wide.
	EopkgCacheDirectory = "/var/lib/evobuild/packages"
)

Variables

View Source
var (
	// ErrNotYetImplemented is a placeholder until eopkg implementation is done
	ErrNotYetImplemented = errors.New("Not yet implemented!")
)

Functions

This section is empty.

Types

type EopkgManager

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

EopkgManager is used to apply operations with the eopkg package manager for Solus systems.

func NewEopkgManager

func NewEopkgManager() *EopkgManager

NewEopkgManager will return a newly initialised EopkgManager

func (*EopkgManager) AddRepo

func (e *EopkgManager) AddRepo(identifier, uri string) error

AddRepo will add the new eopkg repo to the target

func (*EopkgManager) Cleanup

func (e *EopkgManager) Cleanup() error

Cleanup will cleanup the rootfs at any given point

func (*EopkgManager) FinalizeRoot

func (e *EopkgManager) FinalizeRoot() error

FinalizeRoot will configure all of the eopkgs installed in the system, and ensure that dbus, etc, works.

func (*EopkgManager) Init

func (e *EopkgManager) Init() error

Init will check that eopkg is available host side

func (*EopkgManager) InitRoot

func (e *EopkgManager) InitRoot(root string) error

InitRoot will set up the filesystem root in accordance with eopkg needs

func (*EopkgManager) InstallGroups

func (e *EopkgManager) InstallGroups(ignoreSafety bool, groups []string) error

InstallGroups will install the named eopkg components to the target

func (*EopkgManager) InstallPackages

func (e *EopkgManager) InstallPackages(ignoreSafety bool, packages []string) error

InstallPackages will install the named eopkgs to the target

func (*EopkgManager) SetCacheDirectory

func (e *EopkgManager) SetCacheDirectory(source string)

SetCacheDirectory is used to override the system cache directory

type Manager

type Manager interface {

	// Init will allow implementations to initialise themselves assuming that
	// host-side dependencies need to be met.
	Init() error

	// InitRoot implementations should set up the root filesystem to handle any
	// quirks prior to installing packages. This also allows manipulating the
	// filesystem layout, i.e. for usr-merge situations, or for working around
	// default directories created by a host-side package manager tool.
	InitRoot(root string) error

	// FinalizeRoot should be invoked once all packaging operations have been applied,
	// allowing any post configuration, etc, to take place.
	FinalizeRoot() error

	// InstallPackages will ask the package manager implementation to install the
	// given package set.
	// ignoreSafety is dependent on the package manager, but is usually used to
	// avoid automatic dependencies such as system.base in Solus, or recommends
	// in dpkg.
	InstallPackages(ignoreSafety bool, packages []string) error

	// InstallGroups will ask the package manager implementation to install the
	// given groups (components in some distros)
	// ignoreSafety is dependent on the package manager, but is usually used to
	// avoid automatic dependencies such as system.base in Solus, or recommends
	// in dpkg.
	InstallGroups(ignoreSafety bool, groups []string) error

	// AddRepo asks the package manager to add the given repository to the system
	AddRepo(identifier, uri string) error

	// Cleanup may be called at any time, and the package manager implementation
	// should ensure it cleans anything it did in the past, such as closing open
	// processes.
	Cleanup() error
}

Manager is the interface that should be implemented by vendors to enable USpin to understand them and construct images according to their particulars.

func NewManager

func NewManager(name PackageManager) (Manager, error)

NewManager will return an appropriate package manager instance for the given name, if it exists.

type PackageManager

type PackageManager string

PackageManager is the type of pkg.Manager that is to be used for packaging operations. This type is built-in as there is only a limited set of supported package managers at any time.

const (
	// PackageManagerEopkg is the package manager used within Solus
	PackageManagerEopkg PackageManager = "eopkg"
)

Jump to

Keyboard shortcuts

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