pkg

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2019 License: MPL-2.0 Imports: 2 Imported by: 85

Documentation

Overview

Package pkg defines a generic software package.

Index

Constants

This section is empty.

Variables

AllTypes enumerates all package types.

Functions

This section is empty.

Types

type Author

type Author struct {
	Name  string
	Email string
}

An Author is a package author.

type Deps

type Deps map[ID]Package

type File

type File struct {
	Path       string
	Qualifiers string // For example, Go build tags
}

TODO: Implement file-level granularity?

type ID

type ID struct {
	// Type, Name, and Revision describe _what_ package is being identified. The
	// combination of these three fields uniquely identifies a single package on
	// a semantic level.
	Type     Type
	Name     string
	Revision string

	// Location is _where_ the package is found. For example, an NPM package with
	// the same name and revision may be found in two different registries.
	Location string
}

An ID uniquely identifies a package.

func (*ID) String

func (id *ID) String() string

type Import

type Import struct {
	Target   string
	Resolved ID
}

An Import is a combination of a (potentially unresolved) dependency target and the exact resolved pkg.ID of the dependency.

type Imports

type Imports []Import

type LicenseExpr

type LicenseExpr string

A LicenseExpr is a raw string containing a SPDX-like license expression.

LicenseExprs are not exactly the same as SPDX expressions, because they may contain license identifiers that are not valid SPDX licenses.

type Package

type Package struct {
	ID ID

	Authors          []Author      `json:",omitempty"`
	Description      string        `json:",omitempty"`
	DeclaredLicenses []LicenseExpr `json:",omitempty"`
	ProjectURL       string        `json:",omitempty"` // URL of the project (often the "homepage" URL)
	SourceCodeURL    string        `json:",omitempty"` // URL at which source code can be obtained (often a git repository)
	RegistryURL      string        `json:",omitempty"` // URL of the package's registry (e.g. if using private registries)
	DownloadURL      string        `json:",omitempty"` // URL at which binaries or compiled bundles can be downloaded

	// These are specific to the package's build, and tell us metadata about _how_
	// this package was used.
	BuildTool      string // Example: `yarn`
	OriginManifest string // Example: `./package.json`
	Registry       string // Example: `npm:npmjs.org`

	Imports []Import

	// A package's resolution strategy is set by the analyzer which resolves it,
	// and the meaning will vary depending on the analyzer used.
	Strategy string
}

A Package represents a single package at a semantic level. The precise definition of "package" will vary from language to language.

type Qualifier

type Qualifier int
const (
	Production Qualifier = iota
	Development
	Test
)

type Type

type Type int

The Type of a Package indicates the ecosystem of the package. Generally, this corresponds to tool, registry, or language.

const (
	Invalid   Type = iota // Placeholder
	Ant                   // Apache Ant (https://ant.apache.org)
	Bower                 // Bower (https://bower.io)
	Buck                  // Buck (https://buckbuild.com)
	Carthage              // Carthage (https://github.com/Carthage/Carthage)
	Cocoapods             // Cocoapods (https://cocoapods.org)
	Composer              // Composer (https://getcomposer.org)
	Debian                // Debian (https://manpages.debian.org/stretch/dpkg/dpkg.1.en.html)
	Go                    // dep (https://github.com/golang/dep), glide (https://github.com/Masterminds/glide), godep (https://github.com/tools/godep), govendor (experimental, https://github.com/kardianos/govendor), vndr (https://github.com/LK4D4/vndr), gomodules (https://github.com/golang/go/wiki/Modules)
	Git                   // git
	Gradle                // Gradle (https://gradle.org)
	Haskell               // Haskell with cabal-install (https://www.haskell.org/cabal/) or stack (https://www.haskellstack.org/)
	Maven                 // Maven (https://maven.apache.org)
	NodeJS                // NPM (https://www.npmjs.com), Yarn (https://yarnpkg.com)
	NuGet                 // NuGet (https://www.nuget.org)
	OkBuck                // OkBuck (https://github.com/uber/okbuck)
	Python                // Pip (https://pip.pypa.io), Pipenv (https://pipenv.readthedocs.io/en/latest/)
	Ruby                  // Bundler (https://bundler.io)
	Rust                  // Cargo (https://github.com/rust-lang/cargo)
	Scala                 // SBT (https://www.scala-sbt.org)
	Raw                   // Unsupported languages
)

Supported package types.

func ParseType

func ParseType(key string) (Type, error)

ParseType returns the canonical package type given a string key. TODO: if we got rid of aliases, we could use `go generate` with https://github.com/alvaroloes/enumer.

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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