packages

package
v0.0.0-...-7544f7c Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: BSD-3-Clause Imports: 19 Imported by: 4

Documentation

Overview

packages is utilities for working with Debian packages and package lists.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllAvailable

func AllAvailable(store *storage.Service) (map[string][]*Package, error)

AllAvailable returns all known packages for all applications uploaded to gs://<bucketName>/debs/.

func AllAvailableByPackageName

func AllAvailableByPackageName(store *storage.Service) (map[string]*Package, error)

AllAvailableByPackageName returns all known packages for all applications uploaded to gs://<bucketName>/debs/. They are mapped by the package name.

func FromLocalFile

func FromLocalFile(filename string) ([]string, error)

FromLocalFile loads a list of installed debian package names from a local file.

func Install

func Install(ctx context.Context, client *http.Client, store *storage.Service, name string) error

Install downloads and installs a debian package from Google Storage.

func PutInstalled

func PutInstalled(store *storage.Service, serverName string, packages []string, generation int64) error

PutInstalled writes a new list of installed packages for the given server.

func SetBucketName

func SetBucketName(s string)

func ToLocalFile

func ToLocalFile(packages []string, filename string) error

ToLocalFile writes a list of debian packages to a local file.

Types

type AllInfo

type AllInfo struct {
	// contains filtered or unexported fields
}

AllInfo keeps a cache of all installed packages and all available to be installed packages.

func NewAllInfo

func NewAllInfo(client *http.Client, store *storage.Service, serverNames []string) (*AllInfo, error)

func (*AllInfo) AllAvailable

func (a *AllInfo) AllAvailable() map[string][]*Package

func (*AllInfo) AllAvailableByPackageName

func (a *AllInfo) AllAvailableByPackageName() map[string]*Package

AllAvailableByPackageName returns all known packages for all applications uploaded to gs://<bucketName>/debs/. They are mapped by the package name.

func (*AllInfo) AllInstalled

func (a *AllInfo) AllInstalled() map[string]*Installed

func (*AllInfo) ForceRefresh

func (a *AllInfo) ForceRefresh() error

func (*AllInfo) PutInstalled

func (a *AllInfo) PutInstalled(serverName string, packages []string, generation int64) error

PutInstalled writes a new list of installed packages for the given server.

type Installed

type Installed struct {
	// Names is a list of package names, of the form "{appname}/{appname}:{author}:{date}:{githash}.deb"
	Names []string

	// Generation is the Google Storage generation number of the config file at the time we read it.
	// Use this to avoid the lost-update problem: https://cloud.google.com/storage/docs/generations-preconditions#_ReadModWrite
	Generation int64
}

Installed is a list of all the packages installed on a server.

func InstalledForServer

func InstalledForServer(client *http.Client, store *storage.Service, serverName string) (*Installed, error)

InstalledForServer returns a list of package names of installed packages for the given server.

type Package

type Package struct {
	Name     string // The unique name of this release package.
	Hash     string
	UserID   string
	Built    time.Time
	Dirty    bool
	Note     string
	Services []string
}

Package represents a single Debian package uploaded to Google Storage.

func AllAvailableApp

func AllAvailableApp(store *storage.Service, appName string) ([]*Package, error)

AllAvailableApp returns all known packages for the given applications uploaded to gs://<bucketName>/debs/<appname>.

func (*Package) String

func (p *Package) String() string

type PackageConfig

type PackageConfig struct {
	Servers map[string]ServerConfig
}

PackageConfig is the configuration of the application.

It is a list of servers (by GCE domain name) and the list of apps that are allowed to be installed on them. It is loaded from infra/push/skiapush.json5 in JSON5 format.

func LoadPackageConfig

func LoadPackageConfig(filename string) (PackageConfig, error)

func New

func New() PackageConfig

func (*PackageConfig) AllServerNames

func (p *PackageConfig) AllServerNames() []string

func (*PackageConfig) AllServerNamesWithPackage

func (p *PackageConfig) AllServerNamesWithPackage(name string) []string

type PackageSlice

type PackageSlice []*Package

PackageSlice is for sorting Packages by Built time.

func (PackageSlice) Len

func (p PackageSlice) Len() int

func (PackageSlice) Less

func (p PackageSlice) Less(i, j int) bool

func (PackageSlice) String

func (p PackageSlice) String() string

func (PackageSlice) Swap

func (p PackageSlice) Swap(i, j int)

type ServerConfig

type ServerConfig struct {
	AppNames []string
}

ServerConfig is used in PackageConfig.

Jump to

Keyboard shortcuts

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