Update vendor dependencies

Signed-off-by: Jguer <me@jguer.space>
This commit is contained in:
Jguer 2018-03-20 08:54:58 +01:00
parent 81bb5a1990
commit 66eac83c23
5 changed files with 57 additions and 29 deletions

2
Gopkg.lock generated
View file

@ -5,7 +5,7 @@
branch = "master"
name = "github.com/jguer/go-alpm"
packages = ["."]
revision = "c2766b2ff83df422e2be6073099849aab33cc1e7"
revision = "ec031c9cd5f6050edc3c2f23df2bff3bbb9511cc"
[[projects]]
branch = "master"

View file

@ -323,9 +323,9 @@ func (conf *PacmanConfig) CreateHandle() (*Handle, error) {
if err != nil {
return nil, err
}
// add hook directories 1-by-1 to avoid overwriting the system directory
for _,dir := range conf.HookDir {
for _, dir := range conf.HookDir {
err = h.AddHookDir(dir)
if err != nil {
return nil, err
@ -356,7 +356,7 @@ func (conf *PacmanConfig) CreateHandle() (*Handle, error) {
if err != nil {
return nil, err
}
h.SetNoUpgrades(conf.NoUpgrade...)
if err != nil {
return nil, err
@ -377,7 +377,6 @@ func (conf *PacmanConfig) CreateHandle() (*Handle, error) {
return nil, err
}
err = h.SetRemoteFileSigLevel(conf.RemoteFileSigLevel)
if err != nil {
return nil, err
@ -388,12 +387,12 @@ func (conf *PacmanConfig) CreateHandle() (*Handle, error) {
return nil, err
}
err = h.SetUseSyslog(conf.Options & ConfUseSyslog > 0)
err = h.SetUseSyslog(conf.Options&ConfUseSyslog > 0)
if err != nil {
return nil, err
}
err = h.SetCheckSpace(conf.Options & ConfCheckSpace > 0)
err = h.SetCheckSpace(conf.Options&ConfCheckSpace > 0)
if err != nil {
return nil, err
}

View file

@ -65,7 +65,7 @@ func (h Handle) LastError() error {
//
//helper functions for wrapping list_t getters and setters
func (h Handle) optionGetList(f func(*C.alpm_handle_t) *C.alpm_list_t) (StringList, error){
func (h Handle) optionGetList(f func(*C.alpm_handle_t) *C.alpm_list_t) (StringList, error) {
alpmList := f(h.ptr)
goList := StringList{(*list)(unsafe.Pointer(alpmList))}
@ -75,7 +75,6 @@ func (h Handle) optionGetList(f func(*C.alpm_handle_t) *C.alpm_list_t) (StringLi
return goList, nil
}
func (h Handle) optionSetList(hookDirs []string, f func(*C.alpm_handle_t, *C.alpm_list_t) C.int) error {
var list *C.alpm_list_t = nil
@ -141,9 +140,9 @@ func (h Handle) optionSetStr(str string, f func(*C.alpm_handle_t, *C.char) C.int
ok := f(h.ptr, c_str)
if ok < 0 {
h.LastError()
h.LastError()
}
return nil
return nil
}
//
@ -168,7 +167,6 @@ func (h Handle) Lockfile() (string, error) {
})
}
func (h Handle) CacheDirs() (StringList, error) {
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
return C.alpm_option_get_cachedirs(handle)
@ -472,7 +470,6 @@ func (h Handle) SetArch(str string) error {
})
}
func (h Handle) DeltaRatio() (float64, error) {
ok := C.alpm_option_get_deltaratio(h.ptr)
if ok < 0 {
@ -489,7 +486,6 @@ func (h Handle) SetDeltaRatio(ratio float64) error {
return nil
}
func (h Handle) CheckSpace() (bool, error) {
ok := C.alpm_option_get_checkspace(h.ptr)
b := false
@ -539,7 +535,7 @@ func (h Handle) GetDefaultSigLevel() (SigLevel, error) {
func (h Handle) SetDefaultSigLevel(siglevel SigLevel) error {
ok := C.alpm_option_set_default_siglevel(h.ptr, C.alpm_siglevel_t(siglevel))
if ok < 0 {
return h.LastError()
}
@ -557,7 +553,7 @@ func (h Handle) GetLocalFileSigLevel() (SigLevel, error) {
func (h Handle) SetLocalFileSigLevel(siglevel SigLevel) error {
ok := C.alpm_option_set_local_file_siglevel(h.ptr, C.alpm_siglevel_t(siglevel))
if ok < 0 {
return h.LastError()
}

View file

@ -93,7 +93,6 @@ func (l DependList) Slice() []Depend {
return slice
}
func (pkg Package) FileName() string {
return C.GoString(C.alpm_pkg_get_filename(pkg.pmpkg))
}
@ -106,7 +105,6 @@ func (pkg Package) Base64Signature() string {
return C.GoString(C.alpm_pkg_get_base64_sig(pkg.pmpkg))
}
func (pkg Package) Validation() Validation {
return Validation(C.alpm_pkg_get_validation(pkg.pmpkg))
}

View file

@ -11,18 +11,18 @@ package alpm
import "C"
import (
"fmt"
"reflect"
"unsafe"
"fmt"
)
// Description of a dependency.
type Depend struct {
Name string
Version string
Name string
Version string
Description string
NameHash uint
Mod DepMod
NameHash uint
Mod DepMod
}
func convertDepend(dep *C.alpm_depend_t) Depend {
@ -168,7 +168,7 @@ type QuestionInstallIgnorepkg struct {
ptr *C.alpm_question_install_ignorepkg_t
}
func (question QuestionAny) Type() QuestionType{
func (question QuestionAny) Type() QuestionType {
return QuestionType(question.ptr._type)
}
@ -184,6 +184,14 @@ func (question QuestionAny) QuestionInstallIgnorepkg() (QuestionInstallIgnorepkg
return QuestionInstallIgnorepkg{}, fmt.Errorf("Can not convert to QuestionInstallIgnorepkg")
}
func (question QuestionAny) QuestionSelectProvider() (QuestionSelectProvider, error) {
if question.Type() == QuestionTypeSelectProvider {
return *(*QuestionSelectProvider)(unsafe.Pointer(&question)), nil
}
return QuestionSelectProvider{}, fmt.Errorf("Can not convert to QuestionInstallIgnorepkg")
}
func (question QuestionInstallIgnorepkg) SetInstall(install bool) {
if install {
question.ptr.install = 1
@ -201,7 +209,7 @@ func (question QuestionInstallIgnorepkg) Install() bool {
}
func (question QuestionInstallIgnorepkg) Pkg(h *Handle) Package {
return Package {
return Package{
question.ptr.pkg,
*h,
}
@ -224,26 +232,53 @@ func (question QuestionReplace) SetReplace(replace bool) {
}
func (question QuestionReplace) Replace() bool {
return question.ptr.replace == 1
return question.ptr.replace == 1
}
func (question QuestionReplace) NewPkg(h *Handle) Package {
return Package {
return Package{
question.ptr.newpkg,
*h,
}
}
func (question QuestionReplace) OldPkg(h *Handle) Package {
return Package {
return Package{
question.ptr.oldpkg,
*h,
}
}
func (question QuestionReplace) newDb(h *Handle) Db {
return Db {
return Db{
question.ptr.newdb,
*h,
}
}
type QuestionSelectProvider struct {
ptr *C.alpm_question_select_provider_t
}
func (question QuestionSelectProvider) Type() QuestionType {
return QuestionType(question.ptr._type)
}
func (question QuestionSelectProvider) SetUseIndex(index int) {
question.ptr.use_index = C.int(index)
}
func (question QuestionSelectProvider) UseIndex() int {
return int(question.ptr.use_index)
}
func (question QuestionSelectProvider) Providers(h *Handle) PackageList {
return PackageList{
(*list)(unsafe.Pointer(question.ptr.providers)),
*h,
}
}
func (question QuestionSelectProvider) Dep() Depend {
return convertDepend(question.ptr.depend)
}