Help us shape the future of Go! Take the 2026 Go Developer Survey

lib

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AlpmVersion      func() uintptr
	AlpmCapabilities func() uint64
	AlpmErrno        func(handle uintptr) int32
	AlpmStrerror     func(errno int32) uintptr
	AlpmRelease      func(handle uintptr) int32
	AlpmInitialize   func(root string, dbpath string, errno *int32) uintptr
	AlpmGetLocaldb   func(handle uintptr) uintptr
	AlpmGetSyncdbs   func(handle uintptr) uintptr
	AlpmGetLocalDB   func(handle uintptr) uintptr
	AlpmGetSyncDBS   func(handle uintptr) uintptr

	AlpmOptionGetRoot               func(handle uintptr) uintptr
	AlpmOptionGetDbpath             func(handle uintptr) uintptr
	AlpmOptionSetLogfile            func(handle uintptr, path string) int32
	AlpmOptionGetLogfile            func(handle uintptr) uintptr
	AlpmOptionSetGPGDir             func(handle uintptr, path string) int32
	AlpmOptionGetGPGDir             func(handle uintptr) uintptr
	AlpmOptionSetUseSyslog          func(handle uintptr, value int32) int32
	AlpmOptionGetUseSyslog          func(handle uintptr) int32
	AlpmOptionSetCheckspace         func(handle uintptr, value int32) int32
	AlpmOptionGetCheckspace         func(handle uintptr) int32
	AlpmOptionSetDBExt              func(handle uintptr, dbext string) int32
	AlpmOptionGetDBExt              func(handle uintptr) uintptr
	AlpmOptionSetDefaultSigLevel    func(handle uintptr, value int32) int32
	AlpmOptionGetDefaultSigLevel    func(handle uintptr) int32
	AlpmOptionSetLocalFileSigLevel  func(handle uintptr, value int32) int32
	AlpmOptionGetLocalFileSigLevel  func(handle uintptr) int32
	AlpmOptionSetRemoteFileSigLevel func(handle uintptr, value int32) int32
	AlpmOptionGetRemoteFileSigLevel func(handle uintptr) int32
	AlpmOptionSetParallelDownloads  func(handle uintptr, value int32) int32
	AlpmOptionGetParallelDownloads  func(handle uintptr) int32
	AlpmOptionSetCachedirs          func(handle uintptr, list uintptr) int32
	AlpmOptionGetCachedirs          func(handle uintptr) uintptr
	AlpmOptionSetHookdirs           func(handle uintptr, list uintptr) int32
	AlpmOptionGetHookdirs           func(handle uintptr) uintptr
	AlpmOptionSetNoUpgrades         func(handle uintptr, list uintptr) int32
	AlpmOptionGetNoUpgrades         func(handle uintptr) uintptr
	AlpmOptionSetNoextracts         func(handle uintptr, list uintptr) int32
	AlpmOptionGetNoextracts         func(handle uintptr) uintptr
	AlpmOptionSetIgnorepkgs         func(handle uintptr, list uintptr) int32
	AlpmOptionGetIgnorepkgs         func(handle uintptr) uintptr
	AlpmOptionSetIgnoregroups       func(handle uintptr, list uintptr) int32
	AlpmOptionGetIgnoregroups       func(handle uintptr) uintptr
	AlpmOptionSetOverwriteFiles     func(handle uintptr, list uintptr) int32
	AlpmOptionGetOverwriteFiles     func(handle uintptr) uintptr
	AlpmOptionMatchNoUpgrade        func(handle uintptr, path string) int32
	AlpmOptionMatchNoextract        func(handle uintptr, path string) int32
	AlpmOptionSetSandboxuser        func(handle uintptr, user string) int32
	AlpmOptionGetSandboxuser        func(handle uintptr) uintptr
	AlpmOptionSetDisableDlTimeout   func(handle uintptr, value int32) int32
	AlpmOptionSetDisableSandbox     func(handle uintptr, value int32) int32
	AlpmOptionSetArchitectures      func(handle uintptr, list uintptr) int32
	AlpmOptionGetArchitectures      func(handle uintptr) uintptr
	AlpmOptionAddCachedir           func(handle uintptr, path string) int32
	AlpmOptionRemoveCachedir        func(handle uintptr, path string) int32
	AlpmOptionAddHookdir            func(handle uintptr, path string) int32
	AlpmOptionRemoveHookdir         func(handle uintptr, path string) int32
	AlpmOptionAddNoupgrade          func(handle uintptr, path string) int32
	AlpmOptionRemoveNoupgrade       func(handle uintptr, path string) int32
	AlpmOptionAddNoextract          func(handle uintptr, path string) int32
	AlpmOptionRemoveNoextract       func(handle uintptr, path string) int32
	AlpmOptionAddIgnorepkg          func(handle uintptr, pkg string) int32
	AlpmOptionRemoveIgnorepkg       func(handle uintptr, pkg string) int32
	AlpmOptionAddIgnoregroup        func(handle uintptr, group string) int32
	AlpmOptionRemoveIgnoregroup     func(handle uintptr, group string) int32
	AlpmOptionAddOverwriteFile      func(handle uintptr, glob string) int32
	AlpmOptionRemoveOverwriteFile   func(handle uintptr, glob string) int32
	AlpmOptionSetLogcb              func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetLogcb              func(handle uintptr) uintptr
	AlpmOptionGetLogcbCtx           func(handle uintptr) uintptr
	AlpmOptionSetDlopencb           func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetDlopencb           func(handle uintptr) uintptr
	AlpmOptionGetDlopencbCtx        func(handle uintptr) uintptr
	AlpmOptionSetDlcb               func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetDlcb               func(handle uintptr) uintptr
	AlpmOptionGetDlcbCtx            func(handle uintptr) uintptr
	AlpmOptionSetFetchcb            func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetFetchcb            func(handle uintptr) uintptr
	AlpmOptionGetFetchcbCtx         func(handle uintptr) uintptr
	AlpmOptionSetEventcb            func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetEventcb            func(handle uintptr) uintptr
	AlpmOptionGetEventcbCtx         func(handle uintptr) uintptr
	AlpmOptionSetQuestioncb         func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetQuestioncb         func(handle uintptr) uintptr
	AlpmOptionGetQuestioncbCtx      func(handle uintptr) uintptr
	AlpmOptionSetProgresscb         func(handle uintptr, cb uintptr, ctx uintptr) int32
	AlpmOptionGetProgresscb         func(handle uintptr) uintptr
	AlpmOptionGetProgresscbCtx      func(handle uintptr) uintptr
	AlpmOptionSetNoassumeInstalled  func(handle uintptr, list uintptr) int32
	AlpmOptionGetAssumeInstalled    func(handle uintptr) uintptr
	AlpmOptionAddAssumeInstalled    func(handle uintptr, dep uintptr) int32
	AlpmOptionRemoveAssumeInstalled func(handle uintptr, dep uintptr) int32
	AlpmOptionAddArchitecture       func(handle uintptr, arch string) int32
	AlpmOptionRemoveArchitecture    func(handle uintptr, arch string) int32

	AlpmTransInit            func(handle uintptr, flags int32) int32
	AlpmTransPrepare         func(handle uintptr, list *uintptr) int32
	AlpmTransCommit          func(handle uintptr, list *uintptr) int32
	AlpmTransRelease         func(handle uintptr) int32
	AlpmAddPkg               func(handle uintptr, pkg uintptr) int32
	AlpmRemovePkg            func(handle uintptr, pkg uintptr) int32
	AlpmSyncSysupgrade       func(handle uintptr, enable int32) int32
	AlpmTransGetAdd          func(handle uintptr) uintptr
	AlpmTransGetRemove       func(handle uintptr) uintptr
	AlpmTransGetFlags        func(handle uintptr) int32
	AlpmRegisterSyncDB       func(handle uintptr, name string, siglevel int32) uintptr
	AlpmUnregisterAllSyncDBs func(handle uintptr) int32
	AlpmFetchPkgurl          func(handle uintptr, urlsList uintptr, fetchedList *uintptr) int32
	AlpmTransInterrupt       func(handle uintptr) int32
	AlpmUnlock               func(handle uintptr) int32
	AlpmFindGroupPkgs        func(list uintptr, name string) uintptr
	AlpmSandboxSetupChild    func(handle uintptr, user string, dir string) int32

	AlpmLogactionSym uintptr

	AlpmDBGetName            func(db uintptr) uintptr
	AlpmDBGetPkg             func(db uintptr, name string) uintptr
	AlpmDBGetPkgcache        func(db uintptr) uintptr
	AlpmDBSearch             func(db uintptr, needles uintptr, result *uintptr) int32
	AlpmDBGetGroup           func(db uintptr, name string) uintptr
	AlpmDBGetGroupcache      func(db uintptr) uintptr
	AlpmDBUpdate             func(handle uintptr, list uintptr, force int32) int32
	AlpmDBUnregister         func(db uintptr) int32
	AlpmDBGetServers         func(db uintptr) uintptr
	AlpmDBSetServers         func(db uintptr, servers uintptr) int32
	AlpmDBAddServer          func(db uintptr, url string) int32
	AlpmDBRemoveServer       func(db uintptr, url string) int32
	AlpmDBGetCacheServers    func(db uintptr) uintptr
	AlpmDBSetCacheServers    func(db uintptr, servers uintptr) int32
	AlpmDBAddCacheServer     func(db uintptr, url string) int32
	AlpmDBRemoveCacheServer  func(db uintptr, url string) int32
	AlpmDBSetUsage           func(db uintptr, usage int32) int32
	AlpmDBGetUsage           func(db uintptr, usage *int32) int32
	AlpmDBGetValid           func(db uintptr) int32
	AlpmDBGetSiglevel        func(db uintptr) int32
	AlpmDBGetHandle          func(db uintptr) uintptr
	AlpmDBCheckPGPSignature  func(db uintptr, siglist uintptr) int32
	AlpmPkgCheckPGPSignature func(pkg uintptr, siglist uintptr) int32

	AlpmDepComputeString func(dep uintptr) uintptr
	AlpmDepFromString    func(text string) uintptr
	AlpmDepFree          func(dep uintptr) int32
	AlpmDepmissingFree   func(ptr uintptr) int32
	AlpmConflictFree     func(ptr uintptr) int32
	AlpmFileConflictFree func(ptr uintptr) int32
	AlpmCheckDeps        func(handle uintptr, pkgList uintptr, remPkgList uintptr, upgradePkgList uintptr, reverse int32) uintptr
	AlpmCheckConflicts   func(handle uintptr, pkgList uintptr) uintptr
	AlpmFindSatisfier    func(pkgs uintptr, dep string) uintptr
	AlpmFindDBSatisfier  func(handle uintptr, dbList uintptr, dep string) uintptr
	AlpmComputeMd5sum    func(filename string) uintptr
	AlpmComputeSha256sum func(filename string) uintptr
	AlpmExtractKeyID     func(handle uintptr, identifier string, sig uintptr, sigLen int32, keys *uintptr) int32

	AlpmPkgFind               func(list uintptr, name string) uintptr
	AlpmPkgGetName            func(pkg uintptr) uintptr
	AlpmPkgGetVersion         func(pkg uintptr) uintptr
	AlpmPkgGetDesc            func(pkg uintptr) uintptr
	AlpmPkgGetArch            func(pkg uintptr) uintptr
	AlpmPkgGetSize            func(pkg uintptr) int64
	AlpmPkgGetISize           func(pkg uintptr) int64
	AlpmPkgGetDB              func(pkg uintptr) uintptr
	AlpmPkgGetDepends         func(pkg uintptr) uintptr
	AlpmPkgGetConflicts       func(pkg uintptr) uintptr
	AlpmPkgGetProvides        func(pkg uintptr) uintptr
	AlpmPkgGetOptdepends      func(pkg uintptr) uintptr
	AlpmPkgGetReplaces        func(pkg uintptr) uintptr
	AlpmPkgGetGroups          func(pkg uintptr) uintptr
	AlpmPkgGetLicenses        func(pkg uintptr) uintptr
	AlpmPkgGetFilename        func(pkg uintptr) uintptr
	AlpmPkgGetReason          func(pkg uintptr) int32
	AlpmPkgGetOrigin          func(pkg uintptr) int32
	AlpmPkgGetBase            func(pkg uintptr) uintptr
	AlpmPkgGetPackager        func(pkg uintptr) uintptr
	AlpmPkgGetSha256sum       func(pkg uintptr) uintptr
	AlpmPkgGetValidation      func(pkg uintptr) int32
	AlpmPkgGetURL             func(pkg uintptr) uintptr
	AlpmPkgHasScriptlet       func(pkg uintptr) int32
	AlpmPkgDownloadSize       func(pkg uintptr) int64
	AlpmPkgGetBackup          func(pkg uintptr) uintptr
	AlpmPkgGetFiles           func(pkg uintptr) uintptr
	AlpmPkgGetInstallDate     func(pkg uintptr) int32
	AlpmPkgGetBuildDate       func(pkg uintptr) int32
	AlpmPkgGetHandle          func(pkg uintptr) uintptr
	AlpmPkgShouldIgnore       func(handle uintptr, pkg uintptr) int32
	AlpmPkgCheckmd5sum        func(pkg uintptr) int32
	AlpmPkgGetSig             func(pkg uintptr, sig *uintptr, sigLen *uintptr) int32
	AlpmPkgGetBase64Sig       func(pkg uintptr) uintptr
	AlpmPkgChangelogOpen      func(pkg uintptr) uintptr
	AlpmPkgChangelogRead      func(buf uintptr, size uintptr, pkg uintptr, fp uintptr) int
	AlpmPkgChangelogClose     func(pkg uintptr, fp uintptr)
	AlpmPkgSyncGetNewVersion  func(pkg uintptr, dbList uintptr) uintptr
	AlpmPkgGetFilesContains   func(fileList uintptr, path string) int32
	AlpmPkgFree               func(pkg uintptr) int32
	AlpmPkgGetXdata           func(pkg uintptr) uintptr
	AlpmPkgComputeRequiredBy  func(pkg uintptr) uintptr
	AlpmPkgComputeOptionalFor func(pkg uintptr) uintptr
	AlpmPkgLoad               func(handle uintptr, filename string, full int32, siglevel int32, pkg *uintptr) int32

	AlpmSiglistCleanup func(listPtr uintptr, handle uintptr) int32

	AlpmListAdd   func(list uintptr, data uintptr) uintptr
	AlpmListCount func(list uintptr, result *uintptr) int32
	AlpmListFree  func(list uintptr)

	AlpmSetLockFile func(handle uintptr, path string) int32
)
View Source
var (
	LibcFree func(ptr uintptr)
	// LibcVsnprintf formats a message into buf using a forwarded va_list (ap).
	// Used to bridge libalpm's log callback, whose final argument is a va_list.
	LibcVsnprintf func(buf uintptr, size uintptr, format uintptr, ap uintptr) int32
)

Functions

func BoolToInt

func BoolToInt(b bool) int

BoolToInt converts a Go bool to C int (0 or 1)

func CString

func CString(s string) []byte

CString converts a Go string to a null-terminated byte slice. The caller must keep the slice alive during the C call and use &buf[0] as the pointer.

func EnsureAlpmLoaded added in v0.1.2

func EnsureAlpmLoaded() error

func Free

func Free(ptr uintptr)

Free releases memory allocated by libc malloc.

func IntToBool

func IntToBool(i int32) bool

IntToBool converts a C int to Go bool

func LoadAlpm added in v0.1.2

func LoadAlpm(libalpmPath string) error

LoadAlpm loads libalpm (primary soname, then libalpm.so). Retries after a failed load.

func LoadLibrary

func LoadLibrary(libalpmPath string) error

LoadLibrary loads the ALPM library. It's safe to call multiple times.

func PtrToString

func PtrToString(ptr uintptr) string

PtrToString converts a C string pointer to a Go string This function finds the null terminator to determine the length

func PtrToStringWithLen

func PtrToStringWithLen(ptr uintptr, length int) string

PtrToStringWithLen converts a C string pointer with known length to Go string

func Syscall

func Syscall(fn uintptr, args ...uintptr) uintptr

Syscall calls a function and returns only the first return value (r1) This is a convenience wrapper for purego.SyscallN

func SyscallWithError

func SyscallWithError(fn uintptr, args ...uintptr) (uintptr, uintptr)

SyscallWithError calls a function and returns r1 and errno

Types

type FunctionCaller

type FunctionCaller interface {
	GetFunc(name string) (uintptr, error)
	CallFunc(name string, args ...uintptr) (uintptr, error)
}

FunctionCaller is implemented by MockFunctionRegistry for tests.

type MockFunctionRegistry

type MockFunctionRegistry struct {
	// contains filtered or unexported fields
}

MockFunctionRegistry is a mock implementation of FunctionCaller for testing.

func NewMockRegistry

func NewMockRegistry() *MockFunctionRegistry

NewMockRegistry creates a new mock function registry.

func (*MockFunctionRegistry) CallFunc

func (m *MockFunctionRegistry) CallFunc(name string, args ...uintptr) (uintptr, error)

CallFunc returns a mock result for the function call.

func (*MockFunctionRegistry) GetCallCount

func (m *MockFunctionRegistry) GetCallCount(name string) int

GetCallCount returns how many times a function was called.

func (*MockFunctionRegistry) GetFunc

func (m *MockFunctionRegistry) GetFunc(name string) (uintptr, error)

GetFunc returns a mock function pointer.

func (*MockFunctionRegistry) RegisterFunc

func (m *MockFunctionRegistry) RegisterFunc(name string, ptr uintptr)

RegisterFunc registers a mock function pointer.

func (*MockFunctionRegistry) Reset

func (m *MockFunctionRegistry) Reset()

Reset clears all mock data.

func (*MockFunctionRegistry) SetCallError

func (m *MockFunctionRegistry) SetCallError(name string, err error)

SetCallError sets an error that CallFunc should return for a function.

func (*MockFunctionRegistry) SetCallResult

func (m *MockFunctionRegistry) SetCallResult(name string, result uintptr)

SetCallResult sets the result that CallFunc should return for a function.

Jump to

Keyboard shortcuts

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