Documentation
¶
Overview ¶
Package gps is a Go packaging solver library.
Index ¶
- Variables
- func IsAny(c Constraint) bool
- func PruneProject(baseDir string, lp LockedProject, options PruneOptions) error
- func SortForDowngrade(vl []Version)
- func SortForUpgrade(vl []Version)
- func SortPairedForDowngrade(vl []PairedVersion)
- func SortPairedForUpgrade(vl []PairedVersion)
- func ValidateParams(params SolveParameters, sm SourceManager) error
- func VersionComponentStrings(v Version) (revision string, branch string, version string)
- func WriteDepTree(basedir string, l Lock, sm SourceManager, co CascadingPruneOptions, ...) error
- type CascadingPruneOptions
- type Constraint
- type CouldNotCreateLockError
- type DeductionErrs
- type Lock
- type LockedProject
- type Manifest
- type PairedVersion
- type ProjectAnalyzer
- type ProjectAnalyzerInfo
- type ProjectConstraint
- type ProjectConstraints
- type ProjectIdentifier
- type ProjectProperties
- type ProjectRoot
- type PruneOptionSet
- type PruneOptions
- type Revision
- type RootManifest
- type SimpleLock
- type SimpleManifest
- type Solution
- type SolveParameters
- type Solver
- type SourceManager
- type SourceManagerConfig
- type SourceMgr
- func (sm *SourceMgr) Cachedir() string
- func (sm *SourceMgr) DeduceProjectRoot(ip string) (ProjectRoot, error)
- func (sm *SourceMgr) ExportProject(ctx context.Context, id ProjectIdentifier, v Version, to string) error
- func (sm *SourceMgr) ExportPrunedProject(ctx context.Context, lp LockedProject, prune PruneOptions, to string) error
- func (sm *SourceMgr) GetManifestAndLock(id ProjectIdentifier, v Version, an ProjectAnalyzer) (Manifest, Lock, error)
- func (sm *SourceMgr) HandleSignals(sigch chan os.Signal)
- func (sm *SourceMgr) InferConstraint(s string, pi ProjectIdentifier) (Constraint, error)
- func (sm *SourceMgr) ListPackages(id ProjectIdentifier, v Version) (pkgtree.PackageTree, error)
- func (sm *SourceMgr) ListVersions(id ProjectIdentifier) ([]PairedVersion, error)
- func (sm *SourceMgr) Release()
- func (sm *SourceMgr) RevisionPresentIn(id ProjectIdentifier, r Revision) (bool, error)
- func (sm *SourceMgr) SourceExists(id ProjectIdentifier) (bool, error)
- func (sm *SourceMgr) SourceURLsForPath(ip string) ([]*url.URL, error)
- func (sm *SourceMgr) StopSignalHandling()
- func (sm *SourceMgr) SyncSourceFor(id ProjectIdentifier) error
- func (sm *SourceMgr) UseDefaultSignalHandling()
- type UnpairedVersion
- type Version
- type VersionType
- type WriteProgress
Constants ¶
This section is empty.
Variables ¶
var ErrSourceManagerIsReleased = fmt.Errorf("this SourceManager has been released, its methods can no longer be called")
ErrSourceManagerIsReleased is the error returned by any SourceManager method called after the SourceManager has been released, rendering its methods no longer safe to call.
Functions ¶
func IsAny ¶
func IsAny(c Constraint) bool
IsAny indicates if the provided constraint is the wildcard "Any" constraint.
func PruneProject ¶
func PruneProject(baseDir string, lp LockedProject, options PruneOptions) error
PruneProject remove excess files according to the options passed, from the lp directory in baseDir.
func SortForDowngrade ¶
func SortForDowngrade(vl []Version)
SortForDowngrade sorts a slice of []Version in roughly ascending order, so that presumably older versions are visited first.
This is *not* the same as reversing SortForUpgrade (or you could simply sort.Reverse()). The type precedence is the same, including the semver vs. semver-with-prerelease relation. Lexicographical comparisons within non-semver tags, branches, and revisions remains the same as well; because we treat these domains as having no ordering relation, there can be no real concept of "upgrade" vs "downgrade", so there is no reason to reverse them.
Thus, the only binary relation that is reversed for downgrade is within-type comparisons for semver.
So, given a slice of the following versions:
- Branch: master devel
- Semver tags: v1.0.0, v1.1.0, v1.1.0-alpha1
- Non-semver tags: footag
- Revision: f6e74e8d
Sorting for downgrade will result in the following slice:
[v1.0.0 v1.1.0 v1.1.0-alpha1 footag devel master f6e74e8d]
func SortForUpgrade ¶
func SortForUpgrade(vl []Version)
SortForUpgrade sorts a slice of []Version in roughly descending order, so that presumably newer versions are visited first. The rules are:
- All semver versions come first, and sort mostly according to the semver 2.0 spec (as implemented by github.com/Masterminds/semver lib), with one exception:
- Semver versions with a prerelease are after *all* non-prerelease semver. Within this subset they are sorted first by their numerical component, then lexicographically by their prerelease version.
- The default branch(es) is next; the exact semantics of that are specific to the underlying source.
- All other branches come next, sorted lexicographically.
- All non-semver versions (tags) are next, sorted lexicographically.
- Revisions, if any, are last, sorted lexicographically. Revisions do not typically appear in version lists, so the only invariant we maintain is determinism - deeper semantics, like chronology or topology, do not matter.
So, given a slice of the following versions:
- Branch: master devel
- Semver tags: v1.0.0, v1.1.0, v1.1.0-alpha1
- Non-semver tags: footag
- Revision: f6e74e8d
Sorting for upgrade will result in the following slice:
[v1.1.0 v1.0.0 v1.1.0-alpha1 master devel footag f6e74e8d]
func SortPairedForDowngrade ¶
func SortPairedForDowngrade(vl []PairedVersion)
SortPairedForDowngrade has the same behavior as SortForDowngrade, but operates on []PairedVersion types.
func SortPairedForUpgrade ¶
func SortPairedForUpgrade(vl []PairedVersion)
SortPairedForUpgrade has the same behavior as SortForUpgrade, but operates on []PairedVersion types.
func ValidateParams ¶
func ValidateParams(params SolveParameters, sm SourceManager) error
ValidateParams validates the solver parameters to ensure solving can be completed.
func VersionComponentStrings ¶
VersionComponentStrings decomposes a Version into the underlying number, branch and revision.
func WriteDepTree ¶
func WriteDepTree(basedir string, l Lock, sm SourceManager, co CascadingPruneOptions, onWrite func(WriteProgress)) error
WriteDepTree takes a basedir, a Lock and a RootPruneOptions and exports all the projects listed in the lock to the appropriate target location within basedir.
If the goal is to populate a vendor directory, basedir should be the absolute path to that vendor directory, not its parent (a project root, typically).