pkgparse

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GOOStoPkgOs = map[string]string{
	"darwin":  "macos",
	"windows": "win",
	"linux":   "linux",
}

GOOStoPkgOs is a mapping of GOOS to webman-specific OS names

Functions

func CheckUsing

func CheckUsing(pkg string) (*string, error)

Check using file. If UsingFile doesn't exist, it is not using anything

func ParseVersion

func ParseVersion(versionStr string, versionFmt string) (*string, error)

func RemoveUsing

func RemoveUsing(pkg string) error

func WriteUsing

func WriteUsing(pkg string, using string) error

Types

type ArchLinuxPkgInfo

type ArchLinuxPkgInfo struct {
	PkgVer string
}

type AssetInfo

type AssetInfo struct {
	Name               string
	Size               uint32
	BrowserDownloadUrl string `json:"browser_download_url"`
}

type OsArchPair

type OsArchPair struct {
	Os   string `yaml:"os"`
	Arch string `yaml:"arch"`
}

OsArchPair is a mapping of OS to ARCH

type OsInfo

type OsInfo struct {
	Name                   string        `yaml:"name"`
	Ext                    string        `yaml:"ext"`
	BinPaths               SingleOrMulti `yaml:"bin_path"`
	ExtractHasRoot         bool          `yaml:"extract_has_root"`
	IsRawBinary            bool          `yaml:"is_raw_binary"`
	FilenameFormatOverride string        `yaml:"filename_format_override"`
	Renames                []RenameItem  `yaml:"renames"`
	InstallNote            string        `yaml:"install_note"`
	RemoveNote             string        `yaml:"remove_note"`
}

OsInfo is specific information for a package based on OS

type PkgConfig

type PkgConfig struct {
	Title       string `yaml:"-"`
	Tagline     string `yaml:"tagline"`
	About       string `yaml:"about"`
	InstallNote string `yaml:"install_note"`
	RemoveNote  string `yaml:"remove_note"`

	InfoUrl         string `yaml:"info_url"`
	ReleasesUrl     string `yaml:"releases_url"`
	BaseDownloadUrl string `yaml:"base_download_url"`
	GitUser         string `yaml:"git_user"`
	GitRepo         string `yaml:"git_repo"`
	GiteaURL        string `yaml:"gitea_url"`
	SourceUrl       string `yaml:"source_url"`

	FilenameFormat   string `yaml:"filename_format"`
	VersionFormat    string `yaml:"version_format"`
	LatestStrategy   string `yaml:"latest_strategy"`
	ForceLatest      bool   `yaml:"force_latest"`
	AllowPrerelease  bool   `yaml:"allow_prerelease"`
	ArchLinuxPkgName string `yaml:"arch_linux_pkg_name"`

	OsMap   map[string]OsInfo `yaml:"os_map"`
	ArchMap map[string]string `yaml:"arch_map"`
	Ignore  []OsArchPair      `yaml:"ignore"`
}

PkgConfig is a package configuration

func ParseGroupPackages added in v0.10.0

func ParseGroupPackages(repoPath string, pkgs []string) ([]*PkgConfig, error)

func ParsePkgConfig added in v0.9.2

func ParsePkgConfig(name string, r io.Reader) (*PkgConfig, error)

ParsePkgConfig parses an io.Reader as a package configuration

func ParsePkgConfigLocal

func ParsePkgConfigLocal(pkgRepos []*config.PkgRepo, pkg string) (*PkgConfig, error)

ParsePkgConfigLocal checks all known repos for a given package

func ParsePkgConfigPath added in v0.10.0

func ParsePkgConfigPath(repoPath, pkg string) (*PkgConfig, error)

ParsePkgConfigPath parses a package configuration from a repo path (~/.webman/recipes/webman) and package name (age) It combines them to parse (~/.webman/recipes/webman/pkgs/age.webman-pkg.yaml) and assigns the name (age)

func (*PkgConfig) GetAssetStemExtUrl

func (pkgConf *PkgConfig) GetAssetStemExtUrl(version string) (*string, *string, *string, error)

func (*PkgConfig) GetLatestVersion

func (pkgConf *PkgConfig) GetLatestVersion() (*string, error)

GetLatestVersion uses the configuration's latest-strategy to determine the latest version of the package

func (*PkgConfig) GetMyBinPaths

func (pkgConf *PkgConfig) GetMyBinPaths() ([]string, error)

GetMyBinPaths gets all bin paths for this pakcage on this OS

func (*PkgConfig) GetRenames added in v0.9.0

func (pkgConf *PkgConfig) GetRenames() ([]RenameItem, error)

GetRenames gets all renames for this package on this OS

func (*PkgConfig) InstallNotes added in v0.9.1

func (pkgConf *PkgConfig) InstallNotes() string

InstallNotes combines package-level and OS-level installation notes

func (*PkgConfig) RemoveNotes added in v0.9.1

func (pkgConf *PkgConfig) RemoveNotes() string

RemoveNotes combines package-level and OS-level removal notes

type PkgGroupConfig

type PkgGroupConfig struct {
	Title       string   `yaml:"title"`
	Tagline     string   `yaml:"tagline"`
	Description string   `yaml:"description"`
	Packages    []string `yaml:"packages"`
}

func ParseGroupConfig

func ParseGroupConfig(r io.Reader, name string) (*PkgGroupConfig, error)

func ParseGroupConfigInRepo added in v0.11.0

func ParseGroupConfigInRepo(pkgRepo *config.PkgRepo, group string) (*PkgGroupConfig, error)

func ParseGroupConfigLocal added in v0.9.2

func ParseGroupConfigLocal(pkgRepos []*config.PkgRepo, group string) (*PkgGroupConfig, string, error)

type ReleaseInfo

type ReleaseInfo struct {
	Url     string
	Assets  []AssetInfo
	TagName string `json:"tag_name"`
	Date    string `json:"published_at"`
}

type ReleaseTagInfo

type ReleaseTagInfo struct {
	TagName    string `json:"tag_name"`
	Date       string `json:"published_at"`
	Prerelease bool
	Draft      bool
}

type RenameItem added in v0.9.0

type RenameItem struct {
	From string `yaml:"from"`
	To   string `yaml:"to"`
}

RenameItem is for package renames when installing

type SingleOrMulti

type SingleOrMulti struct {
	Values []string
}

SingleOrMulti is for YAML values that could be a single string or multiple

func (*SingleOrMulti) UnmarshalYAML

func (sm *SingleOrMulti) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler

type UsingInfo

type UsingInfo struct {
	Using string `yaml:"using"`
}

UsingInfo is which version of a package is being used

Jump to

Keyboard shortcuts

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