manifestutil

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetRepoToRemoteBranchToSourceRootFromFile

func GetRepoToRemoteBranchToSourceRootFromFile(file string) (map[string]map[string]string, error)

GetRepoToRemoteBranchToSourceRootFromFile constructs a Gerrit project to path mapping by reading manifests from the specified root manifest file.

func GetRepoToRemoteBranchToSourceRootFromGitiles

func GetRepoToRemoteBranchToSourceRootFromGitiles(ctx context.Context, authedClient *http.Client, gc *bbproto.GitilesCommit) (map[string]map[string]string, error)

GetRepoToRemoteBranchToSourceRootFromGitiles constructs a Gerrit project to path mapping by fetching manifest XML files from Gitiles.

func LoadManifestFromFile

func LoadManifestFromFile(file string) (*repo.Manifest, error)

LoadManifestFromFile loads the manifest at the given file into a Manifest struct.

func LoadManifestFromFileRaw

func LoadManifestFromFileRaw(file string) ([]byte, error)

LoadManifestFromFileRaw loads the manifest at the given file and returns the file contents as a byte array.

func LoadManifestFromFileWithIncludes

func LoadManifestFromFileWithIncludes(file string) (*repo.Manifest, error)

LoadManifestFromFileWithIncludes loads the manifest at the given files but also calls MergeManifests to resolve includes.

func LoadManifestFromGitiles

func LoadManifestFromGitiles(ctx context.Context, authedClient *http.Client, host, project, branch, file string) (*repo.Manifest, error)

LoadManifestFromGitiles loads the manifest from the specified remote location using the Gitiles API.

func LoadManifestFromGitilesWithIncludes

func LoadManifestFromGitilesWithIncludes(ctx context.Context, authedClient *http.Client, host, project, branch, file string) (*repo.Manifest, error)

LoadManifestFromGitilesWithIncludes loads the manifest from the specified remote location using the Gitiles API and also calls MergeManifests to resolve includes.

func LoadManifestTreeFromFile

func LoadManifestTreeFromFile(file string) (map[string]*repo.Manifest, error)

LoadManifestTree loads the manifest at the given file path into a Manifest struct. It also loads all included manifests. Returns a map mapping manifest filenames to file contents.

func LoadManifestTreeFromGitiles

func LoadManifestTreeFromGitiles(ctx context.Context, authedClient *http.Client, host, project, branch, file string) (map[string]*repo.Manifest, error)

LoadManifestTree loads the manifest from the specified remote location into a Manifest struct. It also loads all included manifests. Returns a map mapping manifest filenames to file contents.

func PinManifestFromManifest

func PinManifestFromManifest(manifest, reference *repo.Manifest) error

PinManifestFromManifest pins all projects in a manifest to the revisions listed for the same projects in a reference manifest. If a project does not exist in the reference manifest, it will not be changed and an error will be returned. Path is used as the identifier for projects.

func UpdateManifestElements

func UpdateManifestElements(reference *repo.Manifest, rawManifest []byte) ([]byte, error)

UpdateManifestElements updates manifest elements in place (so as to make the minimal changes possible to a manifest file) according to a reference manifest. The intended use case is to read a manifest from disk into a Manifest struct, modify the manifest in memory, and write the changes back to disk.

Currently supports Default, Remote, and Project elements (not Annotation).

The raw manifest will be updated at the element-level: if an element in the raw manifest matches an element in the reference manifest, all attributes will be set to the values in the reference element. The 'name' field is used as a unique identifier for <remote> elements and the 'path' field for <project> elements. The function will return an error if there is more than one <default> element in the raw manifest. The function will also return an error if elements in the reference manifest do not exist in the raw manifest.

func UpdateManifestElementsInFile

func UpdateManifestElementsInFile(path string, reference *repo.Manifest) (bool, error)

UpdateManifestElementsInFile performs the same operation as UpdateManifestElements but operates on a specific manifest file, handling all input/output. Returns whether or not the file contents changed, and a potential error.

Types

type MissingProjectsError

type MissingProjectsError struct {
	Err             error
	MissingProjects string
}

func (MissingProjectsError) Error

func (e MissingProjectsError) Error() string

Jump to

Keyboard shortcuts

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