packfile

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Deb = "deb"
	Rpm = "rpm"
	Apk = "apk"
)
View Source
const (
	Arch64  = "amd64"
	Arch32  = "i386"
	ArchAll = "all"
	ArchNo  = "noarch"
)
View Source
const (
	PermFile = 0o644
	PermExec = 0o755
	PermDir  = 0o755
)
View Source
const (
	DirEtc    = "etc"
	DirVar    = "var"
	DirLog    = "var/log"
	DirOpt    = "opt"
	DirBin    = "bin"
	DirBinUsr = "usr/bin"
	DirDoc    = "usr/share/doc"
)
View Source
const (
	EnvMaintainerName = "PACK_MAINTAINER_NAME"
	EnvMaintainerMail = "PACK_MAINTAINER_MAIL"
)
View Source
const (
	EnvArchive = "archive"
	EnvBash    = "bash"
	EnvShell   = "shell"
)
View Source
const (
	DefaultVersion  = "0.1.0"
	DefaultLicense  = "mit"
	DefaultSection  = "utils"
	DefaultPriority = "optional"
	DefaultOS       = "linux"
	DefaultShell    = "/bin/sh"
	DefaultUser     = "root"
	DefaultGroup    = "root"
)
View Source
const (
	ConstraintEq = "eq"
	ConstraintNe = "ne"
	ConstraintGt = "gt"
	ConstraintGe = "ge"
	ConstraintLt = "lt"
	ConstraintLe = "le"
)
View Source
const (
	FileFlagConf         = 1 << 0
	FileFlagDoc          = 1 << 1
	FileFlagAllowMissing = 1 << 3
	FileFlagNoReplace    = 1 << 4
	FileFlagGhost        = 1 << 6
	FileFlagLicense      = 1 << 7
	FileFlagReadme       = 1 << 8
	FileFlagExec         = 1 << 9
	FileFlagDir          = 1 << 12

	FileFlagRegular = FileFlagConf | FileFlagDoc | FileFlagLicense | FileFlagReadme
)
View Source
const (
	EOF rune = -(1 << iota)
	EOL
	Comment
	LocalVar
	EnvVar
	Literal
	String
	Heredoc
	Template
	Number
	Boolean
	BegObj
	EndObj
	BegArr
	EndArr
	BegGrp
	EndGrp
	Comma
	Macro
	Invalid
)

Variables

This section is empty.

Functions

func GetPermissionFromPath

func GetPermissionFromPath(file string) int64

Types

type Change

type Change struct {
	Summary string
	Changes []string
	Version string
	When    time.Time
	Maintainer
}

type Compiler

type Compiler struct {
	Name    string
	Version string
}

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(context string, config *DecoderConfig) (*Decoder, error)

func (*Decoder) Decode

func (d *Decoder) Decode() (*Package, error)

func (*Decoder) DecodeInto added in v0.3.2

func (d *Decoder) DecodeInto(pkg *Package) error

type DecoderConfig added in v0.3.2

type DecoderConfig struct {
	NoIgnore   bool
	DryRun     bool
	IgnoreFile string
	Packfile   string
	Type       string
	Licenses   string

	EnvFile string
}

type Dependency

type Dependency struct {
	Package    string
	Constraint string // gt, ge, lt, le,...
	Version    string
	Arch       string
	Type       string // breaks, suggests, recommands,...
}

type Environ

type Environ struct {
	// contains filtered or unexported fields
}

func Empty

func Empty() *Environ

func Enclosed added in v0.3.2

func Enclosed(parent *Environ) *Environ

func (*Environ) Define

func (e *Environ) Define(ident string, value any) error

func (*Environ) Resolve

func (e *Environ) Resolve(ident string) (any, error)

type Maintainer

type Maintainer struct {
	Name  string
	Email string
}

type Package

type Package struct {
	Setup    string
	Teardown string

	Name    string
	Summary string
	Desc    string
	Version string
	Release string
	Home    string
	Vendor  string
	Distrib string

	BuildWith   Compiler
	PackageType string

	Essential bool

	Arch     string
	Os       string
	Section  string
	Priority string

	License string

	PreInst     string
	PostInst    string
	PreRem      string
	PostRem     string
	CheckScript string

	Maintainer Maintainer
	Depends    []Dependency
	Changes    []Change

	Digest int
	Files  []Resource
}

func Load

func Load(file, context string) (*Package, error)

func (*Package) Breaks

func (p *Package) Breaks() []Dependency

func (*Package) Conflicts

func (p *Package) Conflicts() []Dependency

func (*Package) Enhances

func (p *Package) Enhances() []Dependency

func (*Package) GetDirDoc

func (p *Package) GetDirDoc(file string) string

func (*Package) OnlyDocs added in v0.4.0

func (p *Package) OnlyDocs() *Package

func (*Package) PackageName

func (p *Package) PackageName() string

func (*Package) Provides

func (p *Package) Provides() []Dependency

func (*Package) Recommends

func (p *Package) Recommends() []Dependency

func (*Package) Replaces

func (p *Package) Replaces() []Dependency

func (*Package) Requires

func (p *Package) Requires() []Dependency

func (*Package) Split added in v0.4.0

func (p *Package) Split() []*Package

func (*Package) Suggests

func (p *Package) Suggests() []Dependency

func (*Package) TotalSize

func (p *Package) TotalSize() int64

type Position

type Position struct {
	Line   int
	Column int
}

type Resource

type Resource struct {
	Path     string
	Local    io.ReadCloser
	Target   string
	Perm     int64
	Compress bool

	Flags int64

	Size    int64
	Lastmod time.Time
	Hash    string
}

func (Resource) IsConfig

func (r Resource) IsConfig() bool

func (Resource) IsDirectory

func (r Resource) IsDirectory() bool

func (Resource) IsRegular

func (r Resource) IsRegular() bool

type Scanner

type Scanner struct {
	Position
	// contains filtered or unexported fields
}

func Scan

func Scan(r io.Reader) *Scanner

func (*Scanner) All

func (s *Scanner) All() iter.Seq[Token]

func (*Scanner) Scan

func (s *Scanner) Scan() Token

type Token

type Token struct {
	Literal string
	Type    rune
	Position
}

func (Token) String

func (t Token) String() string

Jump to

Keyboard shortcuts

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