xrepo

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2022 License: ISC Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoIndex = fmt.Errorf("index not found: %s", repoIndexFile)

ErrNoIndex is returned if the repository's index property list isn't found.

Functions

This section is empty.

Types

type FilterFunc

type FilterFunc func(*Package) bool

FilterFunc is a function that returns true if a package matches the filter, and false otherwise. Filters must not modify the packages they filter.

type Package

type Package struct {
	PackageVersion string `plist:"pkgver" json:"-"`
	Name           string `plist:"-" json:"name,omitempty"`
	Version        string `plist:"-" json:"version,omitempty"`
	Revision       int    `plist:"-" json:"revision,omitempty"`

	Repository     string `plist:"-" json:"repository,omitempty"`
	Architecture   string `plist:"architecture" json:"architecture,omitempty"`
	BuildDate      Time   `plist:"build-date" json:"build_date,omitempty"`
	BuildOptions   string `plist:"build-options" json:"build_options,omitempty"`
	FilenameSHA256 string `plist:"filename-sha256" json:"filename_sha256,omitempty"`
	FilenameSize   int64  `plist:"filename-size" json:"filename_size,omitempty"`
	Homepage       *URL   `plist:"homepage" json:"homepage,omitempty"`
	InstalledSize  int64  `plist:"installed_size" json:"installed_size,omitempty"`
	License        string `plist:"license" json:"license,omitempty"`
	Maintainer     string `plist:"maintainer" json:"maintainer,omitempty"`
	ShortDesc      string `plist:"short_desc" json:"short_desc,omitempty"`
	Preserve       bool   `plist:"preserve" json:"preserve,omitempty"`

	SourceRevisions string `plist:"source-revisions" json:"source_revisions,omitempty"`

	RunDepends []string `plist:"run_depends" json:"run_depends,omitempty"`

	ShlibRequires []string `plist:"shlib-requires" json:"shlib_requires,omitempty"`
	ShlibProvides []string `plist:"shlib-provides" json:"shlib_provides,omitempty"`

	Conflicts []string `plist:"conflicts" json:"conflicts,omitempty"`
	Reverts   []string `plist:"reverts" json:"reverts,omitempty"`

	Replaces     []string            `plist:"replaces" json:"replaces,omitempty"`
	Alternatives map[string][]string `plist:"alternatives" json:"alternatives,omitempty"`

	ConfFiles []string `plist:"conf_files" json:"conf_files,omitempty"`

	Index int    `plist:"-" json:"-"`
	ETag  string `plist:"-" json:"-"`
}

Package describes an XBPS package as stored in a repository's repodata.

type Packages

type Packages []*Package

Packages holds a slice of packages.

func (Packages) Filter

func (ps Packages) Filter(filter FilterFunc) Packages

Filter returns a new Packages slice containing only packages that match the filter. The filter must not modify packages.

type RepoData

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

RepoData describes an XBPS repository.

func NewRepoData

func NewRepoData() *RepoData

NewRepoData allocates a new, empty repodata. It must be populated using LoadRepo.

func (*RepoData) ETag

func (rd *RepoData) ETag() string

ETag returns the precomputed etag of the received.

func (*RepoData) Index

func (rd *RepoData) Index() Packages

Index returns the complete set of packages held in the RepoData. Callers must not modify the returned slice or packages.

func (*RepoData) LoadRepo

func (rd *RepoData) LoadRepo(path, repo string) error

LoadRepo attempts to load repodata from the given path and assigns packages the given repo string as their repository (not a field formally defined by an XBPS repository). If repo is an empty string, it attempts to determine the repository from the path.

If an error is returned, the receiver is in an undefined state.

func (*RepoData) NameIndex

func (rd *RepoData) NameIndex() []string

NameIndex returns the name of all packages, without version and revision.

func (*RepoData) Package

func (rd *RepoData) Package(name string) *Package

Package returns the package, if any, identified by name. If no such package exists, it returns nil.

func (*RepoData) ReadRepo

func (rd *RepoData) ReadRepo(r io.Reader, repo string) error

ReadRepo reads a repository's repodata from the given io.Reader. It assigns all packages in r the given repo string. If repo is an empty string, it attempts to

func (*RepoData) ReadRepoIndex

func (rd *RepoData) ReadRepoIndex(r io.Reader, repo string) error

ReadRepoIndex reads a repository's repodata index property list and adds all package data from that to the receiver RepoData. This is rarely called directly.

type Time

type Time time.Time

Time is repodata-marshaling-friendly time.Time.

func (Time) MarshalText

func (t Time) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (Time) Time

func (t Time) Time() time.Time

Time returns the receiver as a time.Time.

func (*Time) UnmarshalText

func (t *Time) UnmarshalText(p []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type URL

type URL url.URL

URL is a repodata-marshaling-friendly url.URL.

func (*URL) MarshalText

func (u *URL) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler.

func (*URL) URL

func (u *URL) URL() *url.URL

URL returns the receiver as a url.URL.

func (*URL) UnmarshalText

func (u *URL) UnmarshalText(p []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

Jump to

Keyboard shortcuts

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