Documentation
¶
Index ¶
- Variables
- func CompareVersions(a, b string) int
- func IsMaintainerScript(name string) bool
- func ParseControl(data []byte) (*Control, *Fields, error)
- func RelationName(relation string) (string, string)
- func SplitDescription(value string) (string, string)
- func SplitRelations(value string) []string
- type Archive
- type Compression
- type Control
- type Entry
- type Field
- type Fields
- type File
- type MDAudit
- type Member
- type Options
- type Package
- type Script
- type Summary
Constants ¶
This section is empty.
Variables ¶
var AdditionalControlFiles = []string{"templates", "triggers", "shlibs", "symbols"}
AdditionalControlFiles are non-executable control members accepted.
var ErrInvalidArchive = errors.New("invalid ar archive")
ErrInvalidArchive reports a malformed Unix ar archive.
var MaintainerScripts = []string{"preinst", "postinst", "prerm", "postrm", "config"}
MaintainerScripts are the only executable control members accepted.
Functions ¶
func CompareVersions ¶
CompareVersions compares two Debian versions using dpkg semantics. It returns -1, 0 or 1 when a is lower than, equal to or greater than b.
func IsMaintainerScript ¶
IsMaintainerScript reports whether name is a known maintainer script.
func ParseControl ¶
ParseControl parses a control stanza into typed fields.
func RelationName ¶
RelationName extracts the package name and version constraint from a dependency relation such as "libc6 (>= 2.38) [amd64]" or "foo | bar".
func SplitDescription ¶
SplitDescription separates the synopsis from the extended description.
func SplitRelations ¶
SplitRelations splits a comma separated dependency field.
Types ¶
type Archive ¶
type Archive struct {
Control Control
Fields []Field
RawControl []byte
Members []Member
Entries []Entry
MD5Sums map[string]string
Conffiles []string
Scripts map[string]Script
ControlFiles map[string]Script
ControlCompression Compression
DataCompression Compression
DebianBinary string
Size int64
MD5 string
SHA1 string
SHA256 string
}
Archive is a parsed binary package.
type Compression ¶
type Compression string
Compression identifies a tar payload compressor supported by dpkg.
const ( CompressionGzip Compression = "gzip" CompressionZstd Compression = "zstd" CompressionXz Compression = "xz" CompressionBzip2 Compression = "bzip2" )
Supported compressors. bzip2 is accepted when reading but never written.
func CompressionFromMember ¶
func CompressionFromMember(name string) (Compression, bool)
CompressionFromMember detects the compressor from a tar member name.
func ParseCompression ¶
func ParseCompression(value string) (Compression, error)
ParseCompression validates a user supplied compressor name.
func (Compression) Ext ¶
func (c Compression) Ext() string
Ext returns the file extension used in member names.
func (Compression) TarName ¶
func (c Compression) TarName(base string) string
TarName returns a member name such as "data.tar.zst".
func (Compression) Writable ¶
func (c Compression) Writable() bool
Writable reports whether this compressor can be used for new packages.
type Control ¶
type Control struct {
Package string
Source string
Version string
Architecture string
Maintainer string
InstalledSize int64
Section string
Priority string
MultiArch string
Essential bool
Homepage string
Description string
Extended string
PreDepends []string
Depends []string
Recommends []string
Suggests []string
Enhances []string
Breaks []string
Conflicts []string
Replaces []string
Provides []string
BuiltUsing string
Extra map[string]string
}
Control is the binary package metadata kept in control.tar.
type Entry ¶
type Entry struct {
Path string
IsDir bool
Mode fs.FileMode
Size int64
Link string
Typeflag byte
UID int
GID int
Uname string
Gname string
MD5 string
ModTime time.Time
}
Entry is one data.tar member.
type Fields ¶
type Fields struct {
// contains filtered or unexported fields
}
Fields preserves the order of deb822 fields.
func ParseFields ¶
ParseFields parses the first deb822 stanza in data. Any trailing stanzas are ignored; every caller in debsmith works with single-stanza documents.
type Options ¶
type Options struct {
Compression Compression
ControlCompression Compression
Epoch time.Time
}
Options controls archive layout and compression.
type Package ¶
type Package struct {
Control Control
Files []File
Conffiles []string
Scripts map[string][]byte
ControlFiles map[string][]byte
}
Package is the complete input of a .deb build.