Documentation ¶
Overview ¶
Package vendeps provides functionality for managing vendored external dependencies.
Index ¶
- Variables
- func AcceptableLicense(options string) (license string, ok bool)
- func ApplyPatches(dir string, patchArgs []string, patches []string) error
- func CheckDependencies(fsys fs.FS) error
- func DigestDirectory(fsys fs.FS, dir string, ignore ...string) (string, error)
- func DigestFiles(fsys fs.FS, filenames []string) (string, error)
- func FetchGoModule(ctx context.Context, mod *GoModule, dir string) error
- func FetchRustCrate(ctx context.Context, crate *RustCrate, dir string) error
- func MajorUpdate(current, next string) bool
- func RenderGoPackageBuildFile(name string, pkg *GoPackage) ([]byte, error)
- func RenderManifest(name string, manifest *Deps) ([]byte, error)
- func RenderRustCrateBuildFile(name string, crate *RustCrate) ([]byte, error)
- func UpdateDependencies(name string) error
- func UpdateGoModule(ctx context.Context, mod *UpdateDep) (updated bool, err error)
- func UpdateRustCrate(ctx context.Context, crate *UpdateDep) (updated bool, err error)
- type Action
- type BuildCacheManifest
- type CopyBUILD
- type Deps
- type DownloadGoModule
- type DownloadRustCrate
- type GenerateGoPackageBUILD
- type GenerateRustCrateBUILD
- type GoModule
- type GoPackage
- type RemoveAll
- type RustCrate
- type UpdateDep
- type UpdateDeps
- type Vulns
Constants ¶
This section is empty.
Variables ¶
var Licenses = map[string]string{
"0BSD": "BSD Zero Clause License",
"Apache-2.0": "Apache License 2.0",
"BSD-2-Clause": "BSD 2-Clause \"Simplified\" License",
"BSD-3-Clause": "BSD 3-Clause \"New\" or \"Revised\" License",
"MIT": "MIT License",
}
Licenses is the set of acceptable software licenses, referenced by their SPDX id.
Functions ¶
func AcceptableLicense ¶
AcceptableLicense determines whether the given set of licenses includes at least one acceptable license as described above.
func ApplyPatches ¶
ApplyPatches applies the given set of patch files to the directory specified.
func CheckDependencies ¶
CheckDependencies assesses the dependency set for unused dependencies.
func DigestDirectory ¶
DigestDirectory produces the digest for a directory and its contents in a filesystem. This is performed by hashing one line of text for each file, with the files sorted into lexographical order. Each line consists of the hexadecimal digest of the file's contents, two spaces (\x20), the relative filename, and a newline (\x0a).
Filenames containing a newline (\x0a) are not allowed.
Any filenames listed in ignore are not included in the hashing process.
The final digest is formatted as the hash algorithm name, a colon (\x3a), and the hexadecimal digest.
func DigestFiles ¶
DigestFiles produces the digest for a set of named files and their contents in a filesystem. This is performed by hashing one line of text for each file, with the files sorted into lexographical order. Each line consists of the hexadecimal digest of the file's contents, two spaces (\x20), the relative filename, and a newline (\x0a).
Filenames containing a newline (\x0a) are not allowed.
The final digest is formatted as the hash algorithm name, a colon (\x3a), and the hexadecimal digest.
func FetchGoModule ¶
FetchGoModule downloads a Go module using the proxy.golang.org Go module proxy API.
func FetchRustCrate ¶
FetchRustCrate downloads a Rust crate using the crates.io API.
func MajorUpdate ¶
MajorUpdate returns true if the newer version has a different major number, or if both have major version 0 and the newer version has a different minor version.
func RenderGoPackageBuildFile ¶
RenderGoPackageBuildFile generates a build file for the given Go package.
func RenderManifest ¶
RenderManifest generates a dependency manifest from the given set of dependencies.
func RenderRustCrateBuildFile ¶
RenderRustCrateBuildFile generates a build file for the given Rust crate.
func UpdateDependencies ¶
UpdateDependencies parses the given set of dependencies and checks each for an update, updating the document if possible.
Note that UpdateDependencies does not modify the set of vendored dependencies, only the dependency specification.
func UpdateGoModule ¶
UpdateGoModule checks a Go module for updates, using the proxy.golang.org Go module proxy API.
Types ¶
type Action ¶
Action represents a logical action that should be taken to progress the vendoring of a set of software dependencies.
An action should contain any context necessary to perform its tasks.
func StripCachedActions ¶
StripCachedActions processes the action sequence, removing any actions that the cache can prove are unnecessary, returning the resulting action sequence.
If no actions can be cached, or if there is no cache, the unmodified action sequence is returned.
type BuildCacheManifest ¶
BuildCacheManifest indicates that the cache subsystem should scan the vendor filesystem, producing the information necessary to avoid unnecessary future work, writing it to the given path.
func (BuildCacheManifest) String ¶
func (c BuildCacheManifest) String() string
type DownloadGoModule ¶
DownloadModule indicates that the named module should be downloaded from the module proxy and extracted into the given path.
func (DownloadGoModule) String ¶
func (c DownloadGoModule) String() string
type DownloadRustCrate ¶
DownloadCrate indicates that the named crate should be downloaded from crates.io and extracted into the given path.
func (DownloadRustCrate) String ¶
func (c DownloadRustCrate) String() string
type GenerateGoPackageBUILD ¶
GeneratePackageBUILD indicates that the named package should have its BUILD file generated and written to the given path.
func (GenerateGoPackageBUILD) String ¶
func (c GenerateGoPackageBUILD) String() string
type GenerateRustCrateBUILD ¶
GenerateCrateBUILD indicates that the named crate should have its BUILD file generated and written to the given path.
func (GenerateRustCrateBUILD) String ¶
func (c GenerateRustCrateBUILD) String() string
type GoModule ¶
type GoModule struct { // Dependency details. Name string `bzl:"name"` Version string `bzl:"version"` // Patches to be applied to the // downloaded module, before the // BUILD file is copied/generated. PatchArgs []string `bzl:"patch_args"` Patches []string `bzl:"patches"` // Packages that should be used. Packages []*GoPackage `bzl:"packages/package"` // Generation details. Digest string `bzl:"digest"` PatchDigest string `bzl:"patch_digest"` }
GoModule contains the information necessary to vendor a Go module, specifying the set of packages within the module that are used.
type GoPackage ¶
type GoPackage struct { // Dependency details. Name string `bzl:"name"` // Manually-managed BUILD file. BuildFile string `bzl:"build_file"` // Build configuration Deps []string `bzl:"deps"` Embed []string `bzl:"embed"` EmbedGlobs []string `bzl:"embed_globs"` // Test configuration. NoTests bool `bzl:"no_tests"` TestSize string `bzl:"test_size"` TestData []string `bzl:"test_data"` TestDataGlobs []string `bzl:"test_data_globs"` TestDeps []string `bzl:"test_deps"` }
GoPackage describes a package within a Go module.
type RemoveAll ¶
type RemoveAll string
RemoveAll deletes a directory, along with any child nodes that exist. If the path does not exist, there is no effect.
type RustCrate ¶
type RustCrate struct { // Dependency details. Name string `bzl:"name"` Version string `bzl:"version"` // Patches to be applied to the // downloaded crate, before the // BUILD file is copied/generated. PatchArgs []string `bzl:"patch_args"` Patches []string `bzl:"patches"` // Manually-managed BUILD file. BuildFile string `bzl:"build_file"` // Build configuration Edition string `bzl:"edition"` Features []string `bzl:"features"` Deps []string `bzl:"deps"` ProcMacroDeps []string `bzl:"proc_macro_deps"` RustcEnv map[string]string `bzl:"rustc_env"` // Whether to create rustdocs. NoDocs bool `bzl:"no_docs"` // Whether the crate is a library or // a procedural macro library. ProcMacro bool `bzl:"proc_macro"` // Build script configuration. BuildScript string `bzl:"build_script"` BuildScriptDeps []string `bzl:"build_script_deps"` // Test configuration. NoTests bool `bzl:"no_tests"` TestData []string `bzl:"test_data"` TestDataGlobs []string `bzl:"test_data_globs"` TestDeps []string `bzl:"test_deps"` TestEnv map[string]string `bzl:"test_env"` // Generation details. Digest string `bzl:"digest"` PatchDigest string `bzl:"patch_digest"` }
RustCrate contains the dependency information for a Rust crate.
type UpdateDep ¶
UpdateDep describes the least information necessary to determine a third-party software library. This is used when determining whether updates are available.
type UpdateDeps ¶
UpdateDeps includes a set of dependencies for the purposes of updating them.
func ParseUpdateDeps ¶
func ParseUpdateDeps(filename string, f *build.File) (*UpdateDeps, error)
ParseUpdateDeps parses a deps.bzl file for the set of dependencies so they can be checked for updates.
type Vulns ¶
Vulns describes the set of vulnerability advisory data for a set of software dependencies.
func FetchVulns ¶
fetchVulns fetches/updates the set of vulnerability advisories, then parses them into structured vuln data in OSV format.