repo

package
Version: v0.13.3 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: MIT Imports: 23 Imported by: 167

Documentation

Overview

Package repo provides tools for working with VCS repositories.

Glide manages repositories in the vendor directory by using the native VCS systems of each repository upon which the code relies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConcurrentUpdate

func ConcurrentUpdate(deps []*cfg.Dependency, i *Installer, c *cfg.Config) error

ConcurrentUpdate takes a list of dependencies and updates in parallel.

func LazyConcurrentUpdate

func LazyConcurrentUpdate(deps []*cfg.Dependency, i *Installer, c *cfg.Config) error

LazyConcurrentUpdate updates only deps that are not already checkout out at the right version.

This is only safe when updating from a lock file.

func SetReference

func SetReference(conf *cfg.Config, resolveTest bool) error

SetReference is a command to set the VCS reference (commit id, tag, etc) for a project.

func VcsGet

func VcsGet(dep *cfg.Dependency) error

VcsGet figures out how to fetch a dependency, and then gets it.

VcsGet installs into the cache.

func VcsUpdate

func VcsUpdate(dep *cfg.Dependency, force bool, updated *UpdateTracker) error

VcsUpdate updates to a particular checkout based on the VCS setting.

func VcsVersion

func VcsVersion(dep *cfg.Dependency) error

VcsVersion set the VCS version for a checkout.

Types

type Installer

type Installer struct {

	// Force the install when certain normally stopping conditions occur.
	Force bool

	// Home is the location of cache
	Home string

	// Vendor contains the path to put the vendor packages
	Vendor string

	// ResolveAllFiles enables a resolver that will examine the dependencies
	// of every file of every package, rather than only following imported
	// packages.
	ResolveAllFiles bool

	// ResolveTest sets if test dependencies should be resolved.
	ResolveTest bool

	// Updated tracks the packages that have been remotely fetched.
	Updated *UpdateTracker
}

Installer provides facilities for installing the repos in a config file.

func NewInstaller

func NewInstaller() *Installer

NewInstaller returns an Installer instance ready to use. This is the constructor.

func (*Installer) Checkout

func (i *Installer) Checkout(conf *cfg.Config) error

Checkout reads the config file and checks out all dependencies mentioned there.

This is used when initializing an empty vendor directory, or when updating a vendor directory based on changed config.

func (*Installer) Export added in v0.12.0

func (i *Installer) Export(conf *cfg.Config) error

Export from the cache to the vendor directory

func (*Installer) Install

func (i *Installer) Install(lock *cfg.Lockfile, conf *cfg.Config) (*cfg.Config, error)

Install installs the dependencies from a Lockfile.

func (*Installer) List

func (i *Installer) List(conf *cfg.Config) []*cfg.Dependency

List resolves the complete dependency tree and returns a list of dependencies.

func (*Installer) Update

func (i *Installer) Update(conf *cfg.Config) error

Update updates all dependencies.

It begins with the dependencies in the config file, but also resolves transitive dependencies. The returned lockfile has all of the dependencies listed, but the version reconciliation has not been done.

In other words, all versions in the Lockfile will be empty.

func (*Installer) VendorPath

func (i *Installer) VendorPath() string

VendorPath returns the path to the location to put vendor packages

type MissingPackageHandler

type MissingPackageHandler struct {
	Config *cfg.Config
	Use    *importCache
	// contains filtered or unexported fields
}

MissingPackageHandler is a dependency.MissingPackageHandler.

When a package is not found, this attempts to resolve and fetch.

When a package is found on the GOPATH, this notifies the user.

func (*MissingPackageHandler) InVendor

func (m *MissingPackageHandler) InVendor(pkg string, addTest bool) error

InVendor updates a package in the vendor/ directory to make sure the latest is available.

func (*MissingPackageHandler) NotFound

func (m *MissingPackageHandler) NotFound(pkg string, addTest bool) (bool, error)

NotFound attempts to retrieve a package when not found in the local cache folder. It will attempt to get it from the remote location info.

func (*MissingPackageHandler) OnGopath

func (m *MissingPackageHandler) OnGopath(pkg string, addTest bool) (bool, error)

OnGopath will either copy a package, already found in the GOPATH, to the vendor/ directory or download it from the internet. This is dependent if useGopath on the installer is set to true to copy from the GOPATH.

func (*MissingPackageHandler) PkgPath added in v0.12.0

func (m *MissingPackageHandler) PkgPath(pkg string) string

PkgPath resolves the location on the filesystem where the package should be. This handles making sure to use the cache location.

type UpdateTracker

type UpdateTracker struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

UpdateTracker holds a list of all the packages that have been updated from an external source. This is a concurrency safe implementation.

func NewUpdateTracker

func NewUpdateTracker() *UpdateTracker

NewUpdateTracker creates a new instance of UpdateTracker ready for use.

func (*UpdateTracker) Add

func (u *UpdateTracker) Add(name string)

Add adds a name to the list of items being tracked.

func (*UpdateTracker) Check

func (u *UpdateTracker) Check(name string) bool

Check returns if an item is on the list or not.

func (*UpdateTracker) Remove

func (u *UpdateTracker) Remove(name string)

Remove takes a package off the list

type VersionHandler

type VersionHandler struct {

	// If Try to use the version here if we have one. This is a cache and will
	// change over the course of setting versions.
	Use *importCache

	// Cache if importing scan has already occurred here.
	Imported map[string]bool

	Config *cfg.Config

	// There's a problem where many sub-packages have been asked to set a version
	// and you can end up with numerous conflict messages that are exactly the
	// same. We are keeping track to only display them once.
	// the parent pac
	Conflicts map[string]bool
}

VersionHandler handles setting the proper version in the VCS.

func (*VersionHandler) Process

func (d *VersionHandler) Process(pkg string) (e error)

Process imports dependencies for a package

func (*VersionHandler) SetVersion

func (d *VersionHandler) SetVersion(pkg string, addTest bool) (e error)

SetVersion sets the version for a package. If that package version is already set it handles the case by: - keeping the already set version - proviting messaging about the version conflict TODO(mattfarina): The way version setting happens can be improved. Currently not optimal.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL