package builder

import "github.com/spdx/tools-golang/builder"

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

Functions

func Build2_1

func Build2_1(packageName string, dirRoot string, config *Config2_1) (*spdx.Document2_1, error)

Build2_1 creates an SPDX Document (version 2.1), returning that document or error if any is encountered. Arguments:

func Build2_2

func Build2_2(packageName string, dirRoot string, config *Config2_2) (*spdx.Document2_2, error)

Build2_2 creates an SPDX Document (version 2.2), returning that document or error if any is encountered. Arguments:

Types

type Config2_1

type Config2_1 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 builder2v1.
	TestValues map[string]string
}

Config2_1 is a collection of configuration settings for builder (for version 2.1 SPDX Documents). A few mandatory fields are set here so that they can be repeatedly reused in multiple calls to Build2_1.

type Config2_2

type Config2_2 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 builder2v2.
	TestValues map[string]string
}

Config2_2 is a collection of configuration settings for builder (for version 2.2 SPDX Documents). A few mandatory fields are set here so that they can be repeatedly reused in multiple calls to Build2_2.

Source Files

build.go

Directories

PathSynopsis
builder/builder2v1
builder/builder2v2
Version
v0.1.0
Published
Mar 20, 2021
Platform
linux/amd64
Imports
3 packages
Last checked
11 seconds ago

Tools for package owners.