Documentation ¶
Overview ¶
Package pkgs implements the functions from github.com/arduino-create-agent/gen/indexes and github.com/arduino-create-agent/gen/tools.
It allows to manage package indexes from arduino cores, and to download tools used for upload.
Index ¶
- type Index
- type System
- type Tool
- type Tools
- func (t *Tools) Available(ctx context.Context) (res tools.ToolCollection, err error)
- func (t *Tools) Install(ctx context.Context, payload *tools.ToolPayload) (*tools.Operation, error)
- func (t *Tools) Installed(ctx context.Context) (tools.ToolCollection, error)
- func (t *Tools) Installedhead(ctx context.Context) (err error)
- func (t *Tools) Remove(ctx context.Context, payload *tools.ToolPayload) (*tools.Operation, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index struct { Packages []struct { Name string `json:"name"` Tools []Tool `json:"tools"` } `json:"packages"` }
Index is the go representation of a typical package-index file, stripped from every non-used field.
type System ¶
type System struct { Host string `json:"host"` URL string `json:"url"` Name string `json:"archiveFileName"` Checksum string `json:"checksum"` }
System is the go representation of the info needed to download a tool for a specific OS/Arch
type Tool ¶
type Tool struct { Name string `json:"name"` Version string `json:"version"` Systems []System `json:"systems"` }
Tool is the go representation of the info about a tool contained in a package-index file, stripped from every non-used field.
func (*Tool) GetFlavourCompatibleWith ¶
GetFlavourCompatibleWith returns the downloadable resource (System) compatible with the specified OS/Arch Source: https://github.com/arduino/arduino-cli/blob/master/arduino/cores/tools.go#L206-L216
type Tools ¶
type Tools struct {
// contains filtered or unexported fields
}
Tools is a client that implements github.com/arduino/arduino-create-agent/gen/tools.Service interface. It saves tools in a specified folder with this structure: packager/name/version For example:
folder └── arduino └── bossac ├── 1.6.1-arduino │ └── bossac └── 1.7.0 └── bossac
It requires an Index Resource to search for tools
func New ¶
New will return a Tool object, allowing the caller to execute operations on it. The New function will accept an index as parameter (used to download the indexes) and a folder used to download the indexes
func (*Tools) Available ¶
Available crawles the downloaded package index files and returns a list of tools that can be installed.
func (*Tools) Install ¶
Install crawles the Index folder, downloads the specified tool, extracts the archive in the Tools Folder. It checks for the Signature specified in the package index.
func (*Tools) Installedhead ¶
Installedhead is here only because it was required by the front-end. Probably when we bumped GOA something changed: Before that the frontend was able to perform the HEAD request to `v2/pkgs/tools/installed`. After the bump we have to implement it explicitly. Currently I do not know a better way in achieving the same result.