Documentation ¶
Index ¶
- Constants
- func CheckDir(path string) error
- func CheckDirLists(dirs ...string) error
- func DepTreeRecover(metas *map[string]PackageMeta, filename string) error
- func ExpandEnv(origin string, envs *PackageEnvs) (string, error)
- func GetCMakeVendorPkgPath(packageName string) (path string)
- func GetCachePath(base, packageName string) (path string)
- func GetCachedPackageSrcPath(packageName string, version string) (string, error)
- func GetDepGraphPath(base string) string
- func GetHomeSrcPath() (string, error)
- func GetIncludePath(base string) (path string)
- func GetPackageDepsPath(base string, packageName string) (path string)
- func GetPackagePkgPath(base string, packageName string) (path string)
- func GetPkgBuildPath(base string) string
- func GetPkgIncludePath(base string, packageName string) (path string)
- func GetPkgPath(base string) (path string)
- func GetPkgSrcPath(base string) string
- func GetPkgSumPath(base string) string
- func GetPkgUserHomeFile(suffixPath string) (string, error)
- func GetVendorPath(base string) string
- func LoadListFromGraph(graphPath, packageName string) ([]string, error)
- func RelativePath(base, target string) string
- func Unzip(src string, dest string) error
- func UrlJoin(base, ele string) string
- type DependencyTree
- func (depTree *DependencyTree) Dump(filename string) error
- func (depTree *DependencyTree) ListDeps(skipRoot bool) ([]*DependencyTree, error)
- func (depTree *DependencyTree) ListDepsName() ([]string, error)
- func (depTree *DependencyTree) MarshalGraph(writer io.Writer) error
- func (depTree *DependencyTree) Traversal(callback func(*DependencyTree) bool)
- func (depTree *DependencyTree) TraversalDeep(callback func(*DependencyTree) error) error
- func (depTree *DependencyTree) TraversalPreOrder(callback func(*DependencyTree) bool) bool
- type InsTriple
- type PackageEnvs
- type PackageMeta
- type V1FilesPackage
- type V1GitPackage
- type V1Package
- type V1Packages
- type YamlArchivePackage
- type YamlDependencies
- type YamlFilesPackage
- type YamlGitPackage
- type YamlPackage
- type YamlPkg
Constants ¶
const ( DlStatusEmpty = iota DlStatusSkip DlStatusOk )
const ( InsCmake = "CMAKE" // run cmake configuration and build,install InsAutoPkg = "AUTO_PKG" )
this shows the supported instructions in pkg
const ( VendorName = "vendor" VendorCache = "cache" VendorSrc = "src" VendorPkg = "pkg" VendorScripts = "scripts" VendorInclude = "include" VendorLib = "lib" VendorLib64 = "lib64" VendorUserHome = ".pkg" VendorUserHomeSrc = "registry/default-pkg/src" )
const ( PkgFileName = "pkg.yaml" PurgePkgSumFileName = "pkg.sum.yaml" PkgSumFileName = VendorName + "/" + PurgePkgSumFileName VendorSrcDir = VendorName + "/" + "src" BuildShellName = "pkg.build.sh" CMakeDep = "pkg.dep.cmake" DepGraph = "pkg.graph" CMakeVendorPath = "${VENDOR_PATH}" )
const RootPKG = "root"
Variables ¶
This section is empty.
Functions ¶
func DepTreeRecover ¶
func DepTreeRecover(metas *map[string]PackageMeta, filename string) error
recover the dependency tree from a yaml file. the result is saved in variable metas.
func ExpandEnv ¶ added in v0.4.0
func ExpandEnv(origin string, envs *PackageEnvs) (string, error)
replace origin string with args values.
func GetCMakeVendorPkgPath ¶
return ${VENDOR_PATH}/pkg/@packageName
func GetCachePath ¶
return @base/vendor/cache
func GetCachedPackageSrcPath ¶ added in v0.3.3
func GetDepGraphPath ¶
func GetHomeSrcPath ¶
return $HOME/.pkg/registry/default-pkg/src
func GetPackageDepsPath ¶ added in v0.4.0
return @base/vendor/deps/@packageName
func GetPackagePkgPath ¶
return @base/vendor/pkg/@packageName
func GetPkgBuildPath ¶
func GetPkgIncludePath ¶
return @base/vendor/pkg/@packageName/include
func GetPkgSrcPath ¶ added in v0.3.3
func GetPkgSumPath ¶
func GetPkgUserHomeFile ¶
func GetVendorPath ¶
func LoadListFromGraph ¶
func RelativePath ¶
// change path to relative path, replace PKG_DIR with relative path.
func Unzip ¶
FROM https://golangcode.com/unzip-files-in-go/ Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).
Types ¶
type DependencyTree ¶
type DependencyTree struct { Dependencies []*DependencyTree Context PackageMeta DlStatus int IsPkgPackage bool }
func (*DependencyTree) Dump ¶
func (depTree *DependencyTree) Dump(filename string) error
marshal dependency tree content to a yaml file.
func (*DependencyTree) ListDeps ¶
func (depTree *DependencyTree) ListDeps(skipRoot bool) ([]*DependencyTree, error)
list all dependencies packages of a package by TraversalDeep.
func (*DependencyTree) ListDepsName ¶ added in v0.3.3
func (depTree *DependencyTree) ListDepsName() ([]string, error)
list all dependencies packages name of a package by TraversalDeep.
func (*DependencyTree) MarshalGraph ¶
func (depTree *DependencyTree) MarshalGraph(writer io.Writer) error
dump direct and indirect dependencies packages of all packages.
func (*DependencyTree) Traversal ¶
func (depTree *DependencyTree) Traversal(callback func(*DependencyTree) bool)
traversal all tree node with pre-order. if the return value of callback function is false, it will skip its children nodes.
func (*DependencyTree) TraversalDeep ¶
func (depTree *DependencyTree) TraversalDeep(callback func(*DependencyTree) error) error
traversal all tree node(including the root node) by deep first strategy. if return value of callback is false, then the traversal will break.
func (*DependencyTree) TraversalPreOrder ¶
func (depTree *DependencyTree) TraversalPreOrder(callback func(*DependencyTree) bool) bool
traversal all tree node with pre-order. if the return value of callback function is false, then the traversal will break.
type PackageEnvs ¶ added in v0.4.0
type PackageEnvs struct { PkgRoot string `pkg:"PKG_ROOT"` // the path running pkg VendorPath string `pkg:"VENDOR_PATH"` // vendor PkgInCPath string `pkg:"INCLUDE"` // vendor/include PackageCacheDir string `pkg:"CACHE"` // vendor/cache/@pkg PackagePkgDir string `pkg:"PKG_DIR"` // vendor/pkg/@pkg PackagePkgIncDir string `pkg:"PKG_INC"` // vendor/pkg/@pkg/include PackageSrcDir string `pkg:"SRC_DIR"` // vendor/src/@pkg PackageFindPath string `pkg:"PKG_FIND_PATH"` // vendor/deps/@pkg or vendor/pkg/@pkg (decided by env) CMakePackageFindDir string `pkg:"CMAKE_VENDOR_PATH_PKG"` // vendor/pkg/@pkg }
paths env variable used in instruction
func NewPackageEnvs ¶ added in v0.4.0
func NewPackageEnvs(pkgRoot, packageName, packageSrc string) *PackageEnvs
pkgRoot: the root directory of project packageName: package name/path packageSrcPath: path of package source
type PackageMeta ¶
type PackageMeta struct { PackageName string `yaml:"pkg"` // package name (usually it is a path) TargetName string `yaml:"target"` // cmake package name Features []string `yaml:"features"` // SrcPath string `yaml:"-"` Version string `yaml:"version"` Builder []string `yaml:"builder"` // outer builder (lib used by others, specified by others pkg) SelfBuild []string `yaml:"self_build"` // inner builder (shows how this package is built, specified in package's pkg.yaml file) CMakeLib string `yaml:"cmake_lib"` // outer cmake script to add this lib. SelfCMakeLib string `yaml:"self_cmake_lib"` // inner cmake script to add this lib. }
package metadata used in sum file.
func (*PackageMeta) HomeCacheSrcPath ¶ added in v0.3.3
func (ctx *PackageMeta) HomeCacheSrcPath() string
return directory path of cached source in user home
func (*PackageMeta) SetPackageName ¶ added in v0.3.3
func (ctx *PackageMeta) SetPackageName(key string) error
func (*PackageMeta) VendorSrcPath ¶ added in v0.3.3
func (ctx *PackageMeta) VendorSrcPath(base string) string
return directory path of source in vendor
type V1FilesPackage ¶ added in v0.3.3
type V1GitPackage ¶ added in v0.3.3
type V1Packages ¶ added in v0.3.3
type V1Packages struct { GitPackages map[string]V1GitPackage `yaml:"git"` FilesPackages map[string]V1FilesPackage `yaml:"files"` }
for pkg file version 1.
func (*V1Packages) MigrateToV2 ¶ added in v0.3.3
func (v1 *V1Packages) MigrateToV2(d *YamlDependencies) error
type YamlArchivePackage ¶ added in v0.3.3
type YamlArchivePackage struct {
YamlPackage `yaml:",inline"`
}
type YamlDependencies ¶ added in v0.3.3
type YamlDependencies struct { GitPackages map[string]YamlGitPackage `yaml:"packages"` FilesPackages map[string]YamlFilesPackage `yaml:"files"` ArchivePackages map[string]YamlArchivePackage `yaml:"archives"` }
type YamlFilesPackage ¶ added in v0.3.3
type YamlFilesPackage struct { YamlPackage `yaml:",inline"` Files map[string]string `yaml:"files"` }
type YamlGitPackage ¶ added in v0.3.3
type YamlGitPackage struct { YamlPackage `yaml:",inline"` Version string `yaml:"version"` Target string `yaml:"target"` Features []string `yaml:"features"` }
type YamlPackage ¶ added in v0.3.3
type YamlPackage V1Package
type YamlPkg ¶ added in v0.3.3
type YamlPkg struct { Version int `yaml:"version"` Args map[string]string `yaml:"args"` GitReplace map[string]string `yaml:"git-replace"` PkgName string `yaml:"pkg"` Packages V1Packages `yaml:"packages"` // for pkg file version 1 Deps YamlDependencies `yaml:"dependencies"` Build map[string][]string `yaml:"build"` CMakeLib string `yaml:"cmake_lib"` }
for pkg yaml file parsing
func (*YamlPkg) FindBuilder ¶ added in v0.4.0
find builder by os. If builder[os] is not found, return a fallback builder.