client

package
v2.18.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package client contains common functions for the GooGet client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindRepoLatest

func FindRepoLatest(pi goolib.PackageInfo, rm RepoMap, archs []string) (ver, repo, arch string, err error)

FindRepoLatest returns the latest version of a package along with its repo and arch.

func FindRepoSpec

func FindRepoSpec(pi goolib.PackageInfo, pl []goolib.RepoSpec) (goolib.RepoSpec, error)

FindRepoSpec returns the element of pl whose PackageSpec matches pi.

func Get added in v2.18.3

func Get(ctx context.Context, path, proxyServer string) (*http.Response, error)

Get gets a url using an optional proxy server, retrying once on any error.

func RemoveOrRename

func RemoveOrRename(filename string) (string, error)

RemoveOrRename attempts to remove a file or directory. If it fails and it's a file, attempt to rename it into a temp file on windows so that it can be effectively overridden returning the name of the temp file.

func WhatRepo

func WhatRepo(pi goolib.PackageInfo, rm RepoMap) (string, error)

WhatRepo returns what repo a package is in. Name, Arch, and Ver fields of PackageInfo must be provided.

Types

type GooGetState

type GooGetState []PackageState

GooGetState describes the overall package state on a client.

func UnmarshalState

func UnmarshalState(b []byte) (*GooGetState, error)

UnmarshalState unmarshals data into GooGetState.

func (*GooGetState) Add

func (s *GooGetState) Add(ps PackageState)

Add appends a PackageState.

func (*GooGetState) GetPackageState

func (s *GooGetState) GetPackageState(pi goolib.PackageInfo) (PackageState, error)

GetPackageState returns the PackageState of the matching goolib.PackageInfo, or error if no match is found.

func (*GooGetState) Marshal

func (s *GooGetState) Marshal() ([]byte, error)

Marshal JSON marshals GooGetState.

func (*GooGetState) Remove

func (s *GooGetState) Remove(pi goolib.PackageInfo) error

Remove removes a PackageState.

type PackageState

type PackageState struct {
	SourceRepo, DownloadURL, Checksum, LocalPath, UnpackDir string
	PackageSpec                                             *goolib.PkgSpec
	InstalledFiles                                          map[string]string
}

PackageState describes the state of a package on a client.

func (*PackageState) Match

func (ps *PackageState) Match(pi goolib.PackageInfo) bool

Match reports whether the PackageState corresponds to the package info.

type RepoMap

type RepoMap map[string][]goolib.RepoSpec

RepoMap describes each repo's packages as seen from a client.

func AvailableVersions

func AvailableVersions(ctx context.Context, srcs []string, cacheDir string, cacheLife time.Duration, proxyServer string) RepoMap

AvailableVersions builds a RepoMap from a list of sources.

Jump to

Keyboard shortcuts

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