Documentation ¶
Overview ¶
Package pkg provides the data structures for a package, a package catalog, package types, and domain-specific metadata.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AllLanguages = []Language{ Java, JavaScript, Python, Ruby, Go, }
var AllPkgs = []Type{ ApkPkg, BundlerPkg, DebPkg, EggPkg, RpmPkg, WheelPkg, NpmPkg, YarnPkg, PythonRequirementsPkg, PythonSetupPkg, JavaPkg, JenkinsPluginPkg, GoModulePkg, }
Functions ¶
This section is empty.
Types ¶
type ApkFileRecord ¶
type ApkFileRecord struct { Path string `json:"path"` OwnerUID string `json:"ownerUid"` OwnerGUI string `json:"ownerGid"` Permissions string `json:"permissions"` Checksum string `json:"checksum"` }
ApkFileRecord represents a single file listing and metadata from a APK DB entry (which may have many of these file records).
type ApkMetadata ¶
type ApkMetadata struct { Package string `mapstructure:"P" json:"package"` OriginPackage string `mapstructure:"o" json:"originPackage"` Maintainer string `mapstructure:"m" json:"maintainer"` Version string `mapstructure:"V" json:"version"` License string `mapstructure:"L" json:"license"` Architecture string `mapstructure:"A" json:"architecture"` URL string `mapstructure:"U" json:"url"` Description string `mapstructure:"T" json:"description"` Size int `mapstructure:"S" json:"size"` InstalledSize int `mapstructure:"I" json:"installedSize"` PullDependencies string `mapstructure:"D" json:"pullDependencies"` PullChecksum string `mapstructure:"C" json:"pullChecksum"` GitCommitOfAport string `mapstructure:"c" json:"gitCommitOfApkPort"` Files []ApkFileRecord `json:"files"` }
ApkMetadata represents all captured data for a Alpine DB package entry. See https://wiki.alpinelinux.org/wiki/Apk_spec for more information.
func (ApkMetadata) PackageURL ¶
func (m ApkMetadata) PackageURL() string
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog represents a collection of Packages.
func (*Catalog) Enumerate ¶
Enumerate all packages for the given type(s), enumerating all packages if no type is specified.
func (*Catalog) PackageCount ¶
PackageCount returns the total number of packages that have been added.
func (*Catalog) PackagesByFile ¶
PackagesByFile returns all packages that were discovered from the given source file reference.
type DpkgMetadata ¶
type DpkgMetadata struct { Package string `mapstructure:"Package" json:"package"` Source string `mapstructure:"Source" json:"source"` Version string `mapstructure:"Version" json:"version"` Architecture string `mapstructure:"Architecture" json:"architecture"` }
DpkgMetadata represents all captured data for a Debian package DB entry; available fields are described at http://manpages.ubuntu.com/manpages/xenial/man1/dpkg-query.1.html in the --showformat section.
func (DpkgMetadata) PackageURL ¶
func (m DpkgMetadata) PackageURL(d distro.Distro) string
type JavaManifest ¶
type JavaManifest struct { Name string `mapstructure:"Name" json:"name"` ManifestVersion string `mapstructure:"Manifest-Version" json:"manifestVersion"` SpecTitle string `mapstructure:"Specification-Title" json:"specificationTitle"` SpecVersion string `mapstructure:"Specification-Version" json:"specificationVersion"` SpecVendor string `mapstructure:"Specification-Vendor" json:"specificationVendor"` ImplTitle string `mapstructure:"Implementation-Title" json:"implementationTitle"` ImplVersion string `mapstructure:"Implementation-Version" json:"implementationVersion"` ImplVendor string `mapstructure:"Implementation-Vendor" json:"implementationVendor"` Extra map[string]string `mapstructure:",remain" json:"extraFields"` }
JavaManifest represents the fields of interest extracted from a Java archive's META-INF/MANIFEST.MF file.
type JavaMetadata ¶
type JavaMetadata struct { Manifest *JavaManifest `mapstructure:"Manifest" json:"manifest"` PomProperties *PomProperties `mapstructure:"PomProperties" json:"pomProperties"` Parent *Package `json:"parentPackage"` // TODO: should this be included in the json output? }
JavaMetadata encapsulates all Java ecosystem metadata for a package as well as an (optional) parent relationship.
func (JavaMetadata) PackageURL ¶
func (m JavaMetadata) PackageURL() string
type Package ¶
type Package struct { Name string `json:"manifest"` // the package name Version string `json:"version"` // the version of the package FoundBy string `json:"foundBy"` // the specific cataloger that discovered this package Source []file.Reference `json:"sources"` // the locations that lead to the discovery of this package (note: this is not necessarily the locations that make up this package) // TODO: should we move licenses into metadata? Licenses []string `json:"licenses"` // licenses discovered with the package metadata Language Language `json:"language"` // the language ecosystem this package belongs to (e.g. JavaScript, Python, etc) Type Type `json:"type"` // the package type (e.g. Npm, Yarn, Egg, Wheel, Rpm, Deb, etc) Metadata interface{} `json:"metadata,omitempty"` // additional data found while parsing the package source // contains filtered or unexported fields }
Package represents an application or library that has been bundled into a distributable format.
func (Package) PackageURL ¶
PackageURL returns a package-URL representation of the given package (see https://github.com/package-url/purl-spec)
type PomProperties ¶
type PomProperties struct { Path string Name string `mapstructure:"name" json:"name"` GroupID string `mapstructure:"groupId" json:"groupId"` ArtifactID string `mapstructure:"artifactId" json:"artifactId"` Version string `mapstructure:"version" json:"version"` Extra map[string]string `mapstructure:",remain" json:"extraFields"` }
PomProperties represents the fields of interest extracted from a Java archive's pom.xml file.
type RpmMetadata ¶
type RpmMetadata struct { Name string `json:"name"` Version string `json:"version"` Epoch int `json:"epoch"` Arch string `json:"architecture"` Release string `json:"release"` SourceRpm string `json:"sourceRpm"` Size int `json:"size"` License string `json:"license"` Vendor string `json:"vendor"` }
RpmMetadata represents all captured data for a RPM DB package entry.
func (RpmMetadata) PackageURL ¶
func (m RpmMetadata) PackageURL(d distro.Distro) string
type Type ¶
type Type string
Type represents a Package Type for or within a language ecosystem (there may be multiple package types within a language ecosystem)
const ( UnknownPkg Type = "UnknownPackage" ApkPkg Type = "apk" BundlerPkg Type = "bundle" DebPkg Type = "deb" EggPkg Type = "egg" // PacmanPkg Type = "pacman" RpmPkg Type = "rpm" WheelPkg Type = "wheel" PoetryPkg Type = "poetry" NpmPkg Type = "npm" YarnPkg Type = "yarn" PythonRequirementsPkg Type = "python-requirements" PythonSetupPkg Type = "python-setup" JavaPkg Type = "java-archive" JenkinsPluginPkg Type = "jenkins-plugin" GoModulePkg Type = "go-module" )