Documentation ¶
Index ¶
- Constants
- func Branch(path Path) (string, error)
- func BuildDeps(config *Config, plan *Plan) (err error)
- func Clean(config *Config, plan *Plan) error
- func Clone(dir Path, url string) error
- func CloneBranch(dir Path, url, branch string) error
- func Connect() (*rpc.Client, error)
- func Create(config *Config, url, group string) (err error)
- func CreateManifest(config *Config, plan *Plan, dir string) (err error)
- func Debug(b bool)
- func Depends(config *Config, plan *Plan, dir string) ([]string, error)
- func Download(config *Config, plan *Plan) error
- func FmtPlans(config *Config) (err error)
- func GNUUntar(dest Path, file string) error
- func HashOnly(config *Config, path string) (string, error)
- func IpfsAdd(config *Config, path string) (string, error)
- func IsInstalled(config *Config, name string) bool
- func MakeStat(path string) error
- func PackageFile(config *Config, plan *Plan) string
- func PackageFileExists(config *Config, plan *Plan) bool
- func PackagePath(config *Config, plan *Plan) string
- func PlanFiles(config *Config) ([]string, error)
- func PostInstall(config *Config, plan *Plan) (err error)
- func Readelf(p string) error
- func Remove(config *Config, name string) (err error)
- func RepoCreate(config *Config) error
- func SetStat(path string) error
- func Sign(config *Config, plan *Plan) (err error)
- func StartDaemon(config *Config) error
- func TarGzReader(p string) (*tar.Reader, error)
- func Untar(dest Path, r io.Reader) error
- func Update(b bool)
- func Verbose(b bool)
- func VerifiySig(path string) (err error)
- func WritePlan(config *Config, plan *Plan) error
- type Batch
- func (b *Batch) Add(plan *Plan)
- func (b Batch) Download(plan *Plan) error
- func (b *Batch) DownloadInstall(plan *Plan) error
- func (b Batch) ForEach(fn PlanFunc, plans PlanSlice) (errors []error)
- func (b *Batch) Install() (errors []error)
- func (b Batch) Plans() PlanSlice
- func (b Batch) PromptInstall() []error
- func (b *Batch) PruneInstalled()
- func (b Batch) String() string
- func (b *Batch) ToDownload() []string
- func (b *Batch) ToInstall() PlanSlice
- func (b *Batch) Walk(plan *Plan) error
- type Builder
- func (b Builder) Build() error
- func (b Builder) BuildDir() Path
- func (b Builder) BuildSteps() error
- func (b Builder) CreatePackage() error
- func (b Builder) Download() error
- func (b Builder) Package() error
- func (b Builder) PackageDir() Path
- func (b Builder) SourcePath() Path
- func (b Builder) SourceURL() string
- func (b Builder) Stage() error
- func (b Builder) StageDir() Path
- func (b Builder) Tarball(wr io.Writer) (err error)
- type Cache
- type Config
- type ConfigJSON
- type DB
- type DaemonBuilder
- type Env
- type Flags
- type Installer
- type IpfsStat
- type Path
- func (p Path) Base() Path
- func (p Path) Clone(url string) error
- func (p Path) Dir() Path
- func (p Path) Ensure()
- func (p Path) Exists() bool
- func (p Path) Expand() Path
- func (p Path) ExpandToPath() Path
- func (p Path) Ext() string
- func (p Path) Glob() ([]Path, error)
- func (p Path) IsDir() (bool, error)
- func (p Path) Join(s ...string) Path
- func (p Path) MarshalJSON() ([]byte, error)
- func (p Path) MkdirAll() error
- func (p Path) RemoveAll() error
- func (p Path) Stat() (os.FileInfo, error)
- func (p Path) String() string
- func (p Path) ToCache() Cache
- func (p Path) ToDB() DB
- func (p Path) ToPath() Path
- func (p Path) ToRepo() Repo
- func (p Path) Touch() error
- func (p *Path) UnmarshalJSON(b []byte) error
- type Plan
- type PlanFunc
- type PlanJSON
- type PlanSlice
- type Plans
- type ProgressWriter
- type Repo
- type RepoFiles
- type Request
- type Response
- type Size
- type Upgrader
Constants ¶
const ( // DockerEnv is the docker environment file DockerEnv = "/.dockerenv" // DockerAPI is the internal docker address used for ipfs API calls DockerAPI = "172.17.0.1:5001" )
const (
// DirMask is the default mask for new directories
DirMask = 0755
)
const (
//SocketFile is full path to socket file
SocketFile = "/tmp/via/socket"
)
Variables ¶
This section is empty.
Functions ¶
func Branch ¶
Branch returns the currently checked out branch for a git directory FIXME: this will probably fail with a detached head
func BuildDeps ¶
BuildDeps build's all of a packages dependency's are build if they are not built already
func CloneBranch ¶
CloneBranch clone remove URL with branch to directory
func CreateManifest ¶
CreateManifest walks the plans PKGDIR and creates a gzipped manifest file.
func Download ¶
Download gets the plans binary tarball package from ipfs http gateway. If run in a docker instance it will use a local docker ip.
FIXME: now that we have have contain namespaces we probably don't need docker logic here. And this will probably produce corner cases down the road.
func FmtPlans ¶
FmtPlans walks all plans and formats it sorting fields
FIXME: this should be renamed to Format and a new Lint function created. Lint function should have no side effects just look for known style isses. For example we can check that each upstream URL is using https and not http
func GNUUntar ¶
GNUUntar uses tar program to decompress an extract source files
FIXME: this is temporary used to handle some corner cases with long file names which could now be resolved with go upstream. Revisit this when we rework our untar functions
func IsInstalled ¶
IsInstalled returns true if a plan is installed
func PackageFile ¶
PackageFile returns the plans tarball name
func PackageFileExists ¶
PackageFileExists return true if a plan's package file exists
func PackagePath ¶
PackagePath returns the full path of the plans package file
func PostInstall ¶
PostInstall calls each of the Plans PostInstall commands
func Readelf ¶
Readelf prints the dynamic libs and interop sections for the elf binary specified by path name
func RepoCreate ¶
RepoCreate reads each plan's files creating a repo.json file that contains all plan's and groups. And also creating a files.json that contains a hash map of each plans files
FIXME: this is pretty expensive and probably won't scale well. Also repo.json and files.json should probably not be kept in version control.
func Sign ¶
Sign produces a detached signature for a plans package file
FIXME: currently this is not used at all. And may be redundant considering we are using ipfs multihash. Will revist this later.
func TarGzReader ¶
TarGzReader returns opens and returns a tar.Reader for give path
func Untar ¶
Untar decompress reader to destination directory. This is mainly used for install via packages
FIXME: rewrite this hackfest
func Update ¶
func Update(b bool)
Update set if a plan should update after building
FIXME: document what this actually does
func Verbose ¶
func Verbose(b bool)
Verbose sets the global verbosity level
FIXME: this should be set via Builder or Installer
func VerifiySig ¶
VerifiySig verifiy's that the plans signature matches a trusted signature.
FIXME: currently this is not used right now. instead ipfs's multihash is used. Revisit this later
Types ¶
type Batch ¶
type Batch struct {
// contains filtered or unexported fields
}
Batch Plan type
func (*Batch) DownloadInstall ¶
DownloadInstall provides a Plan function that downloads and installs a Plan
func (Batch) PromptInstall ¶
PromptInstall prompts user before installing
func (*Batch) PruneInstalled ¶
func (b *Batch) PruneInstalled()
PruneInstalled Plans within the Batch
FIXME: this is not implemented and is not currently being used
func (*Batch) ToDownload ¶
ToDownload returns a string slice of Plans to download
type Builder ¶
Builder provides type for building a Plan
func NewBuilder ¶
NewBuilder returns new Builder that has been initialized
func NewBuilderByName ¶
NewBuilderByName returns a new builder looking Plan by name
func (Builder) BuildSteps ¶
BuildSteps calls all of the methods required to build a Plan
func (Builder) CreatePackage ¶
CreatePackage create Tarball package
func (Builder) PackageDir ¶
PackageDir return the full path for Builder's package directory
func (Builder) SourcePath ¶
SourcePath returns the full path of the Plans source file
type Cache ¶
type Cache struct {
Path
}
Cache provides a type for working with build caching
func (Cache) Builds ¶
Builds returns the directory cache that contains plan builds. This is where out of source tree builds are built. Not all build systems support plans support out of source tree builds
func (Cache) Packages ¶
Packages returns the cache directory containing build packages. This directory is used to install the built package before they are packaged into tarballs
type Config ¶
type Config struct { Branch string Identity string Arch string OS string Root Path PlansRepo string Threads int IpfsAPI string // Paths Cache Cache DB DB Plans Plans Repo Repo Binary string Prefix Path // Toolchain Flags Flags Env Env Remove []string PostInstall []string // contains filtered or unexported fields }
Config represents via configuration type
func (*Config) Expand ¶
Expand returns a Config that have had its fields parsed through go's template engine. Basically this allows for self referencing json. For example we use this to reduce repetition for things like the Prefix field. We can then reuse {{.Prefix}} to represent that field in other parts of the config file
func (Config) SanitizeEnv ¶
SanitizeEnv returns an os.Environ() environment string slice that keeps only white listed environment variables. This ensures when we exec command calls nothing leaks from system environment
type ConfigJSON ¶
type ConfigJSON Config
ConfigJSON provides json Marshal and Unmarshal interface for Config
func (*ConfigJSON) MarshalJSON ¶
func (j *ConfigJSON) MarshalJSON() ([]byte, error)
MarshalJSON provides Marshal interface
func (*ConfigJSON) UnmarshalJSON ¶
func (j *ConfigJSON) UnmarshalJSON(data []byte) error
UnmarshalJSON provides Unmarshal interface
type DB ¶
type DB struct {
Path
}
DB provides string type for working with DB installed path
func (DB) InstalledFiles ¶
InstalledFiles returns all of the json manifests for each install package
type DaemonBuilder ¶
type DaemonBuilder struct {
// contains filtered or unexported fields
}
DaemonBuilder provides RPC server type
FIXME: this is not complete and not as important since we are using namespaces. could be useful at a later point
type Env ¶
Env provides a hash map for environment variables
type Installer ¶
type Installer struct {
// contains filtered or unexported fields
}
Installer provides Installer type
func NewInstaller ¶
NewInstaller returns a new Installer that has been initialized
func (Installer) Install ¶
Install method does the final installation of decompressing and extracting the tarball. The manifest which is essentially the plan's json file is then stored in the DB installed directory. It also updates the manifest's Cid resulting in byte to byte parity with the manifest.json and plan.json files.
type Path ¶
type Path string
Path provides type for working with directory paths
func FindPlanPath ¶
FindPlanPath returns the fullpath for a plan by it's given name
func PlanFilePath ¶
PlanFilePath returns the full path of the Plan's json file
func (Path) Expand ¶
Expand returns the Path as a string that has had its environment variables expanded
func (Path) ExpandToPath ¶
ExpandToPath is like Expand but returns a Path type
func (Path) Join ¶
Join path arguments with the Path as parent. This is like filepath.Join but with this Path type as the parent
func (Path) MarshalJSON ¶
MarshalJSON provide marshal interface
func (*Path) UnmarshalJSON ¶
UnmarshalJSON provide unmarshal interface
type Plan ¶
type Plan struct { Name string Version string Url string Group string StageDir string Inherit string Cid string BuildInStage bool IsRebuilt bool BuildTime time.Duration Date time.Time Size int64 SubPackages []string AutoDepends []string ManualDepends []string BuildDepends []string Flags Flags Patch []string Build []string Package []string PostInstall []string Remove []string Files []string }
revive:disable Plan is the plan type used to define plan meta data and build instructions
func ReadManifest ¶
ReadManifest returns an installed Plan's manifest by name
func ReadPackManifest ¶
ReadPackManifest open and package tarball path and returns a plans package manifest
func (*Plan) Depends ¶
Depends returns the PlanSlice Autodepends and ManualDepends as one string slice
func (*Plan) Expand ¶
Expand returns a Plan that has been parsed by go's template engine. This provides a form of self referencing json. Where field names can be reference from other filed names
func (*Plan) NameVersion ¶
NameVersion returns a plans name and version separated by a hyphen
func (*Plan) SourceFile ¶
SourceFile return the base name of the plans upstream source file/directory
type PlanJSON ¶
type PlanJSON Plan
PlanJSON provides json Marshal interface for Plan
func (PlanJSON) MarshalJSON ¶
MarshalJSON provides Marshal interface
type PlanSlice ¶
type PlanSlice []*Plan
PlanSlice provides a slice of plans
type ProgressWriter ¶
type ProgressWriter struct {
// contains filtered or unexported fields
}
ProgressWriter provides a writer interface that updates speed and progress information for ProgMeter
func NewProgressWriter ¶
NewProgressWriter returns a new ProgressWriter that has been initialized
type Repo ¶
type Repo struct {
Path
}
Repo provides repo path string. This is the path that binary tarballs are downloaded and built too
type RepoFiles ¶
RepoFiles provides plan files map hash
func ReadRepoFiles ¶
ReadRepoFiles reads files.json and returns a RepoFiles map hash
type Upgrader ¶
type Upgrader struct {
// contains filtered or unexported fields
}
Upgrader provides a type for upgrading installed plans
func NewUpgrader ¶
NewUpgrader creates and initializes a new Upgrader
func (*Upgrader) Check ¶
Check compares all installed plans against the git repository of plans. And returns a slice of plan names that can be upgraded