Documentation ¶
Index ¶
- type PKGBUILD
- func (pkgBuild *PKGBUILD) AddItem(key string, data any) error
- func (pkgBuild *PKGBUILD) ComputeArchitecture()
- func (pkgBuild *PKGBUILD) CreateSpec(filePath string, tmpl *template.Template) error
- func (pkgBuild *PKGBUILD) GetDepends(packageManager string, args, makeDepends []string) error
- func (pkgBuild *PKGBUILD) GetUpdates(packageManager string, args ...string) error
- func (pkgBuild *PKGBUILD) Init()
- func (pkgBuild *PKGBUILD) RenderSpec(script string) *template.Template
- func (pkgBuild *PKGBUILD) SetMainFolders()
- func (pkgBuild *PKGBUILD) ValidateGeneral()
- func (pkgBuild *PKGBUILD) ValidateMandatoryItems()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PKGBUILD ¶
type PKGBUILD struct { Arch []string ArchComputed string Backup []string Build string Codename string Conflicts []string Copyright []string DebConfig string DebTemplate string Depends []string Distro string Epoch string Files []string FullDistroName string HashSums []string Home string Install string InstalledSize int64 License []string Maintainer string MakeDepends []string OptDepends []string Options []string Package string PackageDir string PkgDesc string PkgDest string PkgName string PkgRel string PkgVer string PostInst string PostRm string PreInst string Prepare string PreRelease string PreRm string Priority string Provides []string Replaces []string Section string SourceDir string SourceURI []string StartDir string URL string StaticEnabled bool StripEnabled bool // contains filtered or unexported fields }
PKGBUILD defines all the fields accepted by the yap specfile (variables, arrays, functions). It adds some exotics fields to manage debconfig templating and other rpm/deb descriptors.
func (*PKGBUILD) AddItem ¶
AddItem adds an item to the PKGBUILD.
It takes a key string and data of any type as parameters. It returns an error.
func (*PKGBUILD) ComputeArchitecture ¶
func (pkgBuild *PKGBUILD) ComputeArchitecture()
ComputeArchitecture checks if the specified architecture is supported. If "any", sets to "any". Otherwise, checks if current architecture is supported. Logs error if not supported, then sets to current architecture if supported.
func (*PKGBUILD) CreateSpec ¶
CreateSpec reads the filepath where the specfile will be written and the content of the specfile. Specfile generation is done using go templates for every different distro family. It returns any error if encountered.
func (*PKGBUILD) GetDepends ¶
GetDepends reads the package manager name, its arguments and all the dependencies required to build the package. It returns any error if encountered.
func (*PKGBUILD) GetUpdates ¶
GetUpdates reads the package manager name and its arguments to perform a sync with remotes and consequently retrieve updates. It returns any error if encountered.
func (*PKGBUILD) Init ¶
func (pkgBuild *PKGBUILD) Init()
Init initializes the PKGBUILD struct.
It sets up the priorities map and assigns the full distribution name based on the Distro and Codename fields.
func (*PKGBUILD) RenderSpec ¶
RenderSpec initializes a new template with custom functions and parses the provided script. It adds two custom functions to the template:
- "join": Takes a slice of strings and joins them into a single string, separated by commas, while also trimming any leading or trailing spaces.
- "multiline": Takes a string and replaces newline characters with a newline followed by a space, effectively formatting the string for better readability in multi-line contexts.
The method returns the parsed template, which can be used for rendering with data.
func (*PKGBUILD) SetMainFolders ¶
func (pkgBuild *PKGBUILD) SetMainFolders()
setMainFolders sets the main folders for the PKGBUILD.
It takes no parameters. It does not return anything.
func (*PKGBUILD) ValidateGeneral ¶
func (pkgBuild *PKGBUILD) ValidateGeneral()
ValidateGeneral checks that mandatory items are correctly provided by the PKGBUILD file.
func (*PKGBUILD) ValidateMandatoryItems ¶
func (pkgBuild *PKGBUILD) ValidateMandatoryItems()
ValidateMandatoryItems checks that mandatory items are correctly provided by the PKGBUILD file.