chromeosversion

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package chromeosversion provides a number of methods for interacting with ChromeOS versions and the version file.

Index

Constants

This section is empty.

Variables

View Source
var (
	VersionFileProjectPath string = "chromeos/config/chromeos_version.sh"
)

This is a var and not a const for testing purposes.

Functions

func VersionsEqual

func VersionsEqual(a, b VersionInfo) bool

VersionsEqual returns true if the two versions are equal, and false otherwise.

Types

type VersionComponent

type VersionComponent string

VersionComponent is an individual component of a version.

const (
	// Unspecified component.
	Unspecified VersionComponent = "UNSPECIFIED"
	// ChromeBranch (Milestone) component.
	ChromeBranch VersionComponent = "CHROME_BRANCH"
	// Build component.
	Build VersionComponent = "CHROMEOS_BUILD"
	// Branch component.
	Branch VersionComponent = "CHROMEOS_BRANCH"
	// Patch component.
	Patch VersionComponent = "CHROMEOS_PATCH"
)

func ComponentToBumpFromBranch

func ComponentToBumpFromBranch(branch string) VersionComponent

ComponentToBumpFromBranch returns the version component to bump based on the branch name.

type VersionInfo

type VersionInfo struct {
	ChromeBranch      int
	BuildNumber       int
	BranchBuildNumber int
	PatchNumber       int
	VersionFile       string
}

VersionInfo contains information about a ChromeOS version, optionally including information about the version file.

func GetVersionInfoFromRepo

func GetVersionInfoFromRepo(sourceRepo string) (VersionInfo, error)

GetVersionInfoFromRepo reads version info from a fixed location in the specified repository.

func ParseVersionInfo

func ParseVersionInfo(fileData []byte) (VersionInfo, error)

ParseVersionInfo parses file contents for version info.

func (*VersionInfo) IncrementVersion

func (v *VersionInfo) IncrementVersion(incrType VersionComponent) string

IncrementVersion increments the specified component of the version.

func (*VersionInfo) StrippedVersionString

func (v *VersionInfo) StrippedVersionString() string

StrippedVersionString returns the stripped version string of the given VersionInfo struct, i.e. the non-zero components of the version. Example: 123.1.0 --> 123.1 Example: 123.0.0 --> 123

func (*VersionInfo) UpdateVersionFile

func (v *VersionInfo) UpdateVersionFile() error

UpdateVersionFile updates the version file with our current version.

func (*VersionInfo) VersionComponents

func (v *VersionInfo) VersionComponents() []int

VersionComponents returns the components (not including milestone) of a version.

func (*VersionInfo) VersionString

func (v *VersionInfo) VersionString() string

VersionString returns a version string for the version.

Jump to

Keyboard shortcuts

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