modder

package
v0.6.2-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: BSD-3-Clause Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Modder

type Modder struct {
	// MetaConfiguration
	Name    string `yaml:"Name"`
	Version string `yaml:"Version",omitempty`

	// Module information
	ModFile       string `yaml:"ModFile",omitempty`
	SumFile       string `yaml:"SumFile",omitempty`
	ModsDir       string `yaml:"ModsDir",omitempty`
	MappingFile   string `yaml:"MappingFile",omitempty`
	PrivateEnvVar string `yaml:"PrivateEnvVar",omitempty`

	// Commands override default, configuragble processing
	// for things like golang
	NoLoad        bool       `yaml:"NoLoad",omitempty`
	CommandInit   [][]string `yaml:"CommandInit",omitempty`
	CommandGraph  [][]string `yaml:"CommandGraph",omitempty`
	CommandTidy   [][]string `yaml:"CommandTidy",omitempty`
	CommandVendor [][]string `yaml:"CommandVendor",omitempty`
	CommandVerify [][]string `yaml:"CommandVerify",omitempty`
	CommandStatus [][]string `yaml:"CommandStatus",omitempty`

	// Init related fields
	// we need to create things like directories and files beyond the
	InitTemplates    map[string]string `yaml:"InitTemplates",omitempty`
	InitPreCommands  [][]string        `yaml:"InitPreCommands",omitempty`
	InitPostCommands [][]string        `yaml:"InitPostCommands",omitempty`

	// Vendor related fields
	// filesystem globs for discovering files we should copy over
	VendorIncludeGlobs []string `yaml:"VendorIncludeGlobs",omitempty`
	VendorExcludeGlobs []string `yaml:"VendorExcludeGlobs",omitempty`
	// Any files we need to generate
	VendorTemplates    map[string]string `yaml:"VendorTemplates",omitempty`
	VendorPreCommands  [][]string        `yaml:"VendorPreCommands",omitempty`
	VendorPostCommands [][]string        `yaml:"VendorPostCommands",omitempty`

	// Some more vendor controls
	ManageFileOnly       bool `yaml:"ManageFileOnly",omitempty`
	SymlinkLocalReplaces bool `yaml:"SymlinkLocalReplaces",omitempty`

	// Introspection Configuration(s)
	// filesystem globs for discovering files we should introspect
	// regexs for extracting package information
	IntrospectIncludeGlobs []string `yaml:"IntrospectIncludeGlobs",omitempty`
	IntrospectExcludeGlobs []string `yaml:"IntrospectExcludeGlobs",omitempty`
	IntrospectExtractRegex []string `yaml:"IntrospectExtractRegex",omitempty`

	PackageManagerDefaultPrefix string `yaml:"PackageManagerDefaultPrefix",omitempty`

	// filesystem
	FS billy.Filesystem `yaml:"-"`

	// compiled cue, used for merging
	CueInstance *cue.Instance `yaml:"-"`
	// contains filtered or unexported fields
}

This modder is for more complex, yet configurable module processing. You can have system wide and local custom configurations. The fields in this struct are alpha and are likely to change

func NewFromFile

func NewFromFile(lang, filepath string, FS billy.Filesystem) (*Modder, error)

func (*Modder) CheckForErrors

func (mdr *Modder) CheckForErrors() error

func (*Modder) CompareLocalReplaceToVendor

func (mdr *Modder) CompareLocalReplaceToVendor(R Replace) error

func (*Modder) CompareSumEntryToVendor

func (mdr *Modder) CompareSumEntryToVendor(R Replace) error

func (*Modder) Graph

func (mdr *Modder) Graph() error

func (*Modder) GraphMVS

func (mdr *Modder) GraphMVS() error

The entrypoint to the MVS internal verify process

func (*Modder) Init

func (mdr *Modder) Init(module string) error

func (*Modder) LoadLocalReplace

func (mdr *Modder) LoadLocalReplace(R Replace) error

func (*Modder) LoadMappingsFile

func (mdr *Modder) LoadMappingsFile() error

Loads the root modules mapping file

func (*Modder) LoadMetaFromBilly

func (mdr *Modder) LoadMetaFromBilly() error

func (*Modder) LoadMetaFromFS

func (mdr *Modder) LoadMetaFromFS(dir string) error

func (*Modder) LoadMetaFromZip

func (mdr *Modder) LoadMetaFromZip() error

func (*Modder) LoadModFile

func (mdr *Modder) LoadModFile() error

Loads the root modules mod file

func (*Modder) LoadRemoteModule

func (mdr *Modder) LoadRemoteModule(R Replace) error

func (*Modder) LoadRootDeps

func (mdr *Modder) LoadRootDeps() error

func (*Modder) LoadSumFile

func (mdr *Modder) LoadSumFile() error

Loads the root modules sum file

func (*Modder) MvsMergeDependency

func (mdr *Modder) MvsMergeDependency(m *Module) error

If not set, justs adds. If set, takes the one with the greater version.

func (*Modder) PartitionSumEntries

func (mdr *Modder) PartitionSumEntries() ([]string, []string, []string, error)

func (*Modder) PrintErrors

func (mdr *Modder) PrintErrors() error

func (*Modder) PrintRootDeps

func (mdr *Modder) PrintRootDeps() error

func (*Modder) ReplaceDependency

func (mdr *Modder) ReplaceDependency(m *Module) error

This sets or overwrites the module

func (*Modder) Status

func (mdr *Modder) Status() error

func (*Modder) StatusMVS

func (mdr *Modder) StatusMVS() error

The entrypoint to the MVS internal verify process

func (*Modder) Tidy

func (mdr *Modder) Tidy() error

func (*Modder) TidyMVS

func (mdr *Modder) TidyMVS() error

The entrypoint to the MVS internal verify process

func (*Modder) Vendor

func (mdr *Modder) Vendor() error
Vendor reads in a module, determines dependencies, and writes out the vendor folder.

Will there be infinite recursion, or maybe just two levels?

This module & deps

  1. load this module a) check sum <-> mod files, need to determine if any updates here, for now w/o sum file

  2. process its sum/mod files

  3. for each of this mods deps dependency a) fetch all refs b) find minimum c) add to depMap, when / if ... ? guessing how right now - replaces are processed first - requires are processed second, so only add if not there, we shouldn't have duplicates in owr own mods files - d) if added, clond the desired ref to memory

  4. Now loop over depMap to pull in secondary dependencies - probably want to create a "newDeps" map here if we need to support wider recursion - basically follow the last block, but load idependently and merge after - do we need a separate modder when we process each dep? - probably if we are going to enable each module to optionally specify local behavior - so first file we should read is the .mvsconfig, that maps <lang> to whatever

    F) Finally, write out the vendor directory a) check <vendor-dir>/modules.txt and checksums b) write out if necessary

func (*Modder) VendorDep

func (mdr *Modder) VendorDep(R Replace) error

func (*Modder) VendorMVS

func (mdr *Modder) VendorMVS() error

The entrypoint to the MVS internal vendoring process

func (*Modder) Verify

func (mdr *Modder) Verify() error

func (*Modder) VerifyMVS

func (mdr *Modder) VerifyMVS() error

The entrypoint to the MVS internal verify process

func (*Modder) WriteVendor

func (mdr *Modder) WriteVendor() error

type Module

type Module struct {
	// From mod/sum files
	Language string
	LangVer  string
	Module   string
	Version  string
	Require  []Require
	Replace  []Replace

	// Merged version of local require / replace
	// Requires as replaces will not have the old fields set
	SelfDeps map[string]Replace

	// If this module gets replaced
	ReplaceModule  string
	ReplaceVersion string

	// Module files in memory
	ModFile  *modfile.File
	SumFile  *sumfile.Sum
	Mappings *mappingfile.Mappings

	// TODO, is this modder a good idea for our nested
	//   .mvsconfig processing and vendoring
	Mdr *Modder

	Errors []error
	Ref    *plumbing.Reference
	Refs   []*plumbing.Reference
	Clone  *git.GitRepo
	FS     billy.Filesystem
}

func (*Module) LoadMappingFile

func (m *Module) LoadMappingFile(fn string) error

func (*Module) LoadMetaFiles

func (m *Module) LoadMetaFiles(modname, sumname, mapname string, ignoreReplace bool) error

func (*Module) LoadModFile

func (m *Module) LoadModFile(fn string, ignoreReplace bool) error

func (*Module) LoadSelfDeps

func (mod *Module) LoadSelfDeps() error

func (*Module) LoadSumFile

func (m *Module) LoadSumFile(fn string) error

func (*Module) MergeSelfDeps

func (m *Module) MergeSelfDeps(ignoreReplace bool) error

func (*Module) PrintSelfDeps

func (mod *Module) PrintSelfDeps() error

type Replace

type Replace struct {
	OldPath    string
	OldVersion string
	NewPath    string
	NewVersion string
}

type Require

type Require struct {
	Path    string
	Version string
}

Jump to

Keyboard shortcuts

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