Merge pull request #1077 from Jguer/pacman-next

Update go-alpm for pacman-next
This commit is contained in:
J Guerreiro 2019-10-22 09:40:57 +02:00 committed by GitHub
commit e1403861c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 99 additions and 77 deletions

View File

@ -430,10 +430,6 @@ func configureAlpm(conf *pacmanconf.Config) error {
return err
}*/
if err := alpmHandle.SetDeltaRatio(pacmanConf.UseDelta); err != nil {
return err
}
if err := alpmHandle.SetUseSyslog(pacmanConf.UseSyslog); err != nil {
return err
}

2
go.mod
View File

@ -1,7 +1,7 @@
module github.com/Jguer/yay/v9
require (
github.com/Jguer/go-alpm v0.0.0-20190627095237-ec8523c9bb21
github.com/Jguer/go-alpm v0.0.0-20191021114528-e11e8a60f385
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
github.com/Morganamilo/go-srcinfo v1.0.0
github.com/mikkeloscar/aur v0.0.0-20190912174111-183f80a38525

4
go.sum
View File

@ -1,5 +1,5 @@
github.com/Jguer/go-alpm v0.0.0-20190627095237-ec8523c9bb21 h1:byeuFn/If54Ty6HzKeKlwTPIUKSag/aZTNcPLZsp1ms=
github.com/Jguer/go-alpm v0.0.0-20190627095237-ec8523c9bb21/go.mod h1:D5SUcIS9Yiz/L8cjRzq/992eERnx6ugYmGlc4e7xdus=
github.com/Jguer/go-alpm v0.0.0-20191021114528-e11e8a60f385 h1:zbR80csn6BWooOwjFjUHzIKVgrtg5EN3Qp4cvYlPTYw=
github.com/Jguer/go-alpm v0.0.0-20191021114528-e11e8a60f385/go.mod h1:D5SUcIS9Yiz/L8cjRzq/992eERnx6ugYmGlc4e7xdus=
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f h1:ptFKynTV1p8JCzqk81NcMj0DV0Xle+PdKxfHjPbdIOU=
github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f/go.mod h1:Hk55m330jNiwxRodIlMCvw5iEyoRUCIY64W1p9D+tHc=
github.com/Morganamilo/go-srcinfo v1.0.0 h1:Wh4nEF+HJWo+29hnxM18Q2hi+DUf0GejS13+Wg+dzmI=

14
vendor/github.com/Jguer/go-alpm/Dockerfile generated vendored Normal file
View File

@ -0,0 +1,14 @@
FROM archlinux:latest
LABEL maintainer="Jguer,joaogg3 at google mail"
ENV GO111MODULE=on
WORKDIR /app
RUN pacman -Sy --overwrite=* --needed --noconfirm \
archlinux-keyring pacman make gcc gcc-go awk pacman-contrib && paccache -rfk0
# Dependency for linting
# RUN curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b /bin v1.20.0
# RUN go get golang.org/x/lint/golint && mv /root/go/bin/golint /bin/
COPY . .

25
vendor/github.com/Jguer/go-alpm/Makefile generated vendored Normal file
View File

@ -0,0 +1,25 @@
export GO111MODULE=on
GOFLAGS := -v -mod=vendor
EXTRA_GOFLAGS ?=
LDFLAGS := $(LDFLAGS)
GO ?= go
SOURCES ?= $(shell find . -name "*.go" -type f ! -path "./vendor/*")
.PHONY: default
default: build
.PHONY: build
build:
$(GO) build $(GOFLAGS) -ldflags '-s -w $(LDFLAGS)' $(EXTRA_GOFLAGS)
.PHONY: test
test:
$(GO) vet $(GOFLAGS) .
@test -z "$$(gofmt -l *.go)" || (echo "Files need to be linted. Use make fmt" && false)
$(GO) test $(GOFLAGS) .
.PHONY: fmt
fmt:
gofmt -s -w $(SOURCES)

3
vendor/github.com/Jguer/go-alpm/go.mod generated vendored Normal file
View File

@ -0,0 +1,3 @@
module github.com/Jguer/go-alpm
go 1.12

View File

@ -370,58 +370,60 @@ func (h *Handle) AddAssumeInstalled(dep Depend) error {
return nil
}
func (h *Handle) SetAssumeInstalled(deps []Depend) error {
//calling this function the first time causes alpm to set the
//assumeinstalled list to a list containing go allocated alpm_depend_t's
//this is bad because alpm might at some point tree to free them
//i believe this is whats causing this function to misbhave
//although i am not 100% sure
//maybe using C.malloc to make the struct could fix the problem
//pacamn does not use alpm_option_set_assumeinstalled in its source
//code so anybody using this should beable to do file without it
//although for the sake of completeness it would be nice to have this
//working
panic("This function (SetAssumeInstalled) does not work properly, please do not use. See source code for more details")
var list *C.alpm_list_t
// TODO: Fix
// func (h *Handle) SetAssumeInstalled(deps []Depend) error {
// //calling this function the first time causes alpm to set the
// //assumeinstalled list to a list containing go allocated alpm_depend_t's
// //this is bad because alpm might at some point tree to free them
// //i believe this is whats causing this function to misbhave
// //although i am not 100% sure
// //maybe using C.malloc to make the struct could fix the problem
// //pacamn does not use alpm_option_set_assumeinstalled in its source
// //code so anybody using this should beable to do file without it
// //although for the sake of completeness it would be nice to have this
// //working
// panic("This function (SetAssumeInstalled) does not work properly, please do not use. See source code for more details")
// var list *C.alpm_list_t
for _, dep := range deps {
cDep := convertCDepend(dep)
defer freeCDepend(cDep)
list = C.alpm_list_add(list, unsafe.Pointer(cDep))
}
// for _, dep := range deps {
// cDep := convertCDepend(dep)
// defer freeCDepend(cDep)
// list = C.alpm_list_add(list, unsafe.Pointer(cDep))
// }
ok := C.alpm_option_set_assumeinstalled(h.ptr, list)
if ok < 0 {
return h.LastError()
}
return nil
// ok := C.alpm_option_set_assumeinstalled(h.ptr, list)
// if ok < 0 {
// return h.LastError()
// }
// return nil
}
// }
func (h *Handle) RemoveAssumeInstalled(dep Depend) (bool, error) {
//internally alpm uses alpm_list_remove to remove a alpm_depend_t from
//the list
//i believe this function considers items equal if they are the same
//item in memeory, not just the same data
//every time we convert a go Depend to a alpm_depend_c we create a new
//instance of a alpm_depend_c
//this means that if you add a Depend using AddAssumeInstalled then try
//to remove it using the same Depend c will consider them different
//items and not remove them
//pacamn does not use alpm_option_set_assumeinstalled in its source
//code so anybody using this should beable to do file without it
//although for the sake of completeness it would be nice to have this
//working
panic("This function (RemoveAssumeInstalled) does not work properly, please do not use. See source code for more details")
cDep := convertCDepend(dep)
defer freeCDepend(cDep)
// TODO: Fix
// func (h *Handle) RemoveAssumeInstalled(dep Depend) (bool, error) {
//internally alpm uses alpm_list_remove to remove a alpm_depend_t from
//the list
//i believe this function considers items equal if they are the same
//item in memeory, not just the same data
//every time we convert a go Depend to a alpm_depend_c we create a new
//instance of a alpm_depend_c
//this means that if you add a Depend using AddAssumeInstalled then try
//to remove it using the same Depend c will consider them different
//items and not remove them
//pacamn does not use alpm_option_set_assumeinstalled in its source
//code so anybody using this should beable to do file without it
//although for the sake of completeness it would be nice to have this
//working
// panic("This function (RemoveAssumeInstalled) does not work properly, please do not use. See source code for more details")
// cDep := convertCDepend(dep)
// defer freeCDepend(cDep)
ok := C.alpm_option_remove_assumeinstalled(h.ptr, cDep)
if ok < 0 {
return ok == 1, h.LastError()
}
return ok == 1, nil
}
// ok := C.alpm_option_remove_assumeinstalled(h.ptr, cDep)
// if ok < 0 {
// return ok == 1, h.LastError()
// }
// return ok == 1, nil
// }
func (h *Handle) Arch() (string, error) {
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
@ -435,22 +437,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 {
return float64(ok), h.LastError()
}
return float64(ok), nil
}
func (h *Handle) SetDeltaRatio(ratio float64) error {
ok := C.alpm_option_set_deltaratio(h.ptr, C.double(ratio))
if ok < 0 {
return h.LastError()
}
return nil
}
// LocalDB returns the local database relative to the given handle.
func (h *Handle) LocalDB() (*DB, error) {
db := C.alpm_get_localdb(h.ptr)

View File

@ -114,11 +114,6 @@ func (pkg *Package) Architecture() string {
return C.GoString(C.alpm_pkg_get_arch(pkg.pmpkg))
}
func (pkg *Package) Deltas() StringList {
ptr := unsafe.Pointer(C.alpm_pkg_get_deltas(pkg.pmpkg))
return StringList{(*list)(ptr)}
}
// Backup returns a list of package backups.
func (pkg *Package) Backup() BackupList {
ptr := unsafe.Pointer(C.alpm_pkg_get_backup(pkg.pmpkg))

View File

@ -15,7 +15,7 @@ import "unsafe"
// NewVersion checks if there is a new version of the package in a given DBlist.
func (pkg *Package) SyncNewVersion(l DBList) *Package {
ptr := C.alpm_sync_newversion(pkg.pmpkg,
ptr := C.alpm_sync_get_new_version(pkg.pmpkg,
(*C.alpm_list_t)(unsafe.Pointer(l.list)))
if ptr == nil {
return nil

3
vendor/github.com/mikkeloscar/aur/go.mod generated vendored Normal file
View File

@ -0,0 +1,3 @@
module github.com/mikkeloscar/aur
go 1.12

2
vendor/modules.txt vendored
View File

@ -1,4 +1,4 @@
# github.com/Jguer/go-alpm v0.0.0-20190627095237-ec8523c9bb21
# github.com/Jguer/go-alpm v0.0.0-20191021114528-e11e8a60f385
github.com/Jguer/go-alpm
# github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
github.com/Morganamilo/go-pacmanconf