client

package
v2.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: Apache-2.0 Imports: 21 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) (string, string, string, error)

FindRepoLatest returns the latest version of a package along with its repo and arch. The archs are searched in order; if a matching package is found for any arch, it is returned immediately even if a later arch might have a later version.

func FindRepoSpec

func FindRepoSpec(pi goolib.PackageInfo, repo Repo) (goolib.RepoSpec, error)

FindRepoSpec returns the RepoSpec in repo 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 Repo added in v2.20.0

type Repo struct {
	Priority priority.Value
	Packages []goolib.RepoSpec
}

Repo represents a single downloaded repo.

type RepoMap

type RepoMap map[string]Repo

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

func AvailableVersions

func AvailableVersions(ctx context.Context, srcs map[string]priority.Value, 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