mirror of
https://github.com/Jguer/yay.git
synced 2025-10-04 00:03:11 -04:00
Update vendored repositories
This commit is contained in:
parent
989096a46c
commit
12b79ae4aa
2
Gopkg.lock
generated
2
Gopkg.lock
generated
@ -5,7 +5,7 @@
|
||||
branch = "master"
|
||||
name = "github.com/jguer/go-alpm"
|
||||
packages = ["."]
|
||||
revision = "946a37df2f6cbb5b3c26870a9a51d3fc02ea0fe1"
|
||||
revision = "c2766b2ff83df422e2be6073099849aab33cc1e7"
|
||||
|
||||
[[projects]]
|
||||
branch = "master"
|
||||
|
12
vendor/github.com/jguer/go-alpm/callbacks.c
generated
vendored
12
vendor/github.com/jguer/go-alpm/callbacks.c
generated
vendored
@ -10,6 +10,7 @@
|
||||
#include <alpm.h>
|
||||
|
||||
void logCallback(uint16_t level, char *cstring);
|
||||
void questionCallback(alpm_question_t *question);
|
||||
|
||||
void go_alpm_log_cb(alpm_loglevel_t level, const char *fmt, va_list arg) {
|
||||
char *s = malloc(128);
|
||||
@ -25,7 +26,14 @@ void go_alpm_log_cb(alpm_loglevel_t level, const char *fmt, va_list arg) {
|
||||
}
|
||||
}
|
||||
|
||||
void go_alpm_set_logging(alpm_handle_t *handle) {
|
||||
alpm_option_set_logcb(handle, go_alpm_log_cb);
|
||||
void go_alpm_question_cb(alpm_question_t *question) {
|
||||
questionCallback(question);
|
||||
}
|
||||
|
||||
void go_alpm_set_logging(alpm_handle_t *handle) {
|
||||
alpm_option_set_logcb(handle, go_alpm_log_cb);
|
||||
}
|
||||
|
||||
void go_alpm_set_question(alpm_handle_t *handle) {
|
||||
alpm_option_set_questioncb(handle, go_alpm_question_cb);
|
||||
}
|
||||
|
24
vendor/github.com/jguer/go-alpm/callbacks.go
generated
vendored
24
vendor/github.com/jguer/go-alpm/callbacks.go
generated
vendored
@ -12,9 +12,17 @@ package alpm
|
||||
void logCallback(uint16_t level, char *cstring);
|
||||
void go_alpm_log_cb(alpm_loglevel_t level, const char *fmt, va_list arg);
|
||||
void go_alpm_set_logging(alpm_handle_t *handle);
|
||||
void go_alpm_set_question(alpm_handle_t *handle);
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type logCallbackSig func(uint16, string)
|
||||
type questionCallbackSig func(QuestionAny)
|
||||
|
||||
var DefaultLogLevel = LogWarning
|
||||
|
||||
func DefaultLogCallback(lvl uint16, s string) {
|
||||
@ -23,14 +31,26 @@ func DefaultLogCallback(lvl uint16, s string) {
|
||||
}
|
||||
}
|
||||
|
||||
var log_callback = DefaultLogCallback
|
||||
var log_callback logCallbackSig
|
||||
var question_callback questionCallbackSig
|
||||
|
||||
//export logCallback
|
||||
func logCallback(level uint16, cstring *C.char) {
|
||||
log_callback(level, C.GoString(cstring))
|
||||
}
|
||||
|
||||
func (h *Handle) SetLogCallback(cb func(uint16, string)) {
|
||||
//export questionCallback
|
||||
func questionCallback(question *C.alpm_question_t) {
|
||||
q := (*C.alpm_question_any_t)(unsafe.Pointer(question))
|
||||
question_callback(QuestionAny{q})
|
||||
}
|
||||
|
||||
func (h *Handle) SetLogCallback(cb logCallbackSig) {
|
||||
log_callback = cb
|
||||
C.go_alpm_set_logging(h.ptr)
|
||||
}
|
||||
|
||||
func (h *Handle) SetQuestionCallback(cb questionCallbackSig) {
|
||||
question_callback = cb
|
||||
C.go_alpm_set_question(h.ptr)
|
||||
}
|
||||
|
16
vendor/github.com/jguer/go-alpm/enums.go
generated
vendored
16
vendor/github.com/jguer/go-alpm/enums.go
generated
vendored
@ -97,16 +97,16 @@ const (
|
||||
LogFunction
|
||||
)
|
||||
|
||||
type Question uint
|
||||
type QuestionType uint
|
||||
|
||||
const (
|
||||
QuestionInstallIgnorepkg Question = 1 << iota
|
||||
QuestionReplacePkg
|
||||
QuestionConflictPkg
|
||||
QuestionCorruptedPkg
|
||||
QuestionRemovePkgs
|
||||
QuestionSelectProvider
|
||||
QuestionImportKey
|
||||
QuestionTypeInstallIgnorepkg QuestionType = 1 << iota
|
||||
QuestionTypeReplacePkg
|
||||
QuestionTypeConflictPkg
|
||||
QuestionTypeCorruptedPkg
|
||||
QuestionTypeRemovePkgs
|
||||
QuestionTypeSelectProvider
|
||||
QuestionTypeImportKey
|
||||
)
|
||||
|
||||
type Validation int
|
||||
|
97
vendor/github.com/jguer/go-alpm/types.go
generated
vendored
97
vendor/github.com/jguer/go-alpm/types.go
generated
vendored
@ -13,6 +13,7 @@ import "C"
|
||||
import (
|
||||
"reflect"
|
||||
"unsafe"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Description of a dependency.
|
||||
@ -150,3 +151,99 @@ func (l BackupList) Slice() (slice []BackupFile) {
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
type QuestionAny struct {
|
||||
ptr *C.alpm_question_any_t
|
||||
}
|
||||
|
||||
func (question QuestionAny) SetAnswer(answer bool) {
|
||||
if answer {
|
||||
question.ptr.answer = 1
|
||||
} else {
|
||||
question.ptr.answer = 0
|
||||
}
|
||||
}
|
||||
|
||||
type QuestionInstallIgnorepkg struct {
|
||||
ptr *C.alpm_question_install_ignorepkg_t
|
||||
}
|
||||
|
||||
func (question QuestionAny) Type() QuestionType{
|
||||
return QuestionType(question.ptr._type)
|
||||
}
|
||||
|
||||
func (question QuestionAny) Answer() bool {
|
||||
return question.ptr.answer == 1
|
||||
}
|
||||
|
||||
func (question QuestionAny) QuestionInstallIgnorepkg() (QuestionInstallIgnorepkg, error) {
|
||||
if question.Type() == QuestionTypeInstallIgnorepkg {
|
||||
return *(*QuestionInstallIgnorepkg)(unsafe.Pointer(&question)), nil
|
||||
}
|
||||
|
||||
return QuestionInstallIgnorepkg{}, fmt.Errorf("Can not convert to QuestionInstallIgnorepkg")
|
||||
}
|
||||
|
||||
func (question QuestionInstallIgnorepkg) SetInstall(install bool) {
|
||||
if install {
|
||||
question.ptr.install = 1
|
||||
} else {
|
||||
question.ptr.install = 0
|
||||
}
|
||||
}
|
||||
|
||||
func (question QuestionInstallIgnorepkg) Type() QuestionType {
|
||||
return QuestionType(question.ptr._type)
|
||||
}
|
||||
|
||||
func (question QuestionInstallIgnorepkg) Install() bool {
|
||||
return question.ptr.install == 1
|
||||
}
|
||||
|
||||
func (question QuestionInstallIgnorepkg) Pkg(h *Handle) Package {
|
||||
return Package {
|
||||
question.ptr.pkg,
|
||||
*h,
|
||||
}
|
||||
}
|
||||
|
||||
type QuestionReplace struct {
|
||||
ptr *C.alpm_question_replace_t
|
||||
}
|
||||
|
||||
func (question QuestionReplace) Type() QuestionType {
|
||||
return QuestionType(question.ptr._type)
|
||||
}
|
||||
|
||||
func (question QuestionReplace) SetReplace(replace bool) {
|
||||
if replace {
|
||||
question.ptr.replace = 1
|
||||
} else {
|
||||
question.ptr.replace = 0
|
||||
}
|
||||
}
|
||||
|
||||
func (question QuestionReplace) Replace() bool {
|
||||
return question.ptr.replace == 1
|
||||
}
|
||||
|
||||
func (question QuestionReplace) NewPkg(h *Handle) Package {
|
||||
return Package {
|
||||
question.ptr.newpkg,
|
||||
*h,
|
||||
}
|
||||
}
|
||||
|
||||
func (question QuestionReplace) OldPkg(h *Handle) Package {
|
||||
return Package {
|
||||
question.ptr.oldpkg,
|
||||
*h,
|
||||
}
|
||||
}
|
||||
|
||||
func (question QuestionReplace) newDb(h *Handle) Db {
|
||||
return Db {
|
||||
question.ptr.newdb,
|
||||
*h,
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user