pkgbuild

package
v0.0.0-...-fc2143d Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

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

func (pkgBuild *PKGBUILD) AddItem(key string, data any) error

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

func (pkgBuild *PKGBUILD) CreateSpec(filePath string, tmpl *template.Template) error

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

func (pkgBuild *PKGBUILD) GetDepends(packageManager string, args, makeDepends []string) error

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

func (pkgBuild *PKGBUILD) GetUpdates(packageManager string, args ...string) error

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

func (pkgBuild *PKGBUILD) RenderSpec(script string) *template.Template

RenderSpec initializes a new template with custom functions and parses the provided script. It adds two custom functions to the template:

  1. "join": Takes a slice of strings and joins them into a single string, separated by commas, while also trimming any leading or trailing spaces.
  2. "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.

Jump to

Keyboard shortcuts

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