builder

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2024 License: Apache-2.0, GPL-2.0, CC-BY-4.0 Imports: 6 Imported by: 3

Documentation

Overview

Package builder is used to create tools-golang data structures for a given directory path's contents, with hashes, etc. filled in and with empty license data. SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build added in v0.5.0

func Build(packageName string, dirRoot string, config *Config) (*spdx.Document, error)

Build creates an SPDX Document, returning that document or error if any is encountered. Arguments:

  • packageName: name of package / directory
  • dirRoot: path to directory to be analyzed
  • config: Config object

func BuildCreationInfoSection added in v0.5.0

func BuildCreationInfoSection(creatorType string, creator string, testValues map[string]string) (*spdx.CreationInfo, error)

BuildCreationInfoSection creates an SPDX Package, returning that package or error if any is encountered. Arguments:

  • packageName: name of package / directory
  • code: verification code from Package
  • namespacePrefix: prefix for DocumentNamespace (packageName and code will be added)
  • creatorType: one of Person, Organization or Tool
  • creator: creator string
  • testValues: for testing only; call with nil when using in production

func BuildFileSection added in v0.5.0

func BuildFileSection(filePath string, prefix string, fileNumber int) (*spdx.File, error)

BuildFileSection creates an SPDX File, returning that file or error if any is encountered. Arguments:

  • filePath: path to file, relative to prefix
  • prefix: relative directory for filePath
  • fileNumber: integer index (unique within package) to use in identifier

func BuildPackageSection added in v0.5.0

func BuildPackageSection(packageName string, dirRoot string, pathsIgnore []string) (*spdx.Package, error)

BuildPackageSection creates an SPDX Package, returning that package or error if any is encountered. Arguments:

  • packageName: name of package / directory
  • dirRoot: path to directory to be analyzed
  • pathsIgnore: slice of strings for filepaths to ignore

func BuildRelationshipSection added in v0.5.0

func BuildRelationshipSection(packageName string) (*spdx.Relationship, error)

BuildRelationshipSection creates an SPDX Relationship solely for the document "DESCRIBES" package relationship, returning that relationship or error if any is encountered. Arguments:

  • packageName: name of package / directory

Types

type Config added in v0.5.0

type Config struct {
	// NamespacePrefix should be a URI representing a prefix for the
	// namespace with which the SPDX Document will be associated.
	// It will be used in the DocumentNamespace field in the CreationInfo
	// section, followed by the per-Document package name and a random UUID.
	NamespacePrefix string

	// CreatorType should be one of "Person", "Organization" or "Tool".
	// If not one of those strings, it will be interpreted as "Person".
	CreatorType string

	// Creator will be filled in for the given CreatorType.
	Creator string

	// PathsIgnored lists certain paths to be omitted from the built document.
	// Each string should be a path, relative to the package's dirRoot,
	// to a specific file or (for all files in a directory) ending in a slash.
	// Prefix the string with "**" to omit all instances of that file /
	// directory, regardless of where it is in the file tree.
	PathsIgnored []string

	// TestValues is used to pass fixed values for testing purposes
	// only, and should be set to nil for production use. It is only
	// exported so that it will be accessible within builder.
	TestValues map[string]string
}

Config is a collection of configuration settings for builder. A few mandatory fields are set here so that they can be repeatedly reused in multiple calls to Build.

Jump to

Keyboard shortcuts

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