packagemanager

package
v0.35.3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 32 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder PackageManager

Builder is used to create a new PackageManager. The builder has methods to load platforms and tools to actually build the PackageManager. Once the PackageManager is built, it cannot be changed anymore.

func NewBuilder

func NewBuilder(indexDir, packagesDir, downloadDir, tempDir *paths.Path, userAgent string) *Builder

NewBuilder returns a new Builder

func (*Builder) Build

func (pmb *Builder) Build() *PackageManager

Build builds a new PackageManager.

func (*Builder) BuildIntoExistingPackageManager

func (pmb *Builder) BuildIntoExistingPackageManager(target *PackageManager)

BuildIntoExistingPackageManager will overwrite the given PackageManager instead of building a new one.

func (*Builder) GetOrCreatePackage

func (pmb *Builder) GetOrCreatePackage(packager string) *cores.Package

GetOrCreatePackage returns the specified Package or creates an empty one filling all the cross-references

func (*Builder) LoadHardware

func (pm *Builder) LoadHardware() []error

LoadHardware read all plaforms from the configured paths

func (*Builder) LoadHardwareForProfile

func (pmb *Builder) LoadHardwareForProfile(p *sketch.Profile, installMissing bool, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) []error

LoadHardwareForProfile load the hardware platforms for the given profile. If installMissing is true then possibly missing tools and platforms will be downloaded and installed.

func (*Builder) LoadHardwareFromDirectories

func (pm *Builder) LoadHardwareFromDirectories(hardwarePaths paths.PathList) []error

LoadHardwareFromDirectories load plaforms from a set of directories

func (*Builder) LoadHardwareFromDirectory

func (pm *Builder) LoadHardwareFromDirectory(path *paths.Path) []error

LoadHardwareFromDirectory read a plaform from the path passed as parameter

func (*Builder) LoadPackageIndex

func (pmb *Builder) LoadPackageIndex(URL *url.URL) error

LoadPackageIndex loads a package index by looking up the local cached file from the specified URL

func (*Builder) LoadPackageIndexFromFile

func (pmb *Builder) LoadPackageIndexFromFile(indexPath *paths.Path) (*packageindex.Index, error)

LoadPackageIndexFromFile load a package index from the specified file

func (*Builder) LoadToolsFromBundleDirectories

func (pm *Builder) LoadToolsFromBundleDirectories(dirs paths.PathList) []error

LoadToolsFromBundleDirectories FIXMEDOC

func (*Builder) LoadToolsFromBundleDirectory

func (pm *Builder) LoadToolsFromBundleDirectory(toolsPath *paths.Path) error

LoadToolsFromBundleDirectory FIXMEDOC

func (*Builder) LoadToolsFromPackageDir

func (pm *Builder) LoadToolsFromPackageDir(targetPackage *cores.Package, toolsPath *paths.Path) []error

LoadToolsFromPackageDir loads a set of tools from the given toolsPath. The tools will be loaded in the given *Package.

type Explorer

type Explorer PackageManager

Explorer is used to query the PackageManager. When used it holds a read-only lock on the PackageManager that must be released when the job is completed.

func (*Explorer) DiscoveryManager

func (pme *Explorer) DiscoveryManager() *discoverymanager.DiscoveryManager

DiscoveryManager returns the DiscoveryManager in use by this PackageManager

func (*Explorer) DownloadAndInstallPlatformAndTools

func (pme *Explorer) DownloadAndInstallPlatformAndTools(
	platformRelease *cores.PlatformRelease, requiredTools []*cores.ToolRelease,
	downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB,
	skipPostInstall bool, skipPreUninstall bool) error

DownloadAndInstallPlatformAndTools runs a full installation process for the given platform and tools. This method takes care of downloading missing archives, installing/upgrading platforms and tools, and removing the previously installed platform/tools that are no longer needed after the upgrade.

func (*Explorer) DownloadAndInstallPlatformUpgrades

func (pme *Explorer) DownloadAndInstallPlatformUpgrades(
	platformRef *PlatformReference,
	downloadCB rpc.DownloadProgressCB,
	taskCB rpc.TaskProgressCB,
	skipPostInstall bool,
	skipPreUninstall bool,
) (*cores.PlatformRelease, error)

DownloadAndInstallPlatformUpgrades runs a full installation process to upgrade the given platform. This method takes care of downloading missing archives, upgrading platforms and tools, and removing the previously installed platform/tools that are no longer needed after the upgrade.

func (*Explorer) DownloadPlatformRelease

func (pme *Explorer) DownloadPlatformRelease(platform *cores.PlatformRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error

DownloadPlatformRelease downloads a PlatformRelease. If the platform is already downloaded a nil Downloader is returned.

func (*Explorer) DownloadToolRelease

func (pme *Explorer) DownloadToolRelease(tool *cores.ToolRelease, config *downloader.Config, progressCB rpc.DownloadProgressCB) error

DownloadToolRelease downloads a ToolRelease. If the tool is already downloaded a nil Downloader is returned. Uses the given downloader configuration for download, or the default config if nil.

func (*Explorer) FindBoardWithFQBN

func (pme *Explorer) FindBoardWithFQBN(fqbnIn string) (*cores.Board, error)

FindBoardWithFQBN returns the board identified by the fqbn, or an error

func (*Explorer) FindBoardsWithID

func (pme *Explorer) FindBoardsWithID(id string) []*cores.Board

FindBoardsWithID FIXMEDOC

func (*Explorer) FindBoardsWithVidPid

func (pme *Explorer) FindBoardsWithVidPid(vid, pid string) []*cores.Board

FindBoardsWithVidPid FIXMEDOC

func (*Explorer) FindDiscoveryDependency

func (pme *Explorer) FindDiscoveryDependency(discovery *cores.DiscoveryDependency) *cores.ToolRelease

FindDiscoveryDependency returns the ToolRelease referenced by the DiscoveryDepenency or nil if the referenced discovery doesn't exists.

func (*Explorer) FindMonitorDependency

func (pme *Explorer) FindMonitorDependency(discovery *cores.MonitorDependency) *cores.ToolRelease

FindMonitorDependency returns the ToolRelease referenced by the MonitorDepenency or nil if the referenced monitor doesn't exists.

func (*Explorer) FindPlatform

func (pme *Explorer) FindPlatform(ref *PlatformReference) *cores.Platform

FindPlatform returns the Platform matching the PlatformReference or nil if not found. The PlatformVersion field of the reference is ignored.

func (*Explorer) FindPlatformRelease

func (pme *Explorer) FindPlatformRelease(ref *PlatformReference) *cores.PlatformRelease

FindPlatformRelease returns the PlatformRelease matching the PlatformReference or nil if not found

func (*Explorer) FindPlatformReleaseDependencies

func (pme *Explorer) FindPlatformReleaseDependencies(item *PlatformReference) (*cores.PlatformRelease, []*cores.ToolRelease, error)

FindPlatformReleaseDependencies takes a PlatformReference and returns a set of items to download and a set of outputs for non existing platforms.

func (*Explorer) FindPlatformReleaseProvidingBoardsWithVidPid

func (pme *Explorer) FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid string) []*cores.PlatformRelease

FindPlatformReleaseProvidingBoardsWithVidPid FIXMEDOC

func (*Explorer) FindToolDependency

func (pme *Explorer) FindToolDependency(dep *cores.ToolDependency) *cores.ToolRelease

FindToolDependency returns the ToolRelease referenced by the ToolDependency or nil if the referenced tool doesn't exists.

func (*Explorer) FindToolsRequiredForBuild

func (pme *Explorer) FindToolsRequiredForBuild(platform, buildPlatform *cores.PlatformRelease) ([]*cores.ToolRelease, error)

FindToolsRequiredForBuild returns the list of ToolReleases needed to build for the specified plaftorm. The buildPlatform may be different depending on the selected board.

func (*Explorer) FindToolsRequiredFromPlatformRelease

func (pme *Explorer) FindToolsRequiredFromPlatformRelease(platform *cores.PlatformRelease) ([]*cores.ToolRelease, error)

FindToolsRequiredFromPlatformRelease returns a list of ToolReleases needed by the specified PlatformRelease. If a ToolRelease is not found return an error

func (*Explorer) GetAllInstalledToolsReleases

func (pme *Explorer) GetAllInstalledToolsReleases() []*cores.ToolRelease

GetAllInstalledToolsReleases FIXMEDOC

func (*Explorer) GetCustomGlobalProperties

func (pme *Explorer) GetCustomGlobalProperties() *properties.Map

GetCustomGlobalProperties returns the user defined custom global properties for installed platforms.

func (*Explorer) GetEnvVarsForSpawnedProcess

func (pme *Explorer) GetEnvVarsForSpawnedProcess() []string

GetEnvVarsForSpawnedProcess produces a set of environment variables that must be sent to all processes spawned from the arduino-cli.

func (*Explorer) GetInstalledPlatformRelease

func (pme *Explorer) GetInstalledPlatformRelease(platform *cores.Platform) *cores.PlatformRelease

GetInstalledPlatformRelease returns the PlatformRelease installed (it is chosen)

func (*Explorer) GetPackages

func (pme *Explorer) GetPackages() cores.Packages

GetPackages returns the internal packages structure for direct usage. Deprecated: do not access packages directly, but use specific Explorer methods when possible.

func (*Explorer) GetProfile

func (pme *Explorer) GetProfile() *sketch.Profile

GetProfile returns the active profile for this package manager, or nil if no profile is selected.

func (*Explorer) GetTool

func (pme *Explorer) GetTool(toolID string) *cores.Tool

GetTool searches for tool in all packages and platforms.

func (*Explorer) IdentifyBoard

func (pme *Explorer) IdentifyBoard(idProps *properties.Map) []*cores.Board

IdentifyBoard returns a list of boards whose identification properties match the provided ones.

func (*Explorer) InstallPlatform

func (pme *Explorer) InstallPlatform(platformRelease *cores.PlatformRelease) error

InstallPlatform installs a specific release of a platform.

func (*Explorer) InstallPlatformInDirectory

func (pme *Explorer) InstallPlatformInDirectory(platformRelease *cores.PlatformRelease, destDir *paths.Path) error

InstallPlatformInDirectory installs a specific release of a platform in a specific directory.

func (*Explorer) InstallTool

func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, skipPostInstall bool) error

InstallTool installs a specific release of a tool.

func (*Explorer) InstalledBoards

func (pme *Explorer) InstalledBoards() []*cores.Board

InstalledBoards returns all installed Boards. This function is useful to range all Boards in for loops.

func (*Explorer) InstalledPlatformReleases

func (pme *Explorer) InstalledPlatformReleases() []*cores.PlatformRelease

InstalledPlatformReleases returns all installed PlatformReleases. This function is useful to range all PlatformReleases in for loops.

func (*Explorer) IsManagedPlatformRelease

func (pme *Explorer) IsManagedPlatformRelease(platformRelease *cores.PlatformRelease) bool

IsManagedPlatformRelease returns true if the PlatforRelease is managed by the PackageManager

func (*Explorer) IsManagedToolRelease

func (pme *Explorer) IsManagedToolRelease(toolRelease *cores.ToolRelease) bool

IsManagedToolRelease returns true if the ToolRelease is managed by the PackageManager

func (*Explorer) IsToolRequired

func (pme *Explorer) IsToolRequired(toolRelease *cores.ToolRelease) bool

IsToolRequired returns true if any of the installed platforms requires the toolRelease passed as parameter

func (*Explorer) LoadDiscoveries

func (pme *Explorer) LoadDiscoveries() []error

LoadDiscoveries load all discoveries for all loaded platforms Returns error if: * A PluggableDiscovery instance can't be created * Tools required by the PlatformRelease cannot be found * Command line to start PluggableDiscovery has malformed or mismatched quotes

func (*Explorer) NormalizeFQBN

func (pme *Explorer) NormalizeFQBN(fqbn *cores.FQBN) (*cores.FQBN, error)

NormalizeFQBN return a normalized copy of the given FQBN, that is the same FQBN but with the unneeded or invalid options removed.

func (*Explorer) Package

func (pme *Explorer) Package(name string) *PackageActions

Package looks for the Package with the given name, returning a structure able to perform further operations on that given resource

func (*Explorer) ResolveFQBN

ResolveFQBN returns, in order:

- the Package pointed by the fqbn

- the PlatformRelease pointed by the fqbn

- the Board pointed by the fqbn

- the build properties for the board considering also the configuration part of the fqbn

- the PlatformRelease to be used for the build (if the board requires a 3rd party core it may be different from the PlatformRelease pointed by the fqbn)

- an error if any of the above is not found

In case of error the partial results found in the meantime are returned together with the error.

func (*Explorer) RunPreOrPostScript

func (pme *Explorer) RunPreOrPostScript(installDir *paths.Path, prefix string) ([]byte, []byte, error)

RunPreOrPostScript runs either the post_install.sh (or post_install.bat) or the pre_uninstall.sh (or pre_uninstall.bat) script for the specified platformRelease or toolRelease.

func (*Explorer) UninstallPlatform

func (pme *Explorer) UninstallPlatform(platformRelease *cores.PlatformRelease, taskCB rpc.TaskProgressCB, skipPreUninstall bool) error

UninstallPlatform remove a PlatformRelease.

func (*Explorer) UninstallTool

func (pme *Explorer) UninstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, skipPreUninstall bool) error

UninstallTool remove a ToolRelease.

type PackageActions

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

PackageActions defines what actions can be performed on the specific Package It serves as a status container for the fluent APIs

func (*PackageActions) Tool

func (pa *PackageActions) Tool(name string) *ToolActions

Tool looks for the Tool with the given name, returning a structure able to perform further operations on that given resource

type PackageManager

type PackageManager struct {
	IndexDir    *paths.Path
	PackagesDir *paths.Path
	DownloadDir *paths.Path
	// contains filtered or unexported fields
}

PackageManager defines the superior oracle which understands all about Arduino Packages, how to parse them, download, and so on.

The manager also keeps track of the status of the Packages (their Platform Releases, actually) installed in the system.

func (*PackageManager) IdentifyBoardConfiguration

func (pm *PackageManager) IdentifyBoardConfiguration(idProps *properties.Map, board *cores.Board) *properties.Map

IdentifyBoardConfiguration returns the configuration of the board that can be deduced from the given upload port identification properties

func (*PackageManager) NewBuilder

func (pm *PackageManager) NewBuilder() (builder *Builder, commit func())

NewBuilder creates a Builder with the same configuration of this PackageManager. A "commit" function callback is returned: calling this function will make the builder write the new configuration into this PackageManager.

func (*PackageManager) NewExplorer

func (pm *PackageManager) NewExplorer() (explorer *Explorer, release func())

NewExplorer creates an Explorer for this PackageManager. The Explorer will keep a read-lock on the underlying PackageManager, the user must call the "release" callback function to release the lock when the Explorer is no more needed.

type PlatformReference

type PlatformReference struct {
	Package              string // The package where this Platform belongs to.
	PlatformArchitecture string
	PlatformVersion      *semver.Version
}

PlatformReference represents a tuple to identify a Platform

func (*PlatformReference) String

func (platform *PlatformReference) String() string

type ToolActions

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

ToolActions defines what actions can be performed on the specific Tool It serves as a status container for the fluent APIs

func (*ToolActions) Get

func (ta *ToolActions) Get() (*cores.Tool, error)

Get returns the final representation of the Tool

func (*ToolActions) IsInstalled

func (ta *ToolActions) IsInstalled() (bool, error)

IsInstalled checks whether any release of the Tool is installed in the system

func (*ToolActions) Release

func (ta *ToolActions) Release(version *semver.RelaxedVersion) *ToolReleaseActions

Release FIXMEDOC

type ToolReleaseActions

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

ToolReleaseActions defines what actions can be performed on the specific ToolRelease It serves as a status container for the fluent APIs

func (*ToolReleaseActions) Get

func (tr *ToolReleaseActions) Get() (*cores.ToolRelease, error)

Get FIXMEDOC

Jump to

Keyboard shortcuts

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