packagemanager
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Index¶
- Variables
- type Builder
- func (pmb *Builder) Build() *PackageManager
- func (pmb *Builder) BuildIntoExistingPackageManager(target *PackageManager)
- func (pmb *Builder) GetOrCreatePackage(packager string) *cores.Package
- func (pmb *Builder) LoadGlobalHardwareForProfile(p *sketch.Profile) []error
- func (pm *Builder) LoadHardware() []error
- func (pmb *Builder) LoadHardwareForProfile(ctx context.Context, p *sketch.Profile, installMissing bool, ...) []error
- func (pm *Builder) LoadHardwareFromDirectories(hardwarePaths paths.PathList) []error
- func (pm *Builder) LoadHardwareFromDirectory(path *paths.Path) []error
- func (pmb *Builder) LoadPackageIndex(URL *url.URL) error
- func (pmb *Builder) LoadPackageIndexFromFile(indexPath *paths.Path) (*packageindex.Index, error)
- func (pm *Builder) LoadToolsFromPackageDir(targetPackage *cores.Package, toolsPath *paths.Path) []error
- type Explorer
- func (pme *Explorer) Dirty() bool
- func (pme *Explorer) DiscoveryManager() *discoverymanager.DiscoveryManager
- func (pme *Explorer) DownloadAndInstallPlatformAndTools(ctx context.Context, platformRelease *cores.PlatformRelease, ...) error
- func (pme *Explorer) DownloadAndInstallPlatformUpgrades(ctx context.Context, platformRef *PlatformReference, ...) (*cores.PlatformRelease, error)
- func (pme *Explorer) DownloadPlatformRelease(ctx context.Context, platform *cores.PlatformRelease, ...) error
- func (pme *Explorer) DownloadToolRelease(ctx context.Context, tool *cores.ToolRelease, ...) error
- func (pme *Explorer) FindBoardWithFQBN(fqbnIn string) (*cores.Board, error)
- func (pme *Explorer) FindDiscoveryDependency(discovery *cores.DiscoveryDependency) *cores.ToolRelease
- func (pme *Explorer) FindMonitorDependency(discovery *cores.MonitorDependency) *cores.ToolRelease
- func (pme *Explorer) FindPlatform(ref *PlatformReference) *cores.Platform
- func (pme *Explorer) FindPlatformRelease(ref *PlatformReference) *cores.PlatformRelease
- func (pme *Explorer) FindPlatformReleaseDependencies(item *PlatformReference) (*cores.PlatformRelease, []*cores.ToolRelease, error)
- func (pme *Explorer) FindPlatformReleaseProvidingBoardsWithVidPid(vid, pid string) []*cores.Platform
- func (pme *Explorer) FindToolDependency(dep *cores.ToolDependency) *cores.ToolRelease
- func (pme *Explorer) FindToolsRequiredForBuild(platform, buildPlatform *cores.PlatformRelease) ([]*cores.ToolRelease, error)
- func (pme *Explorer) FindToolsRequiredFromPlatformRelease(platform *cores.PlatformRelease) ([]*cores.ToolRelease, error)
- func (pme *Explorer) GetAllInstalledToolsReleases() []*cores.ToolRelease
- func (pme *Explorer) GetCustomGlobalProperties() *properties.Map
- func (pme *Explorer) GetEnvVarsForSpawnedProcess() []string
- func (pme *Explorer) GetInstalledPlatformRelease(platform *cores.Platform) *cores.PlatformRelease
- func (pme *Explorer) GetPackages() cores.Packages
- func (pme *Explorer) GetProfile() *sketch.Profile
- func (pme *Explorer) GetTool(toolID string) *cores.Tool
- func (pme *Explorer) IdentifyBoard(idProps *properties.Map) []*cores.Board
- func (pme *Explorer) InstallPlatform(platformRelease *cores.PlatformRelease, checks resources.IntegrityCheckMode) error
- func (pme *Explorer) InstallPlatformInDirectory(platformRelease *cores.PlatformRelease, destDir *paths.Path, ...) error
- func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, ...) error
- func (pme *Explorer) InstalledBoards() []*cores.Board
- func (pme *Explorer) InstalledPlatformReleases() []*cores.PlatformRelease
- func (pme *Explorer) IsManagedPlatformRelease(platformRelease *cores.PlatformRelease) bool
- func (pme *Explorer) IsManagedToolRelease(toolRelease *cores.ToolRelease) bool
- func (pme *Explorer) IsToolRequired(toolRelease *cores.ToolRelease) bool
- func (pme *Explorer) LoadDiscoveries() []error
- func (pme *Explorer) NormalizeFQBN(fqbn *fqbn.FQBN) (*fqbn.FQBN, error)
- func (pme *Explorer) Package(name string) *PackageActions
- func (pme *Explorer) ResolveFQBN(fqbn *fqbn.FQBN) (*cores.Package, *cores.PlatformRelease, *cores.Board, *properties.Map, ...)
- func (pme *Explorer) RunPreOrPostScript(installDir *paths.Path, prefix string) ([]byte, []byte, error)
- func (pme *Explorer) UninstallPlatform(platformRelease *cores.PlatformRelease, taskCB rpc.TaskProgressCB, ...) error
- func (pme *Explorer) UninstallTool(toolRelease *cores.ToolRelease, taskCB rpc.TaskProgressCB, ...) error
- type PackageActions
- type PackageManager
- type PlatformReference
- type ToolActions
- type ToolReleaseActions
Constants¶
This section is empty.
Variables¶
var ErrPlatformNotAvailableForOS =errors.New("platform is not available for your OS")Functions¶
This section is empty.
Types¶
typeBuilder¶
type BuilderPackageManager
Builder is used to create a new PackageManager. The builderhas methods to load platforms and tools to actually build the PackageManager.Once the PackageManager is built, it cannot be changed anymore.
funcNewBuilder¶
func NewBuilder(indexDir, packagesDir, userPackagesDir, downloadDir, tempDir *paths.Path, userAgentstring, downloaderConfig downloader.Config) *Builder
NewBuilder returns a new Builder
func (*Builder)BuildIntoExistingPackageManager¶
func (pmb *Builder) BuildIntoExistingPackageManager(target *PackageManager)
BuildIntoExistingPackageManager will overwrite the given PackageManager insteadof building a new one.
func (*Builder)GetOrCreatePackage¶
GetOrCreatePackage returns the specified Package or creates an empty onefilling all the cross-references
func (*Builder)LoadGlobalHardwareForProfile¶added inv1.3.0
LoadGlobalHardwareForProfile loads the hardware platforms for the given profile.It uses the global package manager and does not download or install any missing tools or platforms.
func (*Builder)LoadHardware¶
LoadHardware read all plaforms from the configured paths
func (*Builder)LoadHardwareForProfile¶
func (pmb *Builder) LoadHardwareForProfile(ctxcontext.Context, p *sketch.Profile, installMissingbool, downloadCBrpc.DownloadProgressCB, taskCBrpc.TaskProgressCB, settings *configuration.Settings) []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¶
LoadHardwareFromDirectories load plaforms from a set of directories
func (*Builder)LoadHardwareFromDirectory¶
LoadHardwareFromDirectory read a plaform from the path passed as parameter
func (*Builder)LoadPackageIndex¶
LoadPackageIndex loads a package index by looking up the local cached file from the specified URL
func (*Builder)LoadPackageIndexFromFile¶
LoadPackageIndexFromFile load a package index from the specified file
typeExplorer¶
type ExplorerPackageManager
Explorer is used to query the PackageManager. When used it holdsa read-only lock on the PackageManager that must be released when thejob is completed.
func (*Explorer)Dirty¶
Dirty returns true if one of the loaded platforms needs to be re-initializeddue to file changes in the platform releases.
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(ctxcontext.Context,platformRelease *cores.PlatformRelease, requiredTools []*cores.ToolRelease,downloadCBrpc.DownloadProgressCB, taskCBrpc.TaskProgressCB,skipPostInstallbool, skipPreUninstallbool, checksresources.IntegrityCheckMode)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, andremoving the previously installed platform/tools that are no longer needed after the upgrade.
func (*Explorer)DownloadAndInstallPlatformUpgrades¶
func (pme *Explorer) DownloadAndInstallPlatformUpgrades(ctxcontext.Context,platformRef *PlatformReference,downloadCBrpc.DownloadProgressCB,taskCBrpc.TaskProgressCB,skipPostInstallbool,skipPreUninstallbool,checksresources.IntegrityCheckMode,) (*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, andremoving the previously installed platform/tools that are no longer needed after the upgrade.
func (*Explorer)DownloadPlatformRelease¶
func (pme *Explorer) DownloadPlatformRelease(ctxcontext.Context, platform *cores.PlatformRelease, progressCBrpc.DownloadProgressCB)error
DownloadPlatformRelease downloads a PlatformRelease. If the platform is already downloaded anil Downloader is returned.
func (*Explorer)DownloadToolRelease¶
func (pme *Explorer) DownloadToolRelease(ctxcontext.Context, tool *cores.ToolRelease, progressCBrpc.DownloadProgressCB)error
DownloadToolRelease downloads a ToolRelease. If the tool is already downloaded a nil Downloaderis returned. Uses the given downloader configuration for download, or the default config if nil.
func (*Explorer)FindBoardWithFQBN¶
FindBoardWithFQBN returns the board identified by the fqbn, or an error
func (*Explorer)FindDiscoveryDependency¶
func (pme *Explorer) FindDiscoveryDependency(discovery *cores.DiscoveryDependency) *cores.ToolRelease
FindDiscoveryDependency returns the ToolRelease referenced by the DiscoveryDepenency or nil ifthe 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 ifthe 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 anda set of outputs for non existing platforms.
func (*Explorer)FindPlatformReleaseProvidingBoardsWithVidPid¶
FindPlatformReleaseProvidingBoardsWithVidPid FIXMEDOC
func (*Explorer)FindToolDependency¶
func (pme *Explorer) FindToolDependency(dep *cores.ToolDependency) *cores.ToolRelease
FindToolDependency returns the ToolRelease referenced by the ToolDependency or nil ifthe 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 specifiedplaftorm. 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 globalproperties for installed platforms.
func (*Explorer)GetEnvVarsForSpawnedProcess¶
GetEnvVarsForSpawnedProcess produces a set of environment variables thatmust 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¶
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¶
GetProfile returns the active profile for this package manager, or nil if no profile is selected.
func (*Explorer)IdentifyBoard¶
func (pme *Explorer) IdentifyBoard(idProps *properties.Map) []*cores.Board
IdentifyBoard returns a list of boards whose identification properties match theprovided ones.
func (*Explorer)InstallPlatform¶
func (pme *Explorer) InstallPlatform(platformRelease *cores.PlatformRelease, checksresources.IntegrityCheckMode)error
InstallPlatform installs a specific release of a platform.
func (*Explorer)InstallPlatformInDirectory¶
func (pme *Explorer) InstallPlatformInDirectory(platformRelease *cores.PlatformRelease, destDir *paths.Path, checksresources.IntegrityCheckMode)error
InstallPlatformInDirectory installs a specific release of a platform in a specific directory.
func (*Explorer)InstallTool¶
func (pme *Explorer) InstallTool(toolRelease *cores.ToolRelease, taskCBrpc.TaskProgressCB, skipPostInstallbool, checksresources.IntegrityCheckMode)error
InstallTool installs a specific release of a tool.
func (*Explorer)InstalledBoards¶
InstalledBoards returns all installed Boards. This function is useful to rangeall Boards in for loops.
func (*Explorer)InstalledPlatformReleases¶
func (pme *Explorer) InstalledPlatformReleases() []*cores.PlatformRelease
InstalledPlatformReleases returns all installed PlatformReleases. This function isuseful 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 toolReleasepassed as parameter
func (*Explorer)LoadDiscoveries¶
LoadDiscoveries load all discoveries for all loaded platformsReturns 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¶
NormalizeFQBN return a normalized copy of the given FQBN, that is the sameFQBN but with the unneeded or invalid options removed.
func (*Explorer)Package¶
func (pme *Explorer) Package(namestring) *PackageActions
Package looks for the Package with the given name, returning a structureable to perform further operations on that given resource
func (*Explorer)ResolveFQBN¶
func (pme *Explorer) ResolveFQBN(fqbn *fqbn.FQBN) (*cores.Package, *cores.PlatformRelease, *cores.Board,*properties.Map, *cores.PlatformRelease,error)
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 theconfiguration part of the fqbn
- the PlatformRelease to be used for the build (if the boardrequires a 3rd party core it may be different from thePlatformRelease 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 arereturned together with the error.
func (*Explorer)RunPreOrPostScript¶
func (pme *Explorer) RunPreOrPostScript(installDir *paths.Path, prefixstring) ([]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, taskCBrpc.TaskProgressCB, skipPreUninstallbool)error
UninstallPlatform remove a PlatformRelease.
func (*Explorer)UninstallTool¶
func (pme *Explorer) UninstallTool(toolRelease *cores.ToolRelease, taskCBrpc.TaskProgressCB, skipPreUninstallbool)error
UninstallTool remove a ToolRelease.
typePackageActions¶
type PackageActions struct {// contains filtered or unexported fields}PackageActions defines what actions can be performed on the specific PackageIt serves as a status container for the fluent APIs
func (*PackageActions)Tool¶
func (pa *PackageActions) Tool(namestring) *ToolActions
Tool looks for the Tool with the given name, returning a structureable to perform further operations on that given resource
typePackageManager¶
type PackageManager struct {IndexDir *paths.PathPackagesDir *paths.PathDownloadDir *paths.Path// contains filtered or unexported fields}PackageManager defines the superior oracle which understands all aboutArduino 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)Destroy¶added inv1.3.1
func (pm *PackageManager) Destroy()
Destroy releases all resources held by the PackageManager.
func (*PackageManager)IdentifyBoardConfiguration¶
func (pm *PackageManager) IdentifyBoardConfiguration(idProps *properties.Map, board *cores.Board) *properties.Map
IdentifyBoardConfiguration returns the configuration of the board that can bededuced 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 configurationof this PackageManager. A "commit" function callback is returned: callingthis function will make the builder write the new configuration into thisPackageManager.
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 lockwhen the Explorer is no more needed.
typePlatformReference¶
type PlatformReference struct {Packagestring// The package where this Platform belongs to.PlatformArchitecturestringPlatformVersion *semver.Version}PlatformReference represents a tuple to identify a Platform
func (*PlatformReference)String¶
func (platform *PlatformReference) String()string
typeToolActions¶
type ToolActions struct {// contains filtered or unexported fields}ToolActions defines what actions can be performed on the specific ToolIt 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
typeToolReleaseActions¶
type ToolReleaseActions struct {// contains filtered or unexported fields}ToolReleaseActions defines what actions can be performed on the specific ToolReleaseIt serves as a status container for the fluent APIs
func (*ToolReleaseActions)Get¶
func (tr *ToolReleaseActions) Get() (*cores.ToolRelease,error)
Get FIXMEDOC