multiwerf

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultLocalChannelMappingFilename = "multiwerf.json"
View Source
const GCLockName = "gc"
View Source
const SelfUpdateLockName = "self-update"

Variables

View Source
var (
	StorageDir string
	TmpDir     string
)

Functions

func CalculateSHA256

func CalculateSHA256(filePath string) (string, error)

CalculateSHA256 returns SHA256 hash of filePath content

func CheckIsFileWritable

func CheckIsFileWritable(path string) error

func CheckMajorMinor

func CheckMajorMinor(version string) error

CheckMajorMinor return error if string not in form MAJOR.MINOR

func DirExists added in v1.0.6

func DirExists(path string) (bool, error)

func ExecUpdatedBinary

func ExecUpdatedBinary(path string) error

ExecUpdatedBinary replaces current process with process from path binary --self-update=no flag is added to arguments to prevent an infinity loop.

func ExpandPath added in v1.0.8

func ExpandPath(path string) (resPath string, err error)

ExpandPath expands tilde prefix and returns an absolute path

func FileExists

func FileExists(path string) (bool, error)

FileExists returns true if path exists

func GC added in v1.4.0

func GC() error

func GetSelfExecutableInfo

func GetSelfExecutableInfo() (path string, err error)

GetSelfExecutableInfo return path of an executable file of current process. If file is not owned by user of the process and has no 0x400 bit — return error

func HighestSemverVersion added in v1.4.0

func HighestSemverVersion(versions []string) (string, error)

HighestSemverVersion returns the latest version from availableVersions array

func IsNotADirectoryError added in v1.4.0

func IsNotADirectoryError(err error) bool

func IsReleaseFilesExist added in v1.0.15

func IsReleaseFilesExist(dir string, files map[string]string) (bool, error)

func LoadHashFile

func LoadHashFile(dir string, fileName string) (hashes map[string]string)

LoadHashFile opens a file and returns hashes map

func LoadHashMap added in v1.0.6

func LoadHashMap(hashesReader io.Reader) (hashes map[string]string)

LoadHashMap returns a map filename -> hash from reader

func NewAppBtClient added in v1.4.4

func NewAppBtClient() (bc repo.Repo)

func NewAppS3Client added in v1.4.4

func NewAppS3Client() (s3c repo.Repo)

func NewSelfBtClient added in v1.4.4

func NewSelfBtClient() (bc repo.Repo)

func NewSelfS3Client added in v1.4.4

func NewSelfS3Client() (s3c repo.Repo)

func PerformSelfUpdate added in v1.0.15

func PerformSelfUpdate(printer output.Printer, skipSelfUpdate bool, skipReexecAfterUpdate bool) (err error)

update multiwerf binary (self-update)

func PrintActionMessage added in v1.0.15

func PrintActionMessage(msg ActionMessage, printer output.Printer)

func PrintActionMessages added in v1.0.15

func PrintActionMessages(messages chan ActionMessage, printer output.Printer) error

PrintActionMessages handle ActionMessage events and print messages with printer object

func ReleaseFiles

func ReleaseFiles(pkg string, version string, osArch string) map[string]string

ReleaseFiles return a map with release filenames of package pkg for particular osArch and version

func ReleaseProgramFilename added in v1.4.0

func ReleaseProgramFilename(pkg, version, osArch string) string

func ReplaceBinaryFile

func ReplaceBinaryFile(dir string, currentName string, newName string) (err error)

func SelfUpdate

func SelfUpdate(options SelfUpdateOptions) error

func SetupStorageDir added in v1.4.0

func SetupStorageDir(printer output.Printer) error

func TildeExpand

func TildeExpand(path string) (string, error)

TildeExpand expands tilde prefix with home directory path

func Update

func Update(group, channel string, options UpdateOptions) (err error)

Update checks for the actual version for group/channel and downloads it to StorageDir if it does not already exist

Arguments:

- group - a major.minor version to update - channel - a string with channel name - options.SkipSelfUpdate - a boolean to perform self-update - options.WithCache - a boolean to try or not getting remote channel mapping - options.WithGC - a boolean to run GC before update - options.OutputFile - a string to write update output to file

func Use

func Use(group, channel string, shell string, options UseOptions) (err error)

Use: * prints a shell script or * generates a shell script file and prints the path

The script includes two parts for defined group/version based on local channel mapping: * multiwerf update procedure that will be performed on background or foreground and * werf alias that uses path to the actual werf binary

func ValidateGroup added in v1.4.0

func ValidateGroup(group string, printer output.Printer) error

func VerifyReleaseFileHash

func VerifyReleaseFileHash(messages chan ActionMessage, dir string, hashFile string, targetFile string) (bool, error)

func VerifyReleaseFileHashFromHashes added in v1.0.6

func VerifyReleaseFileHashFromHashes(messages chan ActionMessage, dir string, hashes map[string]string, targetFile string) (bool, error)

func WerfExec added in v1.4.0

func WerfExec(group, channel string, args []string, tryTrdlOption bool) (err error)

WerfExec launches the latest binary version available for the group/channel based on local channel mapping

func WerfPath added in v1.4.0

func WerfPath(group string, channel string, tryTrdlOption bool) (err error)

WerfPath prints path to the actual version available for the group/channel based on local channel mapping

Types

type ActionMessage

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

ActionMessage is used to send messages from go routines

type BinaryInfo

type BinaryInfo struct {
	BinaryPath   string
	Version      string
	HashVerified bool
}

func UpdateChannelVersionBinary added in v1.4.0

func UpdateChannelVersionBinary(messages chan ActionMessage, group string, channel string, tryRemoteChannelMapping bool) (binInfo *BinaryInfo)

func UseChannelVersionBinary added in v1.4.0

func UseChannelVersionBinary(messages chan ActionMessage, group string, channel string) (binInfo *BinaryInfo)

type ChannelMapping added in v1.4.0

type ChannelMapping interface {
	ChannelVersion(group, channel string) (string, error)
	Save() error
}

func GetChannelMapping added in v1.4.0

func GetChannelMapping(messages chan ActionMessage, tryRemoteChannelMapping bool) (ChannelMapping, error)

type ChannelMappingBase added in v1.4.0

type ChannelMappingBase struct {
	Multiwerf []struct {
		Group    string `json:"group"`
		Channels []struct {
			Name    string `json:"name"`
			Version string `json:"version"`
		} `json:"channels"`
	} `json:"multiwerf"`
}

func (*ChannelMappingBase) AllVersions added in v1.4.0

func (c *ChannelMappingBase) AllVersions() []string

func (*ChannelMappingBase) ChannelVersion added in v1.4.0

func (c *ChannelMappingBase) ChannelVersion(group, channel string) (string, error)

func (*ChannelMappingBase) Marshal added in v1.4.0

func (c *ChannelMappingBase) Marshal() ([]byte, error)

func (*ChannelMappingBase) Save added in v1.4.0

func (c *ChannelMappingBase) Save() error

type ChannelMappingLocal added in v1.4.0

type ChannelMappingLocal struct {
	ChannelMappingBase
}

type ChannelMappingRemote added in v1.4.0

type ChannelMappingRemote struct {
	ChannelMappingBase
}

func (*ChannelMappingRemote) Save added in v1.4.0

func (c *ChannelMappingRemote) Save() error

type DelayFile added in v1.4.0

type DelayFile struct {
	Filename string
	Delay    time.Duration
}

func (*DelayFile) IsDelayPassed added in v1.4.0

func (u *DelayFile) IsDelayPassed() bool

IsDelayPassed returns true if delay has passed since last UpdateTimestamp

func (*DelayFile) TimeRemains added in v1.4.0

func (u *DelayFile) TimeRemains() string

TimeRemains returns a string representation of time until delay is passed. Empty string is returned if delay is passed

func (*DelayFile) UpdateTimestamp added in v1.4.0

func (u *DelayFile) UpdateTimestamp() error

UpdateTimestamp sets delay timestamp as now() be recreating a delay file

func (*DelayFile) WithDelay added in v1.4.0

func (u *DelayFile) WithDelay(d time.Duration)

type LocalChannelMappingNotFoundError added in v1.4.0

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

type MsgType added in v1.4.0

type MsgType string
const (
	OkMsgType   MsgType = "ok"
	WarnMsgType MsgType = "warn"
	FailMsgType MsgType = "fail"
)

type SelfUpdateOptions added in v1.5.0

type SelfUpdateOptions struct {
	OutputFile string
}

type UpdateOptions added in v1.4.0

type UpdateOptions struct {
	SkipSelfUpdate          bool
	TryRemoteChannelMapping bool
	WithCache               bool
	WithGC                  bool
	OutputFile              string
	TryTrdl                 bool
	AutoInstallTrdl         bool
}

type UseOptions added in v1.4.0

type UseOptions struct {
	ForceRemoteCheck        bool
	AsFile                  bool
	SkipSelfUpdate          bool
	TryRemoteChannelMapping bool
	WithGC                  bool
	TryTrdl                 bool
	AutoInstallTrdl         bool
}

Jump to

Keyboard shortcuts

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