Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateSHA256(filePath string) (string, error)
- func CheckIsFileWritable(path string) error
- func CheckMajorMinor(version string) error
- func DirExists(path string) (bool, error)
- func ExecUpdatedBinary(path string) error
- func ExpandPath(path string) (resPath string, err error)
- func FileExists(path string) (bool, error)
- func GC() error
- func GetSelfExecutableInfo() (path string, err error)
- func HighestSemverVersion(versions []string) (string, error)
- func IsNotADirectoryError(err error) bool
- func IsReleaseFilesExist(dir string, files map[string]string) (bool, error)
- func LoadHashFile(dir string, fileName string) (hashes map[string]string)
- func LoadHashMap(hashesReader io.Reader) (hashes map[string]string)
- func NewAppBtClient() (bc repo.Repo)
- func NewAppS3Client() (s3c repo.Repo)
- func NewSelfBtClient() (bc repo.Repo)
- func NewSelfS3Client() (s3c repo.Repo)
- func PerformSelfUpdate(printer output.Printer, skipSelfUpdate bool, skipReexecAfterUpdate bool) (err error)
- func PrintActionMessage(msg ActionMessage, printer output.Printer)
- func PrintActionMessages(messages chan ActionMessage, printer output.Printer) error
- func ReleaseFiles(pkg string, version string, osArch string) map[string]string
- func ReleaseProgramFilename(pkg, version, osArch string) string
- func ReplaceBinaryFile(dir string, currentName string, newName string) (err error)
- func SelfUpdate(options SelfUpdateOptions) error
- func SetupStorageDir(printer output.Printer) error
- func TildeExpand(path string) (string, error)
- func Update(group, channel string, options UpdateOptions) (err error)
- func Use(group, channel string, shell string, options UseOptions) (err error)
- func ValidateGroup(group string, printer output.Printer) error
- func VerifyReleaseFileHash(messages chan ActionMessage, dir string, hashFile string, targetFile string) (bool, error)
- func VerifyReleaseFileHashFromHashes(messages chan ActionMessage, dir string, hashes map[string]string, ...) (bool, error)
- func WerfExec(group, channel string, args []string, tryTrdlOption bool) (err error)
- func WerfPath(group string, channel string, tryTrdlOption bool) (err error)
- type ActionMessage
- type BinaryInfo
- type ChannelMapping
- type ChannelMappingBase
- type ChannelMappingLocal
- type ChannelMappingRemote
- type DelayFile
- type LocalChannelMappingNotFoundError
- type MsgType
- type SelfUpdateOptions
- type UpdateOptions
- type UseOptions
Constants ¶
const DefaultLocalChannelMappingFilename = "multiwerf.json"
const GCLockName = "gc"
const SelfUpdateLockName = "self-update"
Variables ¶
var ( StorageDir string TmpDir string )
Functions ¶
func CalculateSHA256 ¶
CalculateSHA256 returns SHA256 hash of filePath content
func CheckIsFileWritable ¶
func CheckMajorMinor ¶
CheckMajorMinor return error if string not in form MAJOR.MINOR
func ExecUpdatedBinary ¶
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
ExpandPath expands tilde prefix and returns an absolute path
func GetSelfExecutableInfo ¶
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
HighestSemverVersion returns the latest version from availableVersions array
func IsNotADirectoryError ¶ added in v1.4.0
func IsReleaseFilesExist ¶ added in v1.0.15
func LoadHashFile ¶
LoadHashFile opens a file and returns hashes map
func LoadHashMap ¶ added in v1.0.6
LoadHashMap returns a map filename -> hash from reader
func NewAppBtClient ¶ added in v1.4.4
func NewAppS3Client ¶ added in v1.4.4
func NewSelfBtClient ¶ added in v1.4.4
func NewSelfS3Client ¶ added in v1.4.4
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 ¶
ReleaseFiles return a map with release filenames of package pkg for particular osArch and version
func ReleaseProgramFilename ¶ added in v1.4.0
func ReplaceBinaryFile ¶
func SelfUpdate ¶
func SelfUpdate(options SelfUpdateOptions) error
func SetupStorageDir ¶ added in v1.4.0
func TildeExpand ¶
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 VerifyReleaseFileHash ¶
func VerifyReleaseFileHashFromHashes ¶ added in v1.0.6
Types ¶
type ActionMessage ¶
type ActionMessage struct {
// contains filtered or unexported fields
}
ActionMessage is used to send messages from go routines
type BinaryInfo ¶
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
func (*DelayFile) IsDelayPassed ¶ added in v1.4.0
IsDelayPassed returns true if delay has passed since last UpdateTimestamp
func (*DelayFile) TimeRemains ¶ added in v1.4.0
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
UpdateTimestamp sets delay timestamp as now() be recreating a delay file
type LocalChannelMappingNotFoundError ¶ added in v1.4.0
type LocalChannelMappingNotFoundError struct {
// contains filtered or unexported fields
}
type SelfUpdateOptions ¶ added in v1.5.0
type SelfUpdateOptions struct {
OutputFile string
}