constant

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ArchiveFormat_Zip = "zip"
	ArchiveFormat_Tar = "tar"
)
View Source
const (
	CompressionMethod_Gzip    = "gzip"
	CompressionMethod_Bzip2   = "bzip2"
	CompressionMethod_XZ      = "xz"
	CompressionMethod_LZMA    = "lzma"
	CompressionMethod_ZSTD    = "zstd"
	CompressionMethod_DEFLATE = "deflate"
)
View Source
const (
	EnvName_DUKKHA_CACHE_DIR = "DUKKHA_CACHE_DIR"
	EnvName_DUKKHA_WORKDIR   = "DUKKHA_WORKDIR"

	EnvName_GIT_BRANCH         = "GIT_BRANCH"
	EnvName_GIT_COMMIT         = "GIT_COMMIT"
	EnvName_GIT_TAG            = "GIT_TAG"
	EnvName_GIT_WORKTREE_CLEAN = "GIT_WORKTREE_CLEAN"
	EnvName_GIT_DEFAULT_BRANCH = "GIT_DEFAULT_BRANCH"

	EnvName_TIME_ZONE        = "TIME_ZONE"
	EnvName_TIME_ZONE_OFFSET = "TIME_ZONE_OFFSET"
	EnvName_TIME_YEAR        = "TIME_YEAR"
	EnvName_TIME_MONTH       = "TIME_MONTH"
	EnvName_TIME_DAY         = "TIME_DAY"
	EnvName_TIME_HOUR        = "TIME_HOUR"
	EnvName_TIME_MINUTE      = "TIME_MINUTE"
	EnvName_TIME_SECOND      = "TIME_SECOND"

	// for linux: ID value in /etc/os-release
	EnvName_HOST_OS = "HOST_OS"

	// for linux: VERSION_ID value in /etc/os-release
	EnvName_HOST_OS_VERSION = "HOST_OS_VERSION"

	// value of runtime.GOOS
	EnvName_HOST_KERNEL = "HOST_KERNEL"

	// value of uname -r syscall
	EnvName_HOST_KERNEL_VERSION = "HOST_KERNEL_VERSION"

	// arch value
	EnvName_HOST_ARCH        = "HOST_ARCH"
	EnvName_HOST_ARCH_SIMPLE = "HOST_ARCH_SIMPLE"

	// triple name parts
	EnvName_MATRIX_KERNEL      = "MATRIX_KERNEL"
	EnvName_MATRIX_ARCH        = "MATRIX_ARCH"
	EnvName_MATRIX_ARCH_SIMPLE = "MATRIX_ARCH_SIMPLE"
	EnvName_MATRIX_LIBC        = "MATRIX_LIBC"
)
View Source
const (
	KERNEL_Windows    = "windows"
	KERNEL_Linux      = "linux"
	KERNEL_Darwin     = "darwin"
	KERNEL_FreeBSD    = "freebsd"
	KERNEL_NetBSD     = "netbsd"
	KERNEL_OpenBSD    = "openbsd"
	KERNEL_Solaris    = "solaris"
	KERNEL_Illumos    = "illumos"
	KERNEL_JavaScript = "js"
	KERNEL_Aix        = "aix"
	KERNEL_Android    = "android"
	KERNEL_iOS        = "ios"
	KERNEL_Plan9      = "plan9"
)
View Source
const (
	LIBC_GNU  = "gnu"
	LIBC_MSVC = "msvc"
	LIBC_MUSL = "musl"
)

nolint:revive

View Source
const (
	// debian apt
	PM_APT = "apt"

	// alpine apk
	PM_APK = "apk"

	// centos yum
	PM_YUM = "yum"

	// fedora dnf
	PM_DNF = "dnf"

	// nix
	PM_NIX = "nix"

	// homebrew
	PM_BREW = "brew"
)

nolint:revive

View Source
const (
	// linux/gnu family
	Platform_Alpine = "alpine"
	Platform_Debian = "debian"
	Platform_Ubuntu = "ubuntu"
	Platform_GNU    = "gnu"

	// windows family
	Platform_WindowsNT    = "windows_nt"    // native windows (libc: MSVC)
	Platform_WindowsMINGW = "windows_mingw" // posix windows (libc: mingw)

	// darwin family
	Platform_MacOS   = "macos"
	Platform_iOS     = "ios"
	Platform_WatchOS = "watchos"

	// golang family
	Platform_Golang = "golang"
	Platform_Docker = "docker"
	Platform_OCI    = "oci"

	Platform_DockerHub = "dockerhub"

	// llvm family
	Platform_LLVM = "llvm"
	Platform_Zig  = "zig"
	Platform_Rust = "rust"

	Platform_QEMU = "qemu"
)
View Source
const (
	// Placeholder for current tool cmd (string slice)
	DUKKHA_TOOL_CMD = "DUKKHA_TOOL_CMD"
)

nolint:revive

View Source
const (
	DefaultCacheDir = ".dukkha/cache"
)

Variables

Functions

func CrossPlatform added in v0.8.0

func CrossPlatform(
	targetKernel, targetArch,
	hostKernel, hostArch string,
) bool

func GetAlpineArch

func GetAlpineArch(mArch string) (string, bool)

func GetAlpineTripleName

func GetAlpineTripleName(mArch string) (string, bool)

GetAlpineTripleName of matrix arch reference: https://more.musl.cc/10/x86_64-linux-musl/ nolint:gocyclo

func GetAppleArch

func GetAppleArch(mArch string) (string, bool)

TODO: determine apple arch nolint:gocyclo

func GetAppleTripleName

func GetAppleTripleName(mArch, darwinVersion string) (string, bool)

nolint:gocyclo

func GetArch added in v0.2.0

func GetArch(platform, mArch string) (string, bool)

func GetDebianArch

func GetDebianArch(mArch string) (string, bool)

func GetDebianTripleName

func GetDebianTripleName(mArch string, targetKernel, targetLibc string) (v string, ok bool)

nolint:gocyclo

func GetDockerArch

func GetDockerArch(mArch string) (string, bool)

func GetDockerArchVariant

func GetDockerArchVariant(mArch string) (string, bool)

nolint:gocyclo

func GetDockerHubArch

func GetDockerHubArch(mArch, mKernel string) (string, bool)

func GetDockerOS

func GetDockerOS(kernel string) (string, bool)

GetDockerOS is currently an alias of GetGolangOS

func GetGNUArch added in v0.2.0

func GetGNUArch(mArch string) (string, bool)

func GetGolangArch

func GetGolangArch(mArch string) (string, bool)

func GetGolangOS

func GetGolangOS(kernel string) (string, bool)

GetGolangOS get GOOS value by kernel value, return true if kernel value is known to this package

func GetLLVMArch added in v0.2.0

func GetLLVMArch(mArch string) (string, bool)

func GetLLVMTripleName added in v0.4.0

func GetLLVMTripleName(mArch, targetKernel, targetLibc string) (string, bool)

ref: https://llvm.org/doxygen/Triple_8h_source.html

func GetOciArch

func GetOciArch(mArch string) (string, bool)

func GetOciArchVariant

func GetOciArchVariant(mArch string) (string, bool)

currently it's the same as docker arch variant nolint:gocyclo

func GetOciOS

func GetOciOS(kernel string) (string, bool)

GetOciOS is currently an alias of GetGolangOS

func GetQemuArch

func GetQemuArch(mArch string) (string, bool)

func GetRustArch added in v0.2.0

func GetRustArch(mArch string) (string, bool)

func GetZigArch added in v0.2.0

func GetZigArch(mArch string) (string, bool)

func HardFloatArch added in v0.9.0

func HardFloatArch(arch string) string

HardFloatArch returns hardfloat version of arch

func SimpleArch added in v0.8.0

func SimpleArch(arch string) string

SimpleArch generalizes cpu micro arch for practical use

- amd64v{1, 2, 3, 4} => amd64 - arm64v{8, 9} => arm64 - ppc64{, le}v{8, 9} => ppc64{, le}

Exceptions: - armv{5, 6, 7} are kept as is - arm => armv7

func SoftFloatArch added in v0.9.0

func SoftFloatArch(arch string) string

SoftFloatArch returns hardfloat version of arch

Types

type GlobalEnv added in v0.9.0

type GlobalEnv int32
const (
	GlobalEnv_DUKKHA_WORKDIR GlobalEnv = iota
	GlobalEnv_DUKKHA_CACHE_DIR

	GlobalEnv_GIT_BRANCH
	GlobalEnv_GIT_COMMIT
	GlobalEnv_GIT_TAG
	GlobalEnv_GIT_WORKTREE_CLEAN
	GlobalEnv_GIT_DEFAULT_BRANCH

	GlobalEnv_TIME_ZONE
	GlobalEnv_TIME_ZONE_OFFSET
	GlobalEnv_TIME_YEAR
	GlobalEnv_TIME_MONTH
	GlobalEnv_TIME_DAY
	GlobalEnv_TIME_HOUR
	GlobalEnv_TIME_MINUTE
	GlobalEnv_TIME_SECOND

	GlobalEnv_HOST_OS
	GlobalEnv_HOST_OS_VERSION
	GlobalEnv_HOST_KERNEL
	GlobalEnv_HOST_KERNEL_VERSION
	GlobalEnv_HOST_ARCH
	GlobalEnv_HOST_ARCH_SIMPLE

	GlobalEnv_Count
)

func GetGlobalEnvIDByName added in v0.9.0

func GetGlobalEnvIDByName(name string) GlobalEnv

GetGlobalEnvIDByName return -1 when name is not a global env name

func (GlobalEnv) String added in v0.9.0

func (f GlobalEnv) String() string

type ZipCompressionMethod added in v0.5.1

type ZipCompressionMethod uint16

https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT#4.4.5

const (
	ZipCompressionMethod_Store   ZipCompressionMethod = 0
	ZipCompressionMethod_Deflate ZipCompressionMethod = 8
	ZipCompressionMethod_BZIP2   ZipCompressionMethod = 12
	ZipCompressionMethod_LZMA    ZipCompressionMethod = 14
	ZipCompressionMethod_ZSTD    ZipCompressionMethod = 93
	ZipCompressionMethod_XZ      ZipCompressionMethod = 95
)

func (ZipCompressionMethod) String added in v0.5.1

func (m ZipCompressionMethod) String() string

Jump to

Keyboard shortcuts

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