Help us shape the future of Go! Take the 2026 Go Developer Survey

debian

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropertyDistribution               = "debian.distribution"
	PropertyComponent                  = "debian.component"
	PropertyArchitecture               = "debian.architecture"
	PropertyControl                    = "debian.control"
	PropertyRepositoryIncludeInRelease = "debian.repository.include_in_release"

	SettingKeyPrivate = "debian.key.private"
	SettingKeyPublic  = "debian.key.public"

	RepositoryPackage = "_debian"
	RepositoryVersion = "_repository"
)

Variables

View Source
var GlobalVars = sync.OnceValue(func() (ret struct {
	ErrMissingControlFile     error
	ErrUnsupportedCompression error
	ErrInvalidName            error
	ErrInvalidVersion         error
	ErrInvalidArchitecture    error

	namePattern    *regexp.Regexp
	versionPattern *regexp.Regexp
	symbolPattern  *regexp.Regexp
},
) {
	ret.ErrMissingControlFile = util.NewInvalidArgumentErrorf("control file is missing")
	ret.ErrUnsupportedCompression = util.NewInvalidArgumentErrorf("unsupported compression algorithm")
	ret.ErrInvalidName = util.NewInvalidArgumentErrorf("package name is invalid")
	ret.ErrInvalidVersion = util.NewInvalidArgumentErrorf("package version is invalid")
	ret.ErrInvalidArchitecture = util.NewInvalidArgumentErrorf("package architecture is invalid")

	ret.namePattern = regexp.MustCompile(`\A[a-z0-9][a-z0-9+-.]+\z`)

	ret.versionPattern = regexp.MustCompile(`\A(?:(0|[1-9][0-9]*):)?[a-zA-Z0-9.+~]+(?:-[a-zA-Z0-9.+-~]+)?\z`)

	ret.symbolPattern = regexp.MustCompile(`\A[a-zA-Z0-9][a-zA-Z0-9.~+_-]*\z`)
	return ret
})

Functions

func IsValidDistributionOrComponent added in v1.3.0

func IsValidDistributionOrComponent(s string) bool

Types

type Metadata

type Metadata struct {
	Maintainer   string   `json:"maintainer,omitempty"`
	ProjectURL   string   `json:"project_url,omitempty"`
	Description  string   `json:"description,omitempty"`
	Dependencies []string `json:"dependencies,omitempty"`
}

type Package

type Package struct {
	Name         string
	Version      string
	Architecture string
	Control      string
	Metadata     *Metadata
}

func ParseControlFile

func ParseControlFile(r io.Reader) (*Package, error)

ParseControlFile parses a Debian control file to retrieve the metadata

func ParsePackage

func ParsePackage(r io.Reader) (*Package, error)

ParsePackage parses the Debian package file https://manpages.debian.org/bullseye/dpkg-dev/deb.5.en.html

Jump to

Keyboard shortcuts

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