pacman.v1: maze.io/x/pacman.v1 Index | Files

package pacman

import "maze.io/x/pacman.v1"

Index

Package Files

checksum.go desc.go package.go repository.go split.go tarball.go version.go

Variables

var DefaultHTTPClient = http.DefaultClient

DefaultHTTPClient is the HTTP client that is used for doing HTTP transfers.

var (
    ErrUnsupported = errors.New("pacman: unsupported archive format")
)

Errors

func Compare Uses

func Compare(a, b *Package) int

Compare packages by version

func MarshalDesc Uses

func MarshalDesc(d interface{}) (string, error)

MarshalDesc marshals a struct to a pacman Package description file ("desc").

func SplitArchiveName Uses

func SplitArchiveName(name string) (pkg, version, arch, ext string, ok bool)

SplitArchiveName splits an archive filename into package name, version, architecture and archive extension.

func SplitPackageName Uses

func SplitPackageName(name string) (pkg, version string, ok bool)

SplitPackageName takes a package name with version into the package name and version.

func VersionCompare Uses

func VersionCompare(a, b string) int

VersionCompare compares two package versions.

type Package Uses

type Package struct {
    Filename        string    `desc:"FILENAME"`
    Name            string    `desc:"NAME"`
    Version         string    `desc:"VERSION"`
    Base            string    `desc:"BASE"`
    Description     string    `desc:"DESCR"`
    Size            int64     `desc:"ISIZE"`
    CompressedSize  int64     `desc:"CSIZE"`
    MD5             []byte    `desc:"MD5SUM,hex"`
    SHA256          []byte    `desc:"SHA256SUM,hex"`
    PGPSignature    []byte    `desc:"PGPSIG"`
    URL             *url.URL  `desc:"URL,string"`
    Licenses        []string  `desc:"LICENSE"`
    Arch            string    `desc:"ARCH"`
    Depends         []string  `desc:"DEPENDS"`
    OptionalDepends []string  `desc:"OPTDEPENDS"`
    MakeDepends     []string  `desc:"MAKEDEPENDS"`
    CheckDepends    []string  `desc:"CHECKDEPENDS"`
    MakepkgOptions  []string  `desc:"MAKEPKGOPTS"`
    Backups         []string  `desc:"BACKUPS"`
    Replaces        []string  `desc:"REPLACES"`
    Provides        []string  `desc:"PROVIDES"`
    Conflicts       []string  `desc:"CONFLICTS"`
    Groups          []string  `desc:"GROUPS"`
    BuildDate       time.Time `desc:"BUILDDATE"`
    Packager        string    `desc:"PACKAGER"`
}

Package holds information about a single package.

func ReadPackage Uses

func ReadPackage(name string) (*Package, error)

ReadPackage parses a package tarball.

func ReadPackageInfo Uses

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

ReadPackageInfo reads package information from a reader. The format is expected to be in PKGINFO format.

func (*Package) Epoch Uses

func (pkg *Package) Epoch() int

Epoch returns the numeric epoch for the package.

func (*Package) String Uses

func (pkg *Package) String() string

func (*Package) WriteDescTo Uses

func (pkg *Package) WriteDescTo(w io.Writer) (int64, error)

WriteDescTo writes a repository database package description.

type Packages Uses

type Packages []*Package

Packages is a slice of Package that is sortable by version

func (Packages) Len Uses

func (pkgs Packages) Len() int

func (Packages) Less Uses

func (pkgs Packages) Less(i, j int) bool

func (Packages) Swap Uses

func (pkgs Packages) Swap(i, j int)

type Repository Uses

type Repository struct {
    Packages map[string]*Package
}

Repository is a collection of packages

func OpenRepository Uses

func OpenRepository(name string) (*Repository, error)

OpenRepository opens the repository file with name, or, if name is an URL, it performs a HTTP GET using the DefaultHTTPClient.

func ReadRepository Uses

func ReadRepository(rc io.ReadCloser) (*Repository, error)

ReadRepository reads a repository manifest from the supplied reader.

func (*Repository) WriteTo Uses

func (repo *Repository) WriteTo(w io.Writer) (int64, error)

WriteTo writes a Tape Archive (tar) of all package descriptions to the Writer.

type TarBall Uses

type TarBall struct {
    *tar.Reader
    // contains filtered or unexported fields
}

TarBall is a compressed Tape Archive (tar).

func OpenTarBall Uses

func OpenTarBall(name string) (*TarBall, error)

OpenTarBall opens a (compressed) Tape Archive (tar)

func ReadTarBall Uses

func ReadTarBall(rc io.ReadCloser) (*TarBall, error)

ReadTarBall reads a compressed Tape Archive (tar) from a ReadCloser.

func (*TarBall) Close Uses

func (t *TarBall) Close() error

Close the underlying ReadCloser.

type Version Uses

type Version struct {
    Epoch   string
    Version string
    Release string
}

Version is an EVR (epoch, version, release) tuple

func ParseVersion Uses

func ParseVersion(evr string) Version

ParseVersion parses an EVR (Epoch:Version-Release) version string.

func (Version) Compare Uses

func (version Version) Compare(other Version) int

Compare this version with other version.

func (Version) LessThan Uses

func (version Version) LessThan(other Version) bool

LessThan returns true if this version is less than the other version.

Package pacman imports 23 packages (graph). Updated 2019-01-28. Refresh now. Tools for package owners.