Documentation ¶
Overview ¶
Package goolib contains common functions useful when working with GooGet.
Index ¶
- func Checksum(r io.Reader) string
- func Compare(v1, v2 string) (int, error)
- func ContainsInt(a int, slice []int) bool
- func ContainsString(a string, slice []string) bool
- func Exec(s string, args []string, ec []int, w io.Writer) error
- func MarshalPackageSpec(spec *PkgSpec) ([]byte, error)
- func Run(c *exec.Cmd, ec []int, w io.Writer) error
- func SortVersions(versions []string) []string
- func WritePackageSpec(tw *tar.Writer, spec *PkgSpec) error
- type ExecFile
- type GooSpec
- type PackageInfo
- type PkgSources
- type PkgSpec
- type RepoSpec
- type Version
- type Versions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Compare ¶
Compare compares string versions of packages v1 to v2: -1 == v1 is less than v2 0 == v1 is equal to v2 1 == v1 is greater than v2
func ContainsString ¶
ContainsString checks if a is in slice.
func Exec ¶
Exec execs a script or binary on either Windows or Linux using the provided args. The process is successful if the exit code matches any of those provided or '0'. stdout and stderr are sent to the writer.
func MarshalPackageSpec ¶
MarshalPackageSpec encodes the given PkgSpec.
func Run ¶
Run runs a command. The process is successful if the exit code matches any of those provided or '0'. stdout and stderr are sent to the writer and to this process's stdout and stderr.
func SortVersions ¶
SortVersions sorts a list of goospec string versions.
Types ¶
type ExecFile ¶
type ExecFile struct { Path string `json:",omitempty"` Args []string `json:",omitempty"` ExitCodes []int `json:",omitempty"` }
ExecFile contains info involved in running a script or binary file.
type GooSpec ¶
type GooSpec struct { Build build Sources []PkgSources PackageSpec *PkgSpec }
GooSpec is the build specification for a package.
func ReadGooSpec ¶
ReadGooSpec unmarshalls and verifies a goospec file into the GooSpec struct.
type PackageInfo ¶
type PackageInfo struct {
Name, Arch, Ver string
}
PackageInfo describes the name arch and version of a package.
func PkgNameSplit ¶
func PkgNameSplit(pn string) PackageInfo
PkgNameSplit returns the PackageInfo from a package name. If the package name does not contain arch or version an empty string will be returned.
func (PackageInfo) PkgName ¶
func (pi PackageInfo) PkgName() string
PkgName returns the proper goo package name.
func (PackageInfo) String ¶
func (pi PackageInfo) String() string
type PkgSources ¶
PkgSources is a list of includes, excludes and their target in the package.
type PkgSpec ¶
type PkgSpec struct { Name string Version string Arch string ReleaseNotes []string `json:",omitempty"` Description string `json:",omitempty"` License string `json:",omitempty"` Authors string `json:",omitempty"` Owners string `json:",omitempty"` Tags map[string][]byte `json:",omitempty"` PkgDependencies map[string]string `json:",omitempty"` Replaces []string Conflicts []string Install ExecFile Uninstall ExecFile Files map[string]string `json:",omitempty"` }
PkgSpec is an individual package specification.
func ExtractPkgSpec ¶
ExtractPkgSpec pulls and unmarshals the package spec file from a reader.
func ReadPackageSpec ¶
ReadPackageSpec reads a PkgSpec from the given reader, which is expected to contain an uncompressed tar archive.
func UnmarshalPackageSpec ¶
UnmarshalPackageSpec parses data and returns a PkgSpec, if it finds one.
type Version ¶
Version contains the semver version as well as the GsVer. Semver is semantic versioning version. GsVer is a GooSpec version number (usually version of installer).
func ParseVersion ¶
ParseVersion parses the string version into goospec.Version. ParseVersion attempts to fix non-compliant Semver strings by removing leading zeros from components, and replacing any missing components with zero values after using existing components for the least significant components first (i.e. "1" will become "0.0.1", not "1.0.0").