deps_parser

package
v0.0.0-...-c8472d9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DepsFileName is the name of the DEPS file.
	DepsFileName = "DEPS"
)

Variables

This section is empty.

Functions

func HasGitSubmodules

func HasGitSubmodules(depsContent string) (bool, error)

HasGitSubmodules

func NormalizeDep

func NormalizeDep(depId string) string

NormalizeDep normalizes the dependency ID to account for differences, eg. the URL scheme and .git suffix for git repos and the ${platform} suffix for CIPD packages.

func SetDep

func SetDep(depsContent, depId, version string) (string, error)

SetDep parses the DEPS file content, replaces the given dependency with the given new version, and returns the new DEPS file content. It does not attempt to understand the full Python syntax upon which DEPS is based and may break completely if the file takes an unexpected format.

Types

type DepType

type DepType string
const (
	DepType_Git  DepType = "git"
	DepType_Cipd DepType = "cipd"
	DepType_Gcs  DepType = "gcs"
)

type DepsEntries

type DepsEntries map[string]*DepsEntry

DepsEntries represents all entries in a DEPS file.

func ParseDeps

func ParseDeps(depsContent string) (DepsEntries, error)

ParseDeps parses the DEPS file content and returns a map of normalized dependency ID to DepsEntry. It does not attempt to understand the full Python syntax upon which DEPS is based and may break completely if the file takes an unexpected format.

func ParseDepsNoNormalize

func ParseDepsNoNormalize(depsContent string) (DepsEntries, error)

ParseDepsNoNormalize is like ParseDeps but does not normalize dependency IDs.

func (DepsEntries) Get

func (e DepsEntries) Get(dep string) *DepsEntry

Get retrieves the DepsEntry with the given ID, accounting for normalization. Returns the DepsEntry or nil if the entry was not found.

type DepsEntry

type DepsEntry struct {
	// Id describes what the DepsEntry points to, eg. for Git dependencies
	// it is the normalized repo URL, and for CIPD packages it is the
	// package name.
	Id string

	// Version is the currently-pinned version of this dependency.
	Version string

	// Path is the path to which the dependency should be downloaded. It is
	// also used as the key in the 'deps' map in the DEPS file.
	Path string

	// Type indicates the type of the dependency.
	Type DepType
}

DepsEntry represents a single entry in a DEPS file. Note that the 'deps' dict may specify that multiple CIPD package are unpacked to the same location; a DepsEntry refers to the dependency, not the path, so each CIPD package would get its own DepsEntry despite their sharing one key in the 'deps' dict.

func GetDep

func GetDep(depsContent, dep string) (*DepsEntry, error)

GetDep parses the given depsContent and retrieves the given DepsEntry. Returns an error if the dep was not found.

Jump to

Keyboard shortcuts

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