Documentation ¶
Index ¶
- func CheckDirChecksum(root string) (bool, error)
- func IsDirEmpty(path *paths.Path) (bool, error)
- type DownloadResource
- func (r *DownloadResource) ArchivePath(downloadDir *paths.Path) (*paths.Path, error)
- func (r *DownloadResource) Download(downloadDir *paths.Path, config *downloader.Config, label string, ...) error
- func (release *DownloadResource) Install(downloadDir, tempPath, destDir *paths.Path) error
- func (r *DownloadResource) IsCached(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveChecksum(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveIntegrity(downloadDir *paths.Path) (bool, error)
- func (r *DownloadResource) TestLocalArchiveSize(downloadDir *paths.Path) (bool, error)
- type DownloadResult
- type IndexResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckDirChecksum ¶
CheckDirChecksum reads checksum from the package.json and compares it with a recomputed value.
Types ¶
type DownloadResource ¶
type DownloadResource struct { URL string ArchiveFileName string Checksum string Size int64 CachePath string }
DownloadResource has all the information to download a file
func (*DownloadResource) ArchivePath ¶
func (r *DownloadResource) ArchivePath(downloadDir *paths.Path) (*paths.Path, error)
ArchivePath returns the path of the Archive of the specified DownloadResource relative to the specified downloadDir
func (*DownloadResource) Download ¶
func (r *DownloadResource) Download(downloadDir *paths.Path, config *downloader.Config, label string, downloadCB rpc.DownloadProgressCB, queryParameter string) error
Download performs a download loop using the provided downloader.Config. Messages are passed back to the DownloadProgressCB using label as text for the File field. queryParameter is passed for analysis purposes.
func (*DownloadResource) Install ¶
func (release *DownloadResource) Install(downloadDir, tempPath, destDir *paths.Path) error
Install installs the resource in three steps: - the archive is unpacked in a temporary subdir of tempPath - there should be only one root dir in the unpacked content - the only root dir is moved/renamed to/as the destination directory Note that tempPath and destDir must be on the same filesystem partition otherwise the last step will fail.
func (*DownloadResource) IsCached ¶
func (r *DownloadResource) IsCached(downloadDir *paths.Path) (bool, error)
IsCached returns true if the specified DownloadResource has already been downloaded
func (*DownloadResource) TestLocalArchiveChecksum ¶
func (r *DownloadResource) TestLocalArchiveChecksum(downloadDir *paths.Path) (bool, error)
TestLocalArchiveChecksum test if the checksum of the local archive match the checksum of the DownloadResource
func (*DownloadResource) TestLocalArchiveIntegrity ¶
func (r *DownloadResource) TestLocalArchiveIntegrity(downloadDir *paths.Path) (bool, error)
TestLocalArchiveIntegrity checks for integrity of the local archive.
func (*DownloadResource) TestLocalArchiveSize ¶
func (r *DownloadResource) TestLocalArchiveSize(downloadDir *paths.Path) (bool, error)
TestLocalArchiveSize test if the local archive size match the DownloadResource size
type DownloadResult ¶
type DownloadResult struct { // Error is nil if the download is successful otherwise // it contains the reason for the download failure Error error // AlreadyDownloaded is true if a cache file is found // and, consequently, the download has not been executed AlreadyDownloaded bool }
DownloadResult contains the result of a download
type IndexResource ¶
IndexResource is a reference to an index file URL with an optional signature.
func (*IndexResource) Download ¶
func (res *IndexResource) Download(destDir *paths.Path, downloadCB rpc.DownloadProgressCB) error
Download will download the index and possibly check the signature using the Arduino's public key. If the file is in .gz format it will be unpacked first.
func (*IndexResource) IndexFileName ¶
func (res *IndexResource) IndexFileName() (string, error)
IndexFileName returns the index file name as it is saved in data dir (package_xxx_index.json).