dependency

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause, MIT Imports: 4 Imported by: 0

Documentation

Overview

The Dependency module provides an interface to parse and inspect Debian Dependency relationships.

Dependency                |               foo, bar (>= 1.0) [amd64] | baz
  -> Relations            | -> Relation        bar (>= 1.0) [amd64] | baz
       -> Possibilities   | -> Possibility     bar (>= 1.0) [amd64]
          | Name          | -> Name            bar
          | Version       | -> Version             (>= 1.0)
          | Architectures | -> Arch                          amd64
          | Stages        |

Index

Constants

This section is empty.

Variables

View Source
var (
	Any = Arch{ABI: "any", OS: "any", CPU: "any"}
	All = Arch{ABI: "all", OS: "all", CPU: "all"}
)

Functions

This section is empty.

Types

type Arch

type Arch struct {
	ABI string
	OS  string
	CPU string
}

func ParseArch

func ParseArch(arch string) (*Arch, error)

func ParseArchitectures

func ParseArchitectures(arch string) ([]Arch, error)

func (*Arch) Is

func (arch *Arch) Is(other *Arch) bool

func (*Arch) IsWildcard

func (arch *Arch) IsWildcard() bool

func (Arch) MarshalControl

func (a Arch) MarshalControl() (string, error)

func (Arch) String

func (a Arch) String() string

func (*Arch) UnmarshalControl

func (arch *Arch) UnmarshalControl(data string) error

type ArchSet

type ArchSet struct {
	Not           bool
	Architectures []Arch
}

Arch models an architecture dependency restriction, commonly used to restrict the relation to one some architectures. This is also usually used in a string of many possibilities.

func (*ArchSet) Matches

func (set *ArchSet) Matches(other *Arch) bool

func (ArchSet) String

func (set ArchSet) String() string

type Dependency

type Dependency struct {
	Relations []Relation
}

A Dependency is the top level type that models a full Dependency relation.

func Parse

func Parse(in string) (*Dependency, error)

Parse a string into a Dependency object. The input should look something like "foo, bar | baz".

func (*Dependency) GetAllPossibilities

func (dep *Dependency) GetAllPossibilities() []Possibility

func (*Dependency) GetPossibilities

func (dep *Dependency) GetPossibilities(arch Arch) []Possibility

func (*Dependency) GetSubstvars

func (dep *Dependency) GetSubstvars() []Possibility

func (Dependency) MarshalControl

func (dep Dependency) MarshalControl() (string, error)

func (Dependency) String

func (dependency Dependency) String() string

func (*Dependency) UnmarshalControl

func (dep *Dependency) UnmarshalControl(data string) error

type Possibility

type Possibility struct {
	Name          string
	Arch          *Arch
	Architectures *ArchSet
	StageSets     []StageSet
	Version       *VersionRelation
	Substvar      bool
}

Possibility models a concrete Possibility that may be satisfied in order to satisfy the Dependency Relation. Given the Dependency line:

Depends: foo, bar | baz

All of foo, bar and baz are Possibilities. Possibilities may come with further restrictions, such as restrictions on Version, Architecture, or Build Stage.

func (Possibility) String

func (possi Possibility) String() string

type Relation

type Relation struct {
	Possibilities []Possibility
}

A Relation is a set of Possibilities that must be satisfied. Given the Dependency line:

Depends: foo, bar | baz

There are two Relations, one composed of foo, and another composed of bar and baz.

func (Relation) String

func (relation Relation) String() string

type Stage

type Stage struct {
	Not  bool
	Name string
}

func (Stage) String

func (stage Stage) String() string

type StageSet

type StageSet struct {
	Stages []Stage
}

func (StageSet) String

func (stageSet StageSet) String() string

type VersionRelation

type VersionRelation struct {
	Number   string
	Operator string
}

VersionRelation models a version restriction on a possibility, such as greater than version 1.0, or less than 2.0. The values that are valid in the Operator field are defined by section 7.1 of Debian policy.

The relations allowed are <<, <=, =, >= and >> for strictly earlier,
earlier or equal, exactly equal, later or equal and strictly later,
respectively.

func (VersionRelation) SatisfiedBy

func (v VersionRelation) SatisfiedBy(ver version.Version) bool

func (VersionRelation) String

func (version VersionRelation) String() string

Jump to

Keyboard shortcuts

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