Documentation ¶
Overview ¶
Package ports implements various handy functions to interact with CRUX ports.
This package is a work in progress and EXPERIMENTAL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Prtdir defines The root directory of the ports tree. PrtDir = "/usr/ports" // PkgDir defines the directory where created packages get stored. PkgDir = "." // SrcDir defines the directory where downloaded sources get stored. SrcDir = "." // WrkDir defines the root directory where packages get build.. WrkDir = "." // Order gets used to determine how to order multiple ports with the same // name, but residing in a different repository. The repository found first // in the Order variable being ordered firt. Order []string // Alias gets used used to alias one port location to another port location. Aliases [][]Location )
Functions ¶
Types ¶
type Database ¶
type Database struct {
Packages []Package
}
Database is a type describing the package database file. This file lists all installed packages, the version of these packages, and the files these packages installed.
type Footprint ¶
type Footprint struct { *Port Files []struct { Path string Permission Permission } }
A Footprint describes the `.footprint` file of a port. This file is used for regression testing and contains a list of files a package is expected to contain once it is built. TODO: Handle symlinks (`->`).
type Location ¶
A Location describes the location of a port. A port location consist of a ports-tree directory, a repo and a port. An example of a valid location would be `usr/ports/opt/firefox`.
type Md5sum ¶
An Md5sum is a type describing the `.md5sum` file of a port. This file is used to validate the sources of a port.
func (*Md5sum) Create ¶
Create creates an `.md5sum` file for a Port. This function requires `Pkgfile.Parse(true)` to be run prior.
type Permission ¶
type Permission struct { FileMode os.FileMode // TODO: Create a custom type for this. Owner string }
An Permission is a type describing the permission bits found in the `.md5sum` file of a port.
type Pkgfile ¶
type Pkgfile struct { *Port // Comments with various information that isn't strictly needed in order to // build a package. Description string URL string Maintainer string // Comments with information about dependencies. These need some more // parsing because some `Pkgfile`s use commas to separate dependencies, and // others use spaces. Depends []string Optional []string // BASH variables with various information that is required in order to // build a package. Name string Version string Release string // A BASH array with the sources needed to build a package. We probably need // to parse this by actually using `source(1)` because `Pkgfile`s often use // BASH variables (such as `$name` or `$version`) and bashisms in the source // variable. Source []string }
A Pkgfile is a type describing the `Pkgfile` file of a port. This file contains information about the package (such as `name`, `version`, et cetera) and the commands that should be executed in order to compile the package in question.
func (*Pkgfile) Parse ¶
Parse parses the `Pkgfile` file of a port and populates the various fields in the given `*Pkgfile`. Keep in mind that this does not expand BASH ariables by default. so `$version` will just be a literal string. Nor does this parse the `source` field of a `Pkgfile` because it often uses variables in the string and because it's simply too hard too parse.
If you want to expand BASH variables pass a bool as a parameter. This will force the use of a bash interpreter to get the variables in `Pkgfile`, this is relatively slow.
type Port ¶
type Port struct { // Location specifies the location of the port, this is used as the "primary // key" of a port type. Location Location // TODO: Add signature, .nostrip, et cetera. Footprint Footprint Md5sum Md5sum Pkgfile Pkgfile // Depends is a "recursive variable" that list all dependencies recursively. // This Depends []*Port }
A Port describes a port. A port is a directory containing the files needed for building a package.
func Locate ¶
Locate tries to locate a port using a given list of Ports. It returns a list with possible ports, sorted according to the order parameter.
func New ¶
New returns a Port with the Location field populated. Use the various `Parse` functions to populate the other fields.
func (*Port) Alias ¶
func (p *Port) Alias()
Alias aliases ports by using the `Aliases` variable. An example of this would be aliasing `core/openssl` to `6c37/libressl`.