Documentation

Overview

    Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

    Copyright 2019 The Chromium OS Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var (
    	GOB_HOST              = "%s.googlesource.com"
    	EXTERNAL_GOB_INSTANCE = "chromium"
    	EXTERNAL_GOB_HOST     = fmt.Sprintf(GOB_HOST, EXTERNAL_GOB_INSTANCE)
    	EXTERNAL_GOB_URL      = fmt.Sprintf("https://%s", EXTERNAL_GOB_HOST)
    
    	INTERNAL_GOB_INSTANCE = "chrome-internal"
    	INTERNAL_GOB_HOST     = fmt.Sprintf(GOB_HOST, INTERNAL_GOB_INSTANCE)
    	INTERNAL_GOB_URL      = fmt.Sprintf("https://%s", INTERNAL_GOB_HOST)
    
    	AOSP_GOB_INSTANCE = "android"
    	AOSP_GOB_HOST     = fmt.Sprintf(GOB_HOST, AOSP_GOB_INSTANCE)
    	AOSP_GOB_URL      = fmt.Sprintf("https://%s", AOSP_GOB_HOST)
    
    	WEAVE_GOB_INSTANCE = "weave"
    	WEAVE_GOB_HOST     = fmt.Sprintf(GOB_HOST, WEAVE_GOB_INSTANCE)
    	WEAVE_GOB_URL      = fmt.Sprintf("https://%s", WEAVE_GOB_HOST)
    
    	CROS_REMOTES = map[string]string{
    
    		"aosp":  AOSP_GOB_URL,
    		"weave": WEAVE_GOB_URL,
    		// contains filtered or unexported fields
    	}
    
    	// Mapping 'remote name' -> regexp that matches names of repositories on
    	// that remote that can be branched when creating CrOS branch.
    	// Branching script will actually create a new git ref when branching
    	// these projects. It won't attempt to create a git ref for other projects
    	// that may be mentioned in a manifest. If a remote is missing from this
    	// dictionary, all projects on that remote are considered to not be
    	// branchable.
    	BRANCHABLE_PROJECTS = map[string]*regexp.Regexp{
    						// contains filtered or unexported fields
    	}
    
    	MANIFEST_ATTR_BRANCHING_CREATE = "create"
    	MANIFEST_ATTR_BRANCHING_PIN    = "pin"
    	MANIFEST_ATTR_BRANCHING_TOT    = "tot"
    )

    Functions

    func GetRepoToRemoteBranchToSourceRootFromManifestFile

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

    func GetRepoToRemoteBranchToSourceRootFromManifests

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

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

      func GetRepoToSourceRoot

      func GetRepoToSourceRoot(chromiumosCheckout, repoToolPath string) (map[string]string, error)

        GetRepoToSourceRoot gets the mapping of Gerrit project to Chromium OS source tree path.

        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 LoadManifestTree

          func LoadManifestTree(file string) (map[string]*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.

            Types

            type Annotation

            type Annotation struct {
            	Name  string `xml:"name,attr,omitempty"`
            	Value string `xml:"value,attr,omitempty"`
            }

              Annotation is an element of a manifest annotating the parent element.

              type BranchMode

              type BranchMode string
              const (
              	UnspecifiedMode BranchMode = "unspecified"
              	Pinned          BranchMode = "pinned"
              	Tot             BranchMode = "tot"
              	Create          BranchMode = "create"
              )

              type CopyFile

              type CopyFile struct {
              	Dest string `xml:"dest,attr,omitempty"`
              	Src  string `xml:"src,attr,omitempty"`
              }

              type Default

              type Default struct {
              	RemoteName string `xml:"remote,attr,omitempty"`
              	Revision   string `xml:"revision,attr,omitempty"`
              	SyncJ      string `xml:"sync-j,attr,omitempty"`
              }

                Default is a manifest element that lists the default.

                type Include

                type Include struct {
                	Name string `xml:"name,attr,omitempty"`
                }

                  Include is a manifest element that imports another manifest file.

                  type Manifest

                  type Manifest struct {
                  	XMLName   xml.Name    `xml:"manifest"`
                  	Includes  []Include   `xml:"include"`
                  	Remotes   []Remote    `xml:"remote"`
                  	Default   Default     `xml:"default"`
                  	Notice    string      `xml:"notice,omitempty"`
                  	RepoHooks []RepoHooks `xml:"repo-hooks"`
                  	Projects  []Project   `xml:"project"`
                  }

                    Manifest is a top-level Repo definition file.

                    func LoadManifestFromFile

                    func LoadManifestFromFile(file string) (Manifest, error)

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

                      func LoadManifestFromFileWithIncludes

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

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

                        func MergeManifests

                        func MergeManifests(root string, manifests *map[string]*Manifest) (*Manifest, error)

                          MergeManifests will merge the given manifests based on includes, taking manifests[path] to be the top-level manifest. manifests maps manifest filenames to the Manifest structs themselves. This basically re-implements `repo manifest` but is necessary because we can't run `repo manifest` on a singular git repository.

                          func (*Manifest) GetMultiCheckoutProjects

                          func (m *Manifest) GetMultiCheckoutProjects() []*Project

                            GetMultiCheckoutProjects returns all projects in the manifest that have a multiple checkouts and are not pinned/tot.

                            func (*Manifest) GetPinnedProjects

                            func (m *Manifest) GetPinnedProjects() []*Project

                              GetPinnedProjects returns all projects in the manifest that are pinned.

                              func (*Manifest) GetProjectByName

                              func (m *Manifest) GetProjectByName(name string) (*Project, error)

                                GetProjectByName returns a pointer to the remote with the given path in the given manifest.

                                func (*Manifest) GetProjectByPath

                                func (m *Manifest) GetProjectByPath(path string) (*Project, error)

                                  GetProjectByPath returns a pointer to the remote with the given path in the given manifest.

                                  func (*Manifest) GetRemoteByName

                                  func (m *Manifest) GetRemoteByName(name string) *Remote

                                    GetRemoteByName returns a pointer to the remote with the given name/alias in the given manifest.

                                    func (*Manifest) GetSingleCheckoutProjects

                                    func (m *Manifest) GetSingleCheckoutProjects() []*Project

                                      GetSingleCheckoutProjects returns all projects in the manifest that have a single checkout and are not pinned/tot.

                                      func (*Manifest) GetTotProjects

                                      func (m *Manifest) GetTotProjects() []*Project

                                        GetTotProjects returns all projects in the manifest that are tot.

                                        func (*Manifest) GetUniqueProject

                                        func (m *Manifest) GetUniqueProject(name string) (Project, error)

                                          GetUnique Project returns the unique project with the given name (nil if the project DNE). It returns an error if multiple projects with the given name exist.

                                          func (*Manifest) ProjectBranchMode

                                          func (m *Manifest) ProjectBranchMode(project Project) BranchMode

                                            ProjectBranchMode returns the branch mode (create, pinned, tot) of a project.

                                            func (m *Manifest) ResolveImplicitLinks() *Manifest

                                              ResolveImplicitLinks explicitly sets remote/revision information for each project in the manifest.

                                              func (*Manifest) Write

                                              func (m *Manifest) Write(path string) error

                                                Write writes the manifest to the given path.

                                                type Project

                                                type Project struct {
                                                	Path        string       `xml:"path,attr,omitempty"`
                                                	Name        string       `xml:"name,attr,omitempty"`
                                                	Revision    string       `xml:"revision,attr,omitempty"`
                                                	Upstream    string       `xml:"upstream,attr,omitempty"`
                                                	RemoteName  string       `xml:"remote,attr,omitempty"`
                                                	Annotations []Annotation `xml:"annotation"`
                                                	Groups      string       `xml:"groups,attr,omitempty"`
                                                	SyncC       string       `xml:"sync-c,attr,omitempty"`
                                                	CopyFiles   []CopyFile   `xml:"copyfile"`
                                                }

                                                  Project is an element of a manifest containing a Gerrit project to source path definition.

                                                  func (*Project) GetAnnotation

                                                  func (p *Project) GetAnnotation(name string) (string, bool)

                                                    GetAnnotation returns the value of the annotation with the given name, if it exists. It also returns a bool indicating whether or not the annotation exists.

                                                    type Remote

                                                    type Remote struct {
                                                    	Fetch    string `xml:"fetch,attr,omitempty"`
                                                    	Name     string `xml:"name,attr,omitempty"`
                                                    	Revision string `xml:"revision,attr,omitempty"`
                                                    	Alias    string `xml:"alias,attr,omitempty"`
                                                    }

                                                      Remote is a manifest element that lists a remote.

                                                      func (*Remote) GitName

                                                      func (r *Remote) GitName() string

                                                        GitName returns the git name of the remote, which is Alias if it is set, and Name otherwise.

                                                        type RepoHooks

                                                        type RepoHooks struct {
                                                        	EnabledList string `xml:"enabled-list,attr,omitempty"`
                                                        	InProject   string `xml:"in-project,attr,omitempty"`
                                                        }