mirror of
https://github.com/Jguer/yay
synced 2024-10-04 15:19:08 +00:00
fix(yay): remove vendor and tweak ci
This commit is contained in:
parent
f4503ade39
commit
9795a36692
15
.github/workflows/docker-ci.yml
vendored
15
.github/workflows/docker-ci.yml
vendored
|
@ -10,15 +10,16 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
name: Build and test yay
|
||||
name: Lint and test yay
|
||||
# This job runs on Linux
|
||||
runs-on: ubuntu-latest
|
||||
container: samip537/archlinux:devel
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1#
|
||||
uses: actions/checkout@v1
|
||||
- name: Run Build and tests
|
||||
run: ./testdata/ci/full.sh
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: yay_release
|
||||
path: artifacts
|
||||
run: |
|
||||
pacman -Sy --noconfirm go
|
||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.23.6
|
||||
./bin/golangci-lint run ./...
|
||||
make test
|
||||
|
|
16
.github/workflows/docker-multiarch-tag.yml
vendored
16
.github/workflows/docker-multiarch-tag.yml
vendored
|
@ -11,7 +11,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: mathieudutour/github-tag-action@v3
|
||||
- uses: mathieudutour/github-tag-action@v4
|
||||
id: tag_version
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -22,7 +22,7 @@ jobs:
|
|||
mkdir env
|
||||
echo ${{ steps.tag_version.outputs.new_version }} > env/new_version
|
||||
echo ${{ steps.tag_version.outputs.new_tag }} > env/new_tag
|
||||
git describe --abbrev=0 > env/previous_tag
|
||||
echo ${{ steps.tag_version.outputs.changelog }} > env/changelog
|
||||
- uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: env
|
||||
|
@ -52,7 +52,7 @@ jobs:
|
|||
- name: Build ${{ matrix.arch }} release
|
||||
run: |
|
||||
mkdir artifacts
|
||||
make docker-release ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }}
|
||||
make docker-release-${{ matrix.arch }} ARCH=${{ matrix.arch }} VERSION=${{ steps.tags.outputs.version }}
|
||||
mv *.tar.gz artifacts
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
|
@ -74,11 +74,7 @@ jobs:
|
|||
run: |
|
||||
echo ::set-output name=VERSION::$(cat env/new_version)
|
||||
echo ::set-output name=TAG::$(cat env/new_tag)
|
||||
echo ::set-output name=PREV_TAG::$(cat env/previous_tag)
|
||||
- name: Set version
|
||||
id: changelog
|
||||
shell: bash
|
||||
run: echo "::set-output name=CHANGELOG::$(git log --pretty=format:'%s%n' --abbrev-commit ${{ steps.tags.outputs.prev_tag }}..)"
|
||||
echo ::set-output name=CHANGELOG::$(cat env/changelog)
|
||||
- uses: actions/download-artifact@master
|
||||
with:
|
||||
name: yay_x86_64
|
||||
|
@ -96,9 +92,7 @@ jobs:
|
|||
with:
|
||||
tag_name: ${{ steps.tags.outputs.tag }}
|
||||
release_name: ${{ steps.tags.outputs.tag }}
|
||||
body: |
|
||||
## Changelog
|
||||
${{ steps.changelog.outputs.changelog }}
|
||||
body: ${{ steps.tags.outputs.changelog }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
- name: Upload x86_64 asset
|
||||
|
|
40
Dockerfile
40
Dockerfile
|
@ -1,42 +1,12 @@
|
|||
ARG BUILD_ARCH=x86_64
|
||||
FROM sapk/archlinux:$BUILD_ARCH AS builder_env
|
||||
ARG BUILD_TAG=devel
|
||||
FROM samip537/archlinux:${BUILD_TAG}
|
||||
LABEL maintainer="Jguer,joaogg3 at google mail"
|
||||
|
||||
ENV GO111MODULE=on
|
||||
WORKDIR /app
|
||||
|
||||
RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
||||
gcc gnupg libldap go git tar make awk linux-api-headers pacman pacman-contrib && paccache -rfk0
|
||||
RUN pacman -Sy --overwrite=* --needed --noconfirm \
|
||||
go git
|
||||
|
||||
# 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/
|
||||
|
||||
ENV ARCH=$BUILD_ARCH
|
||||
ENV ARCH=x86_64
|
||||
COPY . .
|
||||
|
||||
FROM builder_env AS builder
|
||||
|
||||
# Change to include packages individually. Helps caching
|
||||
RUN make build
|
||||
|
||||
FROM archlinux/base:latest
|
||||
|
||||
RUN pacman -Syu --overwrite=* --needed --noconfirm \
|
||||
git base-devel awk pacman-contrib && paccache -rfk0
|
||||
|
||||
# Gracefully removed from https://github.com/Cognexa/dockerfiles/blob/master/dockerfiles/archlinux
|
||||
RUN useradd -m -s /bin/bash aur && \
|
||||
passwd -d aur && \
|
||||
echo 'aur ALL=(ALL) NOPASSWD: ALL' >/etc/sudoers.d/aur && \
|
||||
echo 'Defaults env_keep += "EDITOR"' >>/etc/sudoers.d/aur
|
||||
|
||||
ENV EDITOR vim
|
||||
|
||||
# set UTF-8 locale
|
||||
RUN echo 'en_US.UTF-8 UTF-8' >/etc/locale.gen && locale-gen
|
||||
ENV LANG en_US.UTF-8
|
||||
|
||||
WORKDIR /work/
|
||||
|
||||
COPY --from=builder /app/yay .
|
||||
|
|
44
Makefile
44
Makefile
|
@ -1,5 +1,7 @@
|
|||
export GO111MODULE=on
|
||||
export GOPROXY=https://proxy.golang.org
|
||||
|
||||
BUILD_TAG = devel
|
||||
ARCH ?= $(shell uname -m)
|
||||
BIN := yay
|
||||
DESTDIR :=
|
||||
|
@ -12,7 +14,7 @@ MINORVERSION := 4
|
|||
PATCHVERSION := 2
|
||||
VERSION ?= ${MAJORVERSION}.${MINORVERSION}.${PATCHVERSION}
|
||||
|
||||
GOFLAGS := -v -mod=vendor
|
||||
GOFLAGS := -v -mod=mod
|
||||
EXTRA_GOFLAGS ?=
|
||||
LDFLAGS := $(LDFLAGS) -X "main.version=${VERSION}"
|
||||
|
||||
|
@ -29,7 +31,7 @@ all: | clean release
|
|||
.PHONY: clean
|
||||
clean:
|
||||
$(GO) clean $(GOFLAGS) -i ./...
|
||||
rm -rf $(BIN) $(PKGNAME)_$(VERSION)_*
|
||||
rm -rf $(BIN) $(PKGNAME)_*
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
|
@ -55,23 +57,37 @@ $(PACKAGE): $(BIN) $(RELEASE_DIR)
|
|||
|
||||
.PHONY: docker-release-all
|
||||
docker-release-all:
|
||||
make docker-release ARCH=x86_64
|
||||
make docker-release ARCH=armv7h
|
||||
make docker-release ARCH=aarch64
|
||||
make docker-release-armv7h ARCH=armv7h
|
||||
make docker-release-x86_64 ARCH=x86_64
|
||||
make docker-release-aarch64 ARCH=aarch64
|
||||
|
||||
.PHONY: docker-release
|
||||
docker-release:
|
||||
docker build --target builder_env --build-arg BUILD_ARCH="$(ARCH)" -t yay-$(ARCH):${VERSION} .
|
||||
.PHONY: docker-release-armv7h
|
||||
docker-release-armv7h:
|
||||
docker build --build-arg="BUILD_TAG=arm32v7-devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: docker-release-aarch64
|
||||
docker-release-aarch64:
|
||||
docker build --build-arg="BUILD_TAG=arm64v8-devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: docker-release-x86_64
|
||||
docker-release-x86_64:
|
||||
docker build --build-arg="BUILD_TAG=devel" -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make release VERSION=${VERSION}
|
||||
docker cp yay-$(ARCH):/app/${PACKAGE} $(PACKAGE)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: docker-build
|
||||
docker-build:
|
||||
docker build --target builder --build-arg BUILD_ARCH="$(ARCH)" -t yay-build-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-build-${ARCH} yay-build-${ARCH}:${VERSION} /bin/sh
|
||||
docker cp yay-build-${ARCH}:/app/${BIN} ${BIN}
|
||||
docker container rm yay-build-${ARCH}
|
||||
docker build -t yay-$(ARCH):${VERSION} .
|
||||
docker run -e="ARCH=$(ARCH)" --name yay-$(ARCH) yay-$(ARCH):${VERSION} make build VERSION=${VERSION}
|
||||
docker cp yay-$(ARCH):/app/${BIN} $(BIN)
|
||||
docker container rm yay-$(ARCH)
|
||||
|
||||
.PHONY: test-vendor
|
||||
test-vendor: vendor
|
||||
|
@ -92,10 +108,6 @@ fmt:
|
|||
#go fmt -mod=vendor $(GOFILES) ./... Doesn't work yet but will be supported soon
|
||||
gofmt -s -w $(SOURCES)
|
||||
|
||||
.PHONY: vendor
|
||||
vendor:
|
||||
$(GO) mod tidy && $(GO) mod vendor
|
||||
|
||||
.PHONY: install
|
||||
install:
|
||||
install -Dm755 ${BIN} $(DESTDIR)$(PREFIX)/bin/${BIN}
|
||||
|
|
38
testdata/ci/full.sh
vendored
38
testdata/ci/full.sh
vendored
|
@ -1,38 +0,0 @@
|
|||
#!/bin/bash
|
||||
#set -evx
|
||||
|
||||
# Objective of this script is to be the most vendor agnostic possible
|
||||
# It builds and tests yay independently of hardware
|
||||
|
||||
VERSION="$(git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g')"
|
||||
export VERSION
|
||||
export ARCH="x86_64"
|
||||
|
||||
docker build --build-arg BUILD_ARCH=${ARCH} --target builder_env -t yay-builder_env . || exit $?
|
||||
docker build --build-arg BUILD_ARCH=${ARCH} --target builder -t yay-builder . || exit $?
|
||||
|
||||
# Our unit test and packaging container
|
||||
docker run --rm --name yay-go-tests yay-builder_env:latest make test || exit $?
|
||||
|
||||
# Lint project
|
||||
docker run --rm --name yay-go-lint yay-builder_env:latest make lint || exit $?
|
||||
|
||||
# Build image for integration testing
|
||||
# docker build -t yay . || exit $?
|
||||
# Do integration testing
|
||||
# TODO
|
||||
|
||||
# Create a release asset
|
||||
docker run --name artifact_factory yay-builder make release ARCH=${ARCH} VERSION="${VERSION}"
|
||||
rc=$?
|
||||
if [[ $rc != 0 ]]; then
|
||||
docker rm artifact_factory
|
||||
exit $rc
|
||||
fi
|
||||
|
||||
# Copy bin and release to artifacts folder
|
||||
mkdir artifacts
|
||||
docker cp artifact_factory:/app/yay_"${VERSION}"_${ARCH}.tar.gz ./artifacts/
|
||||
|
||||
# Cleanup docker
|
||||
docker rm artifact_factory
|
0
testdata/install_test.sh
vendored
Executable file → Normal file
0
testdata/install_test.sh
vendored
Executable file → Normal file
1
vendor/github.com/Jguer/go-alpm/.gitignore
generated
vendored
1
vendor/github.com/Jguer/go-alpm/.gitignore
generated
vendored
|
@ -1 +0,0 @@
|
|||
_obj/
|
16
vendor/github.com/Jguer/go-alpm/.travis.yml
generated
vendored
16
vendor/github.com/Jguer/go-alpm/.travis.yml
generated
vendored
|
@ -1,16 +0,0 @@
|
|||
sudo: required
|
||||
notifications:
|
||||
email: false
|
||||
language: generic
|
||||
services:
|
||||
- docker
|
||||
|
||||
arch:
|
||||
packages:
|
||||
- git
|
||||
- go
|
||||
script:
|
||||
- "./testing/test.sh"
|
||||
|
||||
script:
|
||||
- "curl -s https://raw.githubusercontent.com/mikkeloscar/arch-travis/master/arch-travis.sh | bash"
|
14
vendor/github.com/Jguer/go-alpm/Dockerfile
generated
vendored
14
vendor/github.com/Jguer/go-alpm/Dockerfile
generated
vendored
|
@ -1,14 +0,0 @@
|
|||
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 . .
|
19
vendor/github.com/Jguer/go-alpm/LICENSE
generated
vendored
19
vendor/github.com/Jguer/go-alpm/LICENSE
generated
vendored
|
@ -1,19 +0,0 @@
|
|||
Copyright (C) 2013 The go-alpm Authors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
25
vendor/github.com/Jguer/go-alpm/Makefile
generated
vendored
25
vendor/github.com/Jguer/go-alpm/Makefile
generated
vendored
|
@ -1,25 +0,0 @@
|
|||
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)
|
34
vendor/github.com/Jguer/go-alpm/README.md
generated
vendored
34
vendor/github.com/Jguer/go-alpm/README.md
generated
vendored
|
@ -1,34 +0,0 @@
|
|||
## go-alpm
|
||||
|
||||
go-alpm is a Go package for binding libalpm. With go-alpm, it becomes possible
|
||||
to manipulate the Pacman databases and packages just as Pacman would.
|
||||
|
||||
This project is MIT Licensed. See LICENSE for details.
|
||||
|
||||
## Getting started
|
||||
|
||||
1. Import the go-alpm repository in your go script
|
||||
|
||||
import "github.com/jguer/go-alpm"
|
||||
|
||||
2. Copy the library to your GOPATH
|
||||
|
||||
mkdir ~/go
|
||||
export GOPATH=~/go
|
||||
go get github.com/jguer/go-alpm
|
||||
|
||||
3. Try the included examples
|
||||
|
||||
cd $GOPATH/src/github.com/jguer/go-alpm/examples
|
||||
go run installed.go
|
||||
|
||||
## Current Maintainers
|
||||
* Morganamilo
|
||||
* Jguer
|
||||
|
||||
## Original Contributors
|
||||
|
||||
* Mike Rosset
|
||||
* Dave Reisner
|
||||
* Rémy Oudompheng
|
||||
* Jesus Alvarez
|
55
vendor/github.com/Jguer/go-alpm/alpm.go
generated
vendored
55
vendor/github.com/Jguer/go-alpm/alpm.go
generated
vendored
|
@ -1,55 +0,0 @@
|
|||
// alpm.go - Implements exported libalpm functions.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
// #cgo LDFLAGS: -lalpm
|
||||
// #include <alpm.h>
|
||||
import "C"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// Init initializes alpm handle
|
||||
func Initialize(root, dbpath string) (*Handle, error) {
|
||||
cRoot := C.CString(root)
|
||||
cDBPath := C.CString(dbpath)
|
||||
var cErr C.alpm_errno_t
|
||||
h := C.alpm_initialize(cRoot, cDBPath, &cErr)
|
||||
|
||||
defer C.free(unsafe.Pointer(cRoot))
|
||||
defer C.free(unsafe.Pointer(cDBPath))
|
||||
|
||||
if cErr != 0 {
|
||||
return nil, Error(cErr)
|
||||
}
|
||||
|
||||
return &Handle{h}, nil
|
||||
}
|
||||
|
||||
// Release releases the alpm handle
|
||||
func (h *Handle) Release() error {
|
||||
if er := C.alpm_release(h.ptr); er != 0 {
|
||||
return Error(er)
|
||||
}
|
||||
h.ptr = nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// LastError gets the last pm_error
|
||||
func (h *Handle) LastError() error {
|
||||
if h.ptr != nil {
|
||||
cErr := C.alpm_errno(h.ptr)
|
||||
if cErr != 0 {
|
||||
return Error(cErr)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Version returns libalpm version string.
|
||||
func Version() string {
|
||||
return C.GoString(C.alpm_version())
|
||||
}
|
39
vendor/github.com/Jguer/go-alpm/callbacks.c
generated
vendored
39
vendor/github.com/Jguer/go-alpm/callbacks.c
generated
vendored
|
@ -1,39 +0,0 @@
|
|||
// callbacks.c - Sets alpm callbacks to Go functions.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <alpm.h>
|
||||
|
||||
void logCallback(alpm_loglevel_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);
|
||||
if (s == NULL) return;
|
||||
int16_t length = vsnprintf(s, 128, fmt, arg);
|
||||
if (length > 128) {
|
||||
length = (length + 16) & ~0xf;
|
||||
s = realloc(s, length);
|
||||
}
|
||||
if (s != NULL) {
|
||||
logCallback(level, s);
|
||||
free(s);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
56
vendor/github.com/Jguer/go-alpm/callbacks.go
generated
vendored
56
vendor/github.com/Jguer/go-alpm/callbacks.go
generated
vendored
|
@ -1,56 +0,0 @@
|
|||
// callbacks.go - Handles libalpm callbacks.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
/*
|
||||
#include <stdint.h>
|
||||
#include <alpm.h>
|
||||
void logCallback(alpm_loglevel_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(LogLevel, string)
|
||||
type questionCallbackSig func(QuestionAny)
|
||||
|
||||
var DefaultLogLevel = LogWarning
|
||||
|
||||
func DefaultLogCallback(lvl LogLevel, s string) {
|
||||
if lvl <= DefaultLogLevel {
|
||||
print("go-alpm: ", s)
|
||||
}
|
||||
}
|
||||
|
||||
var globalLogCallback logCallbackSig
|
||||
var globalQuestionCallback questionCallbackSig
|
||||
|
||||
//export logCallback
|
||||
func logCallback(level C.alpm_loglevel_t, cstring *C.char) {
|
||||
globalLogCallback(LogLevel(level), C.GoString(cstring))
|
||||
}
|
||||
|
||||
//export questionCallback
|
||||
func questionCallback(question *C.alpm_question_t) {
|
||||
q := (*C.alpm_question_any_t)(unsafe.Pointer(question))
|
||||
globalQuestionCallback(QuestionAny{q})
|
||||
}
|
||||
|
||||
func (h *Handle) SetLogCallback(cb logCallbackSig) {
|
||||
globalLogCallback = cb
|
||||
C.go_alpm_set_logging(h.ptr)
|
||||
}
|
||||
|
||||
func (h *Handle) SetQuestionCallback(cb questionCallbackSig) {
|
||||
globalQuestionCallback = cb
|
||||
C.go_alpm_set_question(h.ptr)
|
||||
}
|
168
vendor/github.com/Jguer/go-alpm/db.go
generated
vendored
168
vendor/github.com/Jguer/go-alpm/db.go
generated
vendored
|
@ -1,168 +0,0 @@
|
|||
// db.go - Functions for database handling.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
/*
|
||||
#include <alpm.h>
|
||||
#include <alpm_list.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// DB structure representing a alpm database.
|
||||
type DB struct {
|
||||
ptr *C.alpm_db_t
|
||||
handle Handle
|
||||
}
|
||||
|
||||
// DBList structure representing a alpm database list.
|
||||
type DBList struct {
|
||||
*list
|
||||
handle Handle
|
||||
}
|
||||
|
||||
// ForEach executes an action on each DB.
|
||||
func (l DBList) ForEach(f func(DB) error) error {
|
||||
return l.forEach(func(p unsafe.Pointer) error {
|
||||
return f(DB{(*C.alpm_db_t)(p), l.handle})
|
||||
})
|
||||
}
|
||||
|
||||
// Slice converst DB list to DB slice.
|
||||
func (l DBList) Slice() []DB {
|
||||
slice := []DB{}
|
||||
l.ForEach(func(db DB) error {
|
||||
slice = append(slice, db)
|
||||
return nil
|
||||
})
|
||||
return slice
|
||||
}
|
||||
|
||||
// SyncDBByName finds a registered database by name.
|
||||
func (h *Handle) SyncDBByName(name string) (db *DB, err error) {
|
||||
dblist, err := h.SyncDBs()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dblist.ForEach(func(b DB) error {
|
||||
if b.Name() == name {
|
||||
db = &b
|
||||
return io.EOF
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if db != nil {
|
||||
return db, nil
|
||||
}
|
||||
return nil, fmt.Errorf("database %s not found", name)
|
||||
}
|
||||
|
||||
// RegisterSyncDB Loads a sync database with given name and signature check level.
|
||||
func (h *Handle) RegisterSyncDB(dbname string, siglevel SigLevel) (*DB, error) {
|
||||
cName := C.CString(dbname)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
|
||||
db := C.alpm_register_syncdb(h.ptr, cName, C.int(siglevel))
|
||||
if db == nil {
|
||||
return nil, h.LastError()
|
||||
}
|
||||
return &DB{db, *h}, nil
|
||||
}
|
||||
|
||||
func (db *DB) Unregister() error {
|
||||
ok := C.alpm_db_unregister(db.ptr)
|
||||
if ok != 0 {
|
||||
return db.handle.LastError()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) UnregisterAllSyncDBs() error {
|
||||
ok := C.alpm_unregister_all_syncdbs(h.ptr)
|
||||
if ok != 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Name returns name of the db
|
||||
func (db *DB) Name() string {
|
||||
return C.GoString(C.alpm_db_get_name(db.ptr))
|
||||
}
|
||||
|
||||
// Servers returns host server URL.
|
||||
func (db *DB) Servers() []string {
|
||||
ptr := unsafe.Pointer(C.alpm_db_get_servers(db.ptr))
|
||||
return StringList{(*list)(ptr)}.Slice()
|
||||
}
|
||||
|
||||
// SetServers sets server list to use.
|
||||
func (db *DB) SetServers(servers []string) {
|
||||
C.alpm_db_set_servers(db.ptr, nil)
|
||||
for _, srv := range servers {
|
||||
Csrv := C.CString(srv)
|
||||
defer C.free(unsafe.Pointer(Csrv))
|
||||
C.alpm_db_add_server(db.ptr, Csrv)
|
||||
}
|
||||
}
|
||||
|
||||
// AddServers adds a string to the server list.
|
||||
func (db *DB) AddServer(server string) {
|
||||
Csrv := C.CString(server)
|
||||
defer C.free(unsafe.Pointer(Csrv))
|
||||
C.alpm_db_add_server(db.ptr, Csrv)
|
||||
}
|
||||
|
||||
// SetUsage sets the Usage of the database
|
||||
func (db *DB) SetUsage(usage Usage) {
|
||||
C.alpm_db_set_usage(db.ptr, C.int(usage))
|
||||
}
|
||||
|
||||
// Name searches a package in db.
|
||||
func (db *DB) Pkg(name string) *Package {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
ptr := C.alpm_db_get_pkg(db.ptr, cName)
|
||||
if ptr == nil {
|
||||
return nil
|
||||
}
|
||||
return &Package{ptr, db.handle}
|
||||
}
|
||||
|
||||
// PkgCachebyGroup returns a PackageList of packages belonging to a group
|
||||
func (l DBList) FindGroupPkgs(name string) PackageList {
|
||||
cName := C.CString(name)
|
||||
defer C.free(unsafe.Pointer(cName))
|
||||
pkglist := (*C.struct___alpm_list_t)(unsafe.Pointer(l.list))
|
||||
pkgcache := (*list)(unsafe.Pointer(C.alpm_find_group_pkgs(pkglist, cName)))
|
||||
return PackageList{pkgcache, l.handle}
|
||||
}
|
||||
|
||||
// PkgCache returns the list of packages of the database
|
||||
func (db *DB) PkgCache() PackageList {
|
||||
pkgcache := (*list)(unsafe.Pointer(C.alpm_db_get_pkgcache(db.ptr)))
|
||||
return PackageList{pkgcache, db.handle}
|
||||
}
|
||||
|
||||
func (db *DB) Search(targets []string) PackageList {
|
||||
var needles *C.alpm_list_t
|
||||
|
||||
for _, str := range targets {
|
||||
needles = C.alpm_list_add(needles, unsafe.Pointer(C.CString(str)))
|
||||
}
|
||||
|
||||
pkglist := (*list)(unsafe.Pointer(C.alpm_db_search(db.ptr, needles)))
|
||||
C.alpm_list_free(needles)
|
||||
return PackageList{pkglist, db.handle}
|
||||
}
|
44
vendor/github.com/Jguer/go-alpm/deps.go
generated
vendored
44
vendor/github.com/Jguer/go-alpm/deps.go
generated
vendored
|
@ -1,44 +0,0 @@
|
|||
package alpm
|
||||
|
||||
/*
|
||||
#include <alpm.h>
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// FindSatisfier searches a DBList for a package that satisfies depstring
|
||||
// Example "glibc>=2.12"
|
||||
func (l DBList) FindSatisfier(depstring string) (*Package, error) {
|
||||
cDepString := C.CString(depstring)
|
||||
defer C.free(unsafe.Pointer(cDepString))
|
||||
|
||||
pkgList := (*C.struct___alpm_list_t)(unsafe.Pointer(l.list))
|
||||
pkgHandle := (*C.struct___alpm_handle_t)(unsafe.Pointer(l.handle.ptr))
|
||||
|
||||
ptr := C.alpm_find_dbs_satisfier(pkgHandle, pkgList, cDepString)
|
||||
if ptr == nil {
|
||||
return nil,
|
||||
fmt.Errorf("unable to satisfy dependency %s in DBlist", depstring)
|
||||
}
|
||||
|
||||
return &Package{ptr, l.handle}, nil
|
||||
}
|
||||
|
||||
// FindSatisfier finds a package that satisfies depstring from PkgList
|
||||
func (l PackageList) FindSatisfier(depstring string) (*Package, error) {
|
||||
cDepString := C.CString(depstring)
|
||||
defer C.free(unsafe.Pointer(cDepString))
|
||||
|
||||
pkgList := (*C.struct___alpm_list_t)(unsafe.Pointer(l.list))
|
||||
|
||||
ptr := C.alpm_find_satisfier(pkgList, cDepString)
|
||||
if ptr == nil {
|
||||
return nil,
|
||||
fmt.Errorf("unable to find dependency %s in PackageList", depstring)
|
||||
}
|
||||
|
||||
return &Package{ptr, l.handle}, nil
|
||||
}
|
157
vendor/github.com/Jguer/go-alpm/enums.go
generated
vendored
157
vendor/github.com/Jguer/go-alpm/enums.go
generated
vendored
|
@ -1,157 +0,0 @@
|
|||
// enums.go - libaplm enumerations.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
// Install reason of a package.
|
||||
type PkgReason uint
|
||||
|
||||
const (
|
||||
PkgReasonExplicit PkgReason = 0
|
||||
PkgReasonDepend PkgReason = 1
|
||||
)
|
||||
|
||||
func (r PkgReason) String() string {
|
||||
switch r {
|
||||
case PkgReasonExplicit:
|
||||
return "Explicitly installed"
|
||||
case PkgReasonDepend:
|
||||
return "Installed as a dependency of another package"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Source of a package structure.
|
||||
type PkgFrom uint
|
||||
|
||||
const (
|
||||
FromFile PkgFrom = iota + 1
|
||||
FromLocalDB
|
||||
FromSyncDB
|
||||
)
|
||||
|
||||
// Dependency constraint types.
|
||||
type DepMod uint
|
||||
|
||||
const (
|
||||
DepModAny DepMod = iota + 1 // Any version.
|
||||
DepModEq // Specific version.
|
||||
DepModGE // Test for >= some version.
|
||||
DepModLE // Test for <= some version.
|
||||
DepModGT // Test for > some version.
|
||||
DepModLT // Test for < some version.
|
||||
)
|
||||
|
||||
func (mod DepMod) String() string {
|
||||
switch mod {
|
||||
case DepModEq:
|
||||
return "="
|
||||
case DepModGE:
|
||||
return ">="
|
||||
case DepModLE:
|
||||
return "<="
|
||||
case DepModGT:
|
||||
return ">"
|
||||
case DepModLT:
|
||||
return "<"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// Signature checking level.
|
||||
type SigLevel int
|
||||
|
||||
const (
|
||||
SigPackage SigLevel = 1 << iota
|
||||
SigPackageOptional
|
||||
SigPackageMarginalOk
|
||||
SigPackageUnknownOk
|
||||
)
|
||||
const (
|
||||
SigDatabase SigLevel = 1 << (10 + iota)
|
||||
SigDatabaseOptional
|
||||
SigDatabaseMarginalOk
|
||||
SigDatabaseUnknownOk
|
||||
)
|
||||
const SigUseDefault SigLevel = 1 << 30
|
||||
|
||||
// Signature status
|
||||
type SigStatus int
|
||||
|
||||
const (
|
||||
SigStatusValid SigStatus = iota
|
||||
SigStatusKeyExpired
|
||||
SigStatusSigExpired
|
||||
SigStatusKeyUnknown
|
||||
SigStatusKeyDisabled
|
||||
)
|
||||
|
||||
type LogLevel uint16
|
||||
|
||||
// Logging levels.
|
||||
const (
|
||||
LogError LogLevel = 1 << iota
|
||||
LogWarning
|
||||
LogDebug
|
||||
LogFunction
|
||||
)
|
||||
|
||||
type QuestionType uint
|
||||
|
||||
const (
|
||||
QuestionTypeInstallIgnorepkg QuestionType = 1 << iota
|
||||
QuestionTypeReplacePkg
|
||||
QuestionTypeConflictPkg
|
||||
QuestionTypeCorruptedPkg
|
||||
QuestionTypeRemovePkgs
|
||||
QuestionTypeSelectProvider
|
||||
QuestionTypeImportKey
|
||||
)
|
||||
|
||||
type Validation int
|
||||
|
||||
const (
|
||||
ValidationNone Validation = 1 << iota
|
||||
ValidationMD5Sum
|
||||
ValidationSHA256Sum
|
||||
ValidationSignature
|
||||
ValidationUnkown Validation = 0
|
||||
)
|
||||
|
||||
type Usage int
|
||||
|
||||
const (
|
||||
UsageSync Usage = 1 << iota
|
||||
UsageSearch
|
||||
UsageInstall
|
||||
UsageUpgrade
|
||||
UsageAll = (1 << 4) - 1
|
||||
)
|
||||
|
||||
type TransFlag int
|
||||
|
||||
const (
|
||||
TransFlagNoDeps TransFlag = 1 << iota
|
||||
TransFlagForce
|
||||
TransFlagNoSave
|
||||
TransFlagNoDepVersion
|
||||
TransFlagCascade
|
||||
TransFlagRecurse
|
||||
// 7 is missing
|
||||
_
|
||||
TransFlagDBOnly
|
||||
TransFlagAllDeps
|
||||
TransFlagDownloadOnly
|
||||
TransFlagNoScriptlets
|
||||
// 12 is missing
|
||||
_
|
||||
TransFlagNoConflicts
|
||||
TransFlagNeeded
|
||||
TransFlagAllExplicit
|
||||
TransFlagUnneeded
|
||||
TransFlagRecurseAll
|
||||
TransFlagNoLock
|
||||
)
|
21
vendor/github.com/Jguer/go-alpm/error.go
generated
vendored
21
vendor/github.com/Jguer/go-alpm/error.go
generated
vendored
|
@ -1,21 +0,0 @@
|
|||
// error.go - Functions for converting libalpm erros to Go errors.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
// #include <alpm.h>
|
||||
import "C"
|
||||
|
||||
// The Error type represents error codes from libalpm.
|
||||
type Error C.alpm_errno_t
|
||||
|
||||
var _ error = Error(0)
|
||||
|
||||
// The string representation of an error is given by C function
|
||||
// alpm_strerror().
|
||||
func (er Error) Error() string {
|
||||
return C.GoString(C.alpm_strerror(C.alpm_errno_t(er)))
|
||||
}
|
3
vendor/github.com/Jguer/go-alpm/go.mod
generated
vendored
3
vendor/github.com/Jguer/go-alpm/go.mod
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
module github.com/Jguer/go-alpm
|
||||
|
||||
go 1.12
|
549
vendor/github.com/Jguer/go-alpm/handle.go
generated
vendored
549
vendor/github.com/Jguer/go-alpm/handle.go
generated
vendored
|
@ -1,549 +0,0 @@
|
|||
// handle.go - libalpm handle type and methods.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
// Package alpm implements Go bindings to the libalpm library used by Pacman,
|
||||
// the Arch Linux package manager. Libalpm allows the creation of custom front
|
||||
// ends to the Arch Linux package ecosystem.
|
||||
//
|
||||
// Libalpm does not include support for the Arch User Repository (AUR).
|
||||
package alpm
|
||||
|
||||
// #include <alpm.h>
|
||||
// #include <stdio.h> //C.free
|
||||
// #include <fnmatch.h> //C.FNM_NOMATCH
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Handle contains the pointer to the alpm handle
|
||||
type Handle struct {
|
||||
ptr *C.alpm_handle_t
|
||||
}
|
||||
|
||||
//
|
||||
//alpm options getters and setters
|
||||
//
|
||||
|
||||
//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) {
|
||||
alpmList := f(h.ptr)
|
||||
goList := StringList{(*list)(unsafe.Pointer(alpmList))}
|
||||
|
||||
if alpmList == nil {
|
||||
return goList, h.LastError()
|
||||
}
|
||||
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
|
||||
|
||||
for _, dir := range hookDirs {
|
||||
cDir := C.CString(dir)
|
||||
list = C.alpm_list_add(list, unsafe.Pointer(cDir))
|
||||
defer C.free(unsafe.Pointer(cDir))
|
||||
}
|
||||
|
||||
ok := f(h.ptr, list)
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) optionAddList(hookDir string, f func(*C.alpm_handle_t, *C.char) C.int) error {
|
||||
cHookDir := C.CString(hookDir)
|
||||
defer C.free(unsafe.Pointer(cHookDir))
|
||||
ok := f(h.ptr, cHookDir)
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) optionRemoveList(dir string, f func(*C.alpm_handle_t, *C.char) C.int) (bool, error) {
|
||||
cDir := C.CString(dir)
|
||||
ok := f(h.ptr, cDir)
|
||||
defer C.free(unsafe.Pointer(cDir))
|
||||
if ok < 0 {
|
||||
return ok == 1, h.LastError()
|
||||
}
|
||||
return ok == 1, nil
|
||||
}
|
||||
|
||||
func (h *Handle) optionMatchList(dir string, f func(*C.alpm_handle_t, *C.char) C.int) (bool, error) {
|
||||
cDir := C.CString(dir)
|
||||
ok := f(h.ptr, cDir)
|
||||
defer C.free(unsafe.Pointer(cDir))
|
||||
if ok == 0 {
|
||||
return true, nil
|
||||
} else if ok == C.FNM_NOMATCH {
|
||||
return false, h.LastError()
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
||||
//helper functions for *char based getters and setters
|
||||
func (h *Handle) optionGetStr(f func(*C.alpm_handle_t) *C.char) (string, error) {
|
||||
cStr := f(h.ptr)
|
||||
str := C.GoString(cStr)
|
||||
if cStr == nil {
|
||||
return str, h.LastError()
|
||||
}
|
||||
|
||||
return str, nil
|
||||
}
|
||||
|
||||
func (h *Handle) optionSetStr(str string, f func(*C.alpm_handle_t, *C.char) C.int) error {
|
||||
cStr := C.CString(str)
|
||||
defer C.free(unsafe.Pointer(cStr))
|
||||
ok := f(h.ptr, cStr)
|
||||
|
||||
if ok < 0 {
|
||||
h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
//
|
||||
//end of helpers
|
||||
//
|
||||
|
||||
func (h *Handle) Root() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_root(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) DBPath() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_dbpath(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) Lockfile() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_lockfile(handle)
|
||||
})
|
||||
}
|
||||
|
||||
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)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddCacheDir(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_cachedir(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetCacheDirs(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_cachedirs(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveCacheDir(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_cachedir(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) HookDirs() (StringList, error) {
|
||||
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
|
||||
return C.alpm_option_get_hookdirs(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddHookDir(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_hookdir(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetHookDirs(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_hookdirs(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveHookDir(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_hookdir(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) LogFile() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_logfile(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetLogFile(str string) error {
|
||||
return h.optionSetStr(str, func(handle *C.alpm_handle_t, c_str *C.char) C.int {
|
||||
return C.alpm_option_set_logfile(handle, c_str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) GPGDir() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_gpgdir(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetGPGDir(str string) error {
|
||||
return h.optionSetStr(str, func(handle *C.alpm_handle_t, c_str *C.char) C.int {
|
||||
return C.alpm_option_set_gpgdir(handle, c_str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) UseSyslog() (bool, error) {
|
||||
ok := C.alpm_option_get_usesyslog(h.ptr)
|
||||
b := false
|
||||
|
||||
if ok > 0 {
|
||||
b = true
|
||||
}
|
||||
if ok < 0 {
|
||||
return b, h.LastError()
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (h *Handle) SetUseSyslog(value bool) error {
|
||||
var intValue C.int
|
||||
if value {
|
||||
intValue = 1
|
||||
}
|
||||
|
||||
ok := C.alpm_option_set_usesyslog(h.ptr, intValue)
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) NoUpgrades() (StringList, error) {
|
||||
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
|
||||
return C.alpm_option_get_noupgrades(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddNoUpgrade(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_noupgrade(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetNoUpgrades(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_noupgrades(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveNoUpgrade(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_noupgrade(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) MatchNoUpgrade(dir string) (bool, error) {
|
||||
return h.optionMatchList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_match_noupgrade(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) NoExtracts() (StringList, error) {
|
||||
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
|
||||
return C.alpm_option_get_noextracts(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddNoExtract(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_noextract(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetNoExtracts(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_noextracts(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveNoExtract(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_noextract(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) MatchNoExtract(dir string) (bool, error) {
|
||||
return h.optionMatchList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_match_noextract(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) IgnorePkgs() (StringList, error) {
|
||||
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
|
||||
return C.alpm_option_get_ignorepkgs(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddIgnorePkg(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_ignorepkg(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetIgnorePkgs(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_ignorepkgs(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveIgnorePkg(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_ignorepkg(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) IgnoreGroups() (StringList, error) {
|
||||
return h.optionGetList(func(handle *C.alpm_handle_t) *C.alpm_list_t {
|
||||
return C.alpm_option_get_ignoregroups(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) AddIgnoreGroup(hookDir string) error {
|
||||
return h.optionAddList(hookDir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_add_ignoregroup(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetIgnoreGroups(hookDirs []string) error {
|
||||
return h.optionSetList(hookDirs, func(handle *C.alpm_handle_t, l *C.alpm_list_t) C.int {
|
||||
return C.alpm_option_set_ignoregroups(handle, l)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) RemoveIgnoreGroup(dir string) (bool, error) {
|
||||
return h.optionRemoveList(dir, func(handle *C.alpm_handle_t, str *C.char) C.int {
|
||||
return C.alpm_option_remove_ignoregroup(handle, str)
|
||||
})
|
||||
}
|
||||
|
||||
/*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))}
|
||||
|
||||
if alpmList == nil {
|
||||
return goList, h.LastError()
|
||||
}
|
||||
return goList, nil
|
||||
}*/
|
||||
|
||||
//use alpm_depend_t
|
||||
func (h *Handle) AssumeInstalled() (DependList, error) {
|
||||
alpmList := C.alpm_option_get_assumeinstalled(h.ptr)
|
||||
depList := DependList{(*list)(unsafe.Pointer(alpmList))}
|
||||
|
||||
if alpmList == nil {
|
||||
return depList, h.LastError()
|
||||
}
|
||||
return depList, nil
|
||||
}
|
||||
|
||||
func (h *Handle) AddAssumeInstalled(dep Depend) error {
|
||||
cDep := convertCDepend(dep)
|
||||
defer freeCDepend(cDep)
|
||||
|
||||
ok := C.alpm_option_add_assumeinstalled(h.ptr, cDep)
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 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))
|
||||
// }
|
||||
|
||||
// ok := C.alpm_option_set_assumeinstalled(h.ptr, list)
|
||||
// if ok < 0 {
|
||||
// return h.LastError()
|
||||
// }
|
||||
// return nil
|
||||
|
||||
// }
|
||||
|
||||
// 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
|
||||
// }
|
||||
|
||||
func (h *Handle) Arch() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_arch(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetArch(str string) error {
|
||||
return h.optionSetStr(str, func(handle *C.alpm_handle_t, cStr *C.char) C.int {
|
||||
return C.alpm_option_set_arch(handle, cStr)
|
||||
})
|
||||
}
|
||||
|
||||
// LocalDB returns the local database relative to the given handle.
|
||||
func (h *Handle) LocalDB() (*DB, error) {
|
||||
db := C.alpm_get_localdb(h.ptr)
|
||||
if db == nil {
|
||||
return nil, h.LastError()
|
||||
}
|
||||
return &DB{db, *h}, nil
|
||||
}
|
||||
|
||||
// SyncDBs returns list of Synced DBs.
|
||||
func (h *Handle) SyncDBs() (DBList, error) {
|
||||
dblist := C.alpm_get_syncdbs(h.ptr)
|
||||
if dblist == nil {
|
||||
return DBList{nil, *h}, h.LastError()
|
||||
}
|
||||
dblistPtr := unsafe.Pointer(dblist)
|
||||
return DBList{(*list)(dblistPtr), *h}, nil
|
||||
}
|
||||
|
||||
func (h *Handle) CheckSpace() (bool, error) {
|
||||
ok := C.alpm_option_get_checkspace(h.ptr)
|
||||
b := false
|
||||
|
||||
if ok > 0 {
|
||||
b = true
|
||||
}
|
||||
if ok < 0 {
|
||||
return b, h.LastError()
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (h *Handle) SetCheckSpace(value bool) error {
|
||||
var cValue C.int
|
||||
if value {
|
||||
cValue = 1
|
||||
}
|
||||
|
||||
ok := C.alpm_option_set_checkspace(h.ptr, cValue)
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) DBExt() (string, error) {
|
||||
return h.optionGetStr(func(handle *C.alpm_handle_t) *C.char {
|
||||
return C.alpm_option_get_dbext(handle)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) SetDBExt(str string) error {
|
||||
return h.optionSetStr(str, func(handle *C.alpm_handle_t, cStr *C.char) C.int {
|
||||
return C.alpm_option_set_dbext(handle, cStr)
|
||||
})
|
||||
}
|
||||
|
||||
func (h *Handle) GetDefaultSigLevel() (SigLevel, error) {
|
||||
sigLevel := C.alpm_option_get_default_siglevel(h.ptr)
|
||||
|
||||
if sigLevel < 0 {
|
||||
return SigLevel(sigLevel), h.LastError()
|
||||
}
|
||||
return SigLevel(sigLevel), nil
|
||||
}
|
||||
|
||||
func (h *Handle) SetDefaultSigLevel(siglevel SigLevel) error {
|
||||
ok := C.alpm_option_set_default_siglevel(h.ptr, C.int(siglevel))
|
||||
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) GetLocalFileSigLevel() (SigLevel, error) {
|
||||
sigLevel := C.alpm_option_get_local_file_siglevel(h.ptr)
|
||||
|
||||
if sigLevel < 0 {
|
||||
return SigLevel(sigLevel), h.LastError()
|
||||
}
|
||||
return SigLevel(sigLevel), nil
|
||||
}
|
||||
|
||||
func (h *Handle) SetLocalFileSigLevel(siglevel SigLevel) error {
|
||||
ok := C.alpm_option_set_local_file_siglevel(h.ptr, C.int(siglevel))
|
||||
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) GetRemoteFileSigLevel() (SigLevel, error) {
|
||||
sigLevel := C.alpm_option_get_remote_file_siglevel(h.ptr)
|
||||
|
||||
if sigLevel < 0 {
|
||||
return SigLevel(sigLevel), h.LastError()
|
||||
}
|
||||
return SigLevel(sigLevel), nil
|
||||
}
|
||||
|
||||
func (h *Handle) SetRemoteFileSigLevel(siglevel SigLevel) error {
|
||||
ok := C.alpm_option_set_remote_file_siglevel(h.ptr, C.int(siglevel))
|
||||
|
||||
if ok < 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
return nil
|
||||
}
|
301
vendor/github.com/Jguer/go-alpm/package.go
generated
vendored
301
vendor/github.com/Jguer/go-alpm/package.go
generated
vendored
|
@ -1,301 +0,0 @@
|
|||
// package.go - libalpm package type and methods.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
/*
|
||||
#include <alpm.h>
|
||||
|
||||
int pkg_cmp(const void *v1, const void *v2)
|
||||
{
|
||||
alpm_pkg_t *p1 = (alpm_pkg_t *)v1;
|
||||
alpm_pkg_t *p2 = (alpm_pkg_t *)v2;
|
||||
off_t s1 = alpm_pkg_get_isize(p1);
|
||||
off_t s2 = alpm_pkg_get_isize(p2);
|
||||
|
||||
if (s1 > s2)
|
||||
return -1;
|
||||
else if (s1 < s2)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"time"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Package describes a single package and associated handle.
|
||||
type Package struct {
|
||||
pmpkg *C.alpm_pkg_t
|
||||
handle Handle
|
||||
}
|
||||
|
||||
// PackageList describes a linked list of packages and associated handle.
|
||||
type PackageList struct {
|
||||
*list
|
||||
handle Handle
|
||||
}
|
||||
|
||||
// ForEach executes an action on each package of the PackageList.
|
||||
func (l PackageList) ForEach(f func(Package) error) error {
|
||||
return l.forEach(func(p unsafe.Pointer) error {
|
||||
return f(Package{(*C.alpm_pkg_t)(p), l.handle})
|
||||
})
|
||||
}
|
||||
|
||||
// Slice converts the PackageList to a Package Slice.
|
||||
func (l PackageList) Slice() []Package {
|
||||
slice := []Package{}
|
||||
l.ForEach(func(p Package) error {
|
||||
slice = append(slice, p)
|
||||
return nil
|
||||
})
|
||||
return slice
|
||||
}
|
||||
|
||||
// SortBySize returns a PackageList sorted by size.
|
||||
func (l PackageList) SortBySize() PackageList {
|
||||
pkgList := (*C.struct___alpm_list_t)(unsafe.Pointer(l.list))
|
||||
|
||||
pkgCache := (*list)(unsafe.Pointer(
|
||||
C.alpm_list_msort(pkgList,
|
||||
C.alpm_list_count(pkgList),
|
||||
C.alpm_list_fn_cmp(C.pkg_cmp))))
|
||||
|
||||
return PackageList{pkgCache, l.handle}
|
||||
}
|
||||
|
||||
// DependList describes a linkedlist of dependency type packages.
|
||||
type DependList struct{ *list }
|
||||
|
||||
// ForEach executes an action on each package of the DependList.
|
||||
func (l DependList) ForEach(f func(Depend) error) error {
|
||||
return l.forEach(func(p unsafe.Pointer) error {
|
||||
dep := convertDepend((*C.alpm_depend_t)(p))
|
||||
return f(dep)
|
||||
})
|
||||
}
|
||||
|
||||
// Slice converts the DependList to a Depend Slice.
|
||||
func (l DependList) Slice() []Depend {
|
||||
slice := []Depend{}
|
||||
l.ForEach(func(dep Depend) error {
|
||||
slice = append(slice, dep)
|
||||
return nil
|
||||
})
|
||||
return slice
|
||||
}
|
||||
|
||||
func (pkg *Package) FileName() string {
|
||||
return C.GoString(C.alpm_pkg_get_filename(pkg.pmpkg))
|
||||
}
|
||||
|
||||
func (pkg *Package) Base() string {
|
||||
return C.GoString(C.alpm_pkg_get_base(pkg.pmpkg))
|
||||
}
|
||||
|
||||
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))
|
||||
}
|
||||
|
||||
// Architecture returns the package target Architecture.
|
||||
func (pkg *Package) Architecture() string {
|
||||
return C.GoString(C.alpm_pkg_get_arch(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Backup returns a list of package backups.
|
||||
func (pkg *Package) Backup() BackupList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_backup(pkg.pmpkg))
|
||||
return BackupList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// BuildDate returns the BuildDate of the package.
|
||||
func (pkg *Package) BuildDate() time.Time {
|
||||
t := C.alpm_pkg_get_builddate(pkg.pmpkg)
|
||||
return time.Unix(int64(t), 0)
|
||||
}
|
||||
|
||||
// Conflicts returns the conflicts of the package as a DependList.
|
||||
func (pkg *Package) Conflicts() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_conflicts(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// DB returns the package's origin database.
|
||||
func (pkg *Package) DB() *DB {
|
||||
ptr := C.alpm_pkg_get_db(pkg.pmpkg)
|
||||
if ptr == nil {
|
||||
return nil
|
||||
}
|
||||
return &DB{ptr, pkg.handle}
|
||||
}
|
||||
|
||||
// Depends returns the package's dependency list.
|
||||
func (pkg *Package) Depends() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_depends(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Depends returns the package's optional dependency list.
|
||||
func (pkg *Package) OptionalDepends() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_optdepends(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Depends returns the package's check dependency list.
|
||||
func (pkg *Package) CheckDepends() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_checkdepends(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Depends returns the package's make dependency list.
|
||||
func (pkg *Package) MakeDepends() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_makedepends(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Description returns the package's description.
|
||||
func (pkg *Package) Description() string {
|
||||
return C.GoString(C.alpm_pkg_get_desc(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Files returns the file list of the package.
|
||||
func (pkg *Package) Files() []File {
|
||||
cFiles := C.alpm_pkg_get_files(pkg.pmpkg)
|
||||
return convertFilelist(cFiles)
|
||||
}
|
||||
|
||||
// ContainsFile checks if the path is in the package filelist
|
||||
func (pkg *Package) ContainsFile(path string) (File, error) {
|
||||
return convertFile(C.alpm_filelist_contains(C.alpm_pkg_get_files(pkg.pmpkg), C.CString(path)))
|
||||
}
|
||||
|
||||
// Groups returns the groups the package belongs to.
|
||||
func (pkg *Package) Groups() StringList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_groups(pkg.pmpkg))
|
||||
return StringList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// ISize returns the package installed size.
|
||||
func (pkg *Package) ISize() int64 {
|
||||
t := C.alpm_pkg_get_isize(pkg.pmpkg)
|
||||
return int64(t)
|
||||
}
|
||||
|
||||
// InstallDate returns the package install date.
|
||||
func (pkg *Package) InstallDate() time.Time {
|
||||
t := C.alpm_pkg_get_installdate(pkg.pmpkg)
|
||||
return time.Unix(int64(t), 0)
|
||||
}
|
||||
|
||||
// Licenses returns the package license list.
|
||||
func (pkg *Package) Licenses() StringList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_licenses(pkg.pmpkg))
|
||||
return StringList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// SHA256Sum returns package SHA256Sum.
|
||||
func (pkg *Package) SHA256Sum() string {
|
||||
return C.GoString(C.alpm_pkg_get_sha256sum(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// MD5Sum returns package MD5Sum.
|
||||
func (pkg *Package) MD5Sum() string {
|
||||
return C.GoString(C.alpm_pkg_get_md5sum(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Name returns package name.
|
||||
func (pkg *Package) Name() string {
|
||||
return C.GoString(C.alpm_pkg_get_name(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Packager returns package packager name.
|
||||
func (pkg *Package) Packager() string {
|
||||
return C.GoString(C.alpm_pkg_get_packager(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Provides returns DependList of packages provides by package.
|
||||
func (pkg *Package) Provides() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_provides(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Reason returns package install reason.
|
||||
func (pkg *Package) Reason() PkgReason {
|
||||
reason := C.alpm_pkg_get_reason(pkg.pmpkg)
|
||||
return PkgReason(reason)
|
||||
}
|
||||
|
||||
// Origin returns package origin.
|
||||
func (pkg *Package) Origin() PkgFrom {
|
||||
origin := C.alpm_pkg_get_origin(pkg.pmpkg)
|
||||
return PkgFrom(origin)
|
||||
}
|
||||
|
||||
// Replaces returns a DependList with the packages this package replaces.
|
||||
func (pkg *Package) Replaces() DependList {
|
||||
ptr := unsafe.Pointer(C.alpm_pkg_get_replaces(pkg.pmpkg))
|
||||
return DependList{(*list)(ptr)}
|
||||
}
|
||||
|
||||
// Size returns the packed package size.
|
||||
func (pkg *Package) Size() int64 {
|
||||
t := C.alpm_pkg_get_size(pkg.pmpkg)
|
||||
return int64(t)
|
||||
}
|
||||
|
||||
// URL returns the upstream URL of the package.
|
||||
func (pkg *Package) URL() string {
|
||||
return C.GoString(C.alpm_pkg_get_url(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// Version returns the package version.
|
||||
func (pkg *Package) Version() string {
|
||||
return C.GoString(C.alpm_pkg_get_version(pkg.pmpkg))
|
||||
}
|
||||
|
||||
// ComputeRequiredBy returns the names of reverse dependencies of a package
|
||||
func (pkg *Package) ComputeRequiredBy() []string {
|
||||
result := C.alpm_pkg_compute_requiredby(pkg.pmpkg)
|
||||
requiredby := make([]string, 0)
|
||||
for i := (*list)(unsafe.Pointer(result)); i != nil; i = i.Next {
|
||||
defer C.free(unsafe.Pointer(i))
|
||||
if i.Data != nil {
|
||||
defer C.free(i.Data)
|
||||
name := C.GoString((*C.char)(i.Data))
|
||||
requiredby = append(requiredby, name)
|
||||
}
|
||||
}
|
||||
return requiredby
|
||||
}
|
||||
|
||||
// ComputeOptionalFor returns the names of packages that optionally require the given package
|
||||
func (pkg *Package) ComputeOptionalFor() []string {
|
||||
result := C.alpm_pkg_compute_optionalfor(pkg.pmpkg)
|
||||
optionalfor := make([]string, 0)
|
||||
for i := (*list)(unsafe.Pointer(result)); i != nil; i = i.Next {
|
||||
defer C.free(unsafe.Pointer(i))
|
||||
if i.Data != nil {
|
||||
defer C.free(i.Data)
|
||||
name := C.GoString((*C.char)(i.Data))
|
||||
optionalfor = append(optionalfor, name)
|
||||
}
|
||||
}
|
||||
return optionalfor
|
||||
}
|
||||
|
||||
func (pkg *Package) ShouldIgnore() bool {
|
||||
result := C.alpm_pkg_should_ignore(pkg.handle.ptr, pkg.pmpkg)
|
||||
return result == 1
|
||||
}
|
39
vendor/github.com/Jguer/go-alpm/sync.go
generated
vendored
39
vendor/github.com/Jguer/go-alpm/sync.go
generated
vendored
|
@ -1,39 +0,0 @@
|
|||
// db.go - Functions for database handling.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
/*
|
||||
#include <alpm.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
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_get_new_version(pkg.pmpkg,
|
||||
(*C.alpm_list_t)(unsafe.Pointer(l.list)))
|
||||
if ptr == nil {
|
||||
return nil
|
||||
}
|
||||
return &Package{ptr, l.handle}
|
||||
}
|
||||
|
||||
func (h *Handle) SyncSysupgrade(enableDowngrade bool) error {
|
||||
intEnableDowngrade := C.int(0)
|
||||
|
||||
if enableDowngrade {
|
||||
intEnableDowngrade = C.int(1)
|
||||
}
|
||||
|
||||
ret := C.alpm_sync_sysupgrade(h.ptr, intEnableDowngrade)
|
||||
if ret != 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
54
vendor/github.com/Jguer/go-alpm/trans.go
generated
vendored
54
vendor/github.com/Jguer/go-alpm/trans.go
generated
vendored
|
@ -1,54 +0,0 @@
|
|||
// db.go - Functions for database handling.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
/*
|
||||
#include <alpm.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
func (h *Handle) TransInit(flags TransFlag) error {
|
||||
ret := C.alpm_trans_init(h.ptr, C.int(flags))
|
||||
if ret != 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) TransRelease() error {
|
||||
ret := C.alpm_trans_release(h.ptr)
|
||||
if ret != 0 {
|
||||
return h.LastError()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *Handle) TransGetAdd() PackageList {
|
||||
pkgs := C.alpm_trans_get_add(h.ptr)
|
||||
return PackageList{(*list)(unsafe.Pointer(pkgs)), *h}
|
||||
}
|
||||
|
||||
func (h *Handle) TransGetRemove() PackageList {
|
||||
pkgs := C.alpm_trans_get_remove(h.ptr)
|
||||
return PackageList{(*list)(unsafe.Pointer(pkgs)), *h}
|
||||
}
|
||||
|
||||
func (h *Handle) TransGetFlags() (TransFlag, error) {
|
||||
flags := C.alpm_trans_get_flags(h.ptr)
|
||||
|
||||
if flags == -1 {
|
||||
return -1, h.LastError()
|
||||
}
|
||||
|
||||
return TransFlag(flags), nil
|
||||
}
|
314
vendor/github.com/Jguer/go-alpm/types.go
generated
vendored
314
vendor/github.com/Jguer/go-alpm/types.go
generated
vendored
|
@ -1,314 +0,0 @@
|
|||
// types.go - libalpm types.
|
||||
//
|
||||
// Copyright (c) 2013 The go-alpm Authors
|
||||
//
|
||||
// MIT Licensed. See LICENSE for details.
|
||||
|
||||
package alpm
|
||||
|
||||
// #cgo CFLAGS: -D_FILE_OFFSET_BITS=64
|
||||
// #include <alpm.h>
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// Depend provides a description of a dependency.
|
||||
type Depend struct {
|
||||
Name string
|
||||
Version string
|
||||
Description string
|
||||
NameHash uint
|
||||
Mod DepMod
|
||||
}
|
||||
|
||||
func convertDepend(dep *C.alpm_depend_t) Depend {
|
||||
return Depend{
|
||||
Name: C.GoString(dep.name),
|
||||
Version: C.GoString(dep.version),
|
||||
Mod: DepMod(dep.mod),
|
||||
Description: C.GoString(dep.desc),
|
||||
NameHash: uint(dep.name_hash),
|
||||
}
|
||||
}
|
||||
|
||||
func convertCDepend(dep Depend) *C.alpm_depend_t {
|
||||
cName := C.CString(dep.Name)
|
||||
cVersion := C.CString(dep.Version)
|
||||
cDesc := C.CString(dep.Description)
|
||||
|
||||
cDep := C.alpm_depend_t{
|
||||
name: cName,
|
||||
version: cVersion,
|
||||
desc: cDesc,
|
||||
name_hash: C.ulong(dep.NameHash),
|
||||
mod: C.alpm_depmod_t(dep.Mod),
|
||||
}
|
||||
|
||||
return &cDep
|
||||
}
|
||||
|
||||
func freeCDepend(dep *C.alpm_depend_t) {
|
||||
defer C.free(unsafe.Pointer(dep.name))
|
||||
defer C.free(unsafe.Pointer(dep.version))
|
||||
defer C.free(unsafe.Pointer(dep.desc))
|
||||
}
|
||||
|
||||
func (dep Depend) String() string {
|
||||
return dep.Name + dep.Mod.String() + dep.Version
|
||||
}
|
||||
|
||||
// File provides a description of package files.
|
||||
type File struct {
|
||||
Name string
|
||||
Size int64
|
||||
Mode uint32
|
||||
}
|
||||
|
||||
func convertFile(file *C.alpm_file_t) (File, error) {
|
||||
if file == nil {
|
||||
return File{}, errors.New("No file")
|
||||
}
|
||||
return File{
|
||||
Name: C.GoString(file.name),
|
||||
Size: int64(file.size),
|
||||
Mode: uint32(file.mode)}, nil
|
||||
}
|
||||
|
||||
func convertFilelist(files *C.alpm_filelist_t) []File {
|
||||
size := int(files.count)
|
||||
items := make([]File, size)
|
||||
|
||||
rawItems := reflect.SliceHeader{
|
||||
Len: size,
|
||||
Cap: size,
|
||||
Data: uintptr(unsafe.Pointer(files.files))}
|
||||
|
||||
cFiles := *(*[]C.alpm_file_t)(unsafe.Pointer(&rawItems))
|
||||
|
||||
for i := 0; i < size; i++ {
|
||||
if file, err := convertFile(&cFiles[i]); err == nil {
|
||||
items[i] = file
|
||||
}
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
// Internal alpm list structure.
|
||||
type list struct {
|
||||
Data unsafe.Pointer
|
||||
Prev *list
|
||||
Next *list
|
||||
}
|
||||
|
||||
// Iterates a function on a list and stop on error.
|
||||
func (l *list) forEach(f func(unsafe.Pointer) error) error {
|
||||
for ; l != nil; l = l.Next {
|
||||
err := f(l.Data)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *list) Len() int {
|
||||
count := 0
|
||||
for ; l != nil; l = l.Next {
|
||||
count++
|
||||
}
|
||||
return count
|
||||
}
|
||||
|
||||
func (l *list) Empty() bool {
|
||||
return l == nil
|
||||
}
|
||||
|
||||
type StringList struct {
|
||||
*list
|
||||
}
|
||||
|
||||
func (l StringList) ForEach(f func(string) error) error {
|
||||
return l.forEach(func(p unsafe.Pointer) error {
|
||||
return f(C.GoString((*C.char)(p)))
|
||||
})
|
||||
}
|
||||
|
||||
func (l StringList) Slice() []string {
|
||||
slice := []string{}
|
||||
l.ForEach(func(s string) error {
|
||||
slice = append(slice, s)
|
||||
return nil
|
||||
})
|
||||
return slice
|
||||
}
|
||||
|
||||
type BackupFile struct {
|
||||
Name string
|
||||
Hash string
|
||||
}
|
||||
|
||||
type BackupList struct {
|
||||
*list
|
||||
}
|
||||
|
||||
func (l BackupList) ForEach(f func(BackupFile) error) error {
|
||||
return l.forEach(func(p unsafe.Pointer) error {
|
||||
bf := (*C.alpm_backup_t)(p)
|
||||
return f(BackupFile{
|
||||
Name: C.GoString(bf.name),
|
||||
Hash: C.GoString(bf.hash),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func (l BackupList) Slice() (slice []BackupFile) {
|
||||
l.ForEach(func(f BackupFile) error {
|
||||
slice = append(slice, f)
|
||||
return nil
|
||||
})
|
||||
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 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 QuestionAny) QuestionReplace() (QuestionReplace, error) {
|
||||
if question.Type() == QuestionTypeReplacePkg {
|
||||
return *(*QuestionReplace)(unsafe.Pointer(&question)), nil
|
||||
}
|
||||
|
||||
return QuestionReplace{}, fmt.Errorf("Can not convert to QuestionReplace")
|
||||
}
|
||||
|
||||
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,
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
17
vendor/github.com/Jguer/go-alpm/version.go
generated
vendored
17
vendor/github.com/Jguer/go-alpm/version.go
generated
vendored
|
@ -1,17 +0,0 @@
|
|||
package alpm
|
||||
|
||||
// #include <alpm.h>
|
||||
import "C"
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// VerCmp performs version comparison according to Pacman conventions. Return
|
||||
// value is <0 if and only if v1 is older than v2.
|
||||
func VerCmp(v1, v2 string) int {
|
||||
c1 := C.CString(v1)
|
||||
c2 := C.CString(v2)
|
||||
defer C.free(unsafe.Pointer(c1))
|
||||
defer C.free(unsafe.Pointer(c2))
|
||||
result := C.alpm_pkg_vercmp(c1, c2)
|
||||
return int(result)
|
||||
}
|
674
vendor/github.com/Morganamilo/go-pacmanconf/LICENSE
generated
vendored
674
vendor/github.com/Morganamilo/go-pacmanconf/LICENSE
generated
vendored
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
20
vendor/github.com/Morganamilo/go-pacmanconf/cmd.go
generated
vendored
20
vendor/github.com/Morganamilo/go-pacmanconf/cmd.go
generated
vendored
|
@ -1,20 +0,0 @@
|
|||
package pacmanconf
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func pacmanconf(args []string) (string, string, error) {
|
||||
var outbuf, errbuf bytes.Buffer
|
||||
cmd := exec.Command("pacman-conf", args...)
|
||||
|
||||
cmd.Stdout = &outbuf
|
||||
cmd.Stderr = &errbuf
|
||||
|
||||
err := cmd.Run()
|
||||
stdout := outbuf.String()
|
||||
stderr := errbuf.String()
|
||||
|
||||
return stdout, stderr, err
|
||||
}
|
65
vendor/github.com/Morganamilo/go-pacmanconf/ini/ini.go
generated
vendored
65
vendor/github.com/Morganamilo/go-pacmanconf/ini/ini.go
generated
vendored
|
@ -1,65 +0,0 @@
|
|||
package ini
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
type Callback func(fileName string, line int, section string,
|
||||
key string, value string, data interface{}) error
|
||||
|
||||
func Parse(ini string, cb Callback, data interface{}) error {
|
||||
return parse("", ini, cb, data)
|
||||
}
|
||||
|
||||
func ParseFile(fileName string, cb Callback, data interface{}) error {
|
||||
file, err := ioutil.ReadFile(fileName)
|
||||
if err != nil {
|
||||
return cb(fileName, -1, err.Error(), "", "", data)
|
||||
}
|
||||
|
||||
return parse(fileName, string(file), cb, data)
|
||||
}
|
||||
|
||||
func parse(fileName string, ini string, cb Callback, data interface{}) error {
|
||||
lines := strings.Split(ini, "\n")
|
||||
header := ""
|
||||
|
||||
for n, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
if len(line) == 0 || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
if strings.HasPrefix(line, "[") && strings.HasSuffix(line, "]") {
|
||||
runes := []rune(line)
|
||||
header = string(runes[1 : len(runes)-1])
|
||||
|
||||
if err := cb(fileName, n, header, "", "", data); err != nil {
|
||||
return err
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
key, value := splitPair(line)
|
||||
if err := cb(fileName, n, header, key, value, data); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func splitPair(line string) (string, string) {
|
||||
split := strings.SplitN(line, "=", 2)
|
||||
|
||||
key := strings.TrimSpace(split[0])
|
||||
|
||||
if len(split) == 1 {
|
||||
return key, ""
|
||||
}
|
||||
|
||||
value := strings.TrimSpace(split[1])
|
||||
return key, value
|
||||
}
|
46
vendor/github.com/Morganamilo/go-pacmanconf/pacmanconf.go
generated
vendored
46
vendor/github.com/Morganamilo/go-pacmanconf/pacmanconf.go
generated
vendored
|
@ -1,46 +0,0 @@
|
|||
package pacmanconf
|
||||
|
||||
type Repository struct {
|
||||
Name string
|
||||
Servers []string
|
||||
SigLevel []string
|
||||
Usage []string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
RootDir string
|
||||
DBPath string
|
||||
CacheDir []string
|
||||
HookDir []string
|
||||
GPGDir string
|
||||
LogFile string
|
||||
HoldPkg []string
|
||||
IgnorePkg []string
|
||||
IgnoreGroup []string
|
||||
Architecture string
|
||||
XferCommand string
|
||||
NoUpgrade []string
|
||||
NoExtract []string
|
||||
CleanMethod []string
|
||||
SigLevel []string
|
||||
LocalFileSigLevel []string
|
||||
RemoteFileSigLevel []string
|
||||
UseSyslog bool
|
||||
Color bool
|
||||
UseDelta float64
|
||||
TotalDownload bool
|
||||
CheckSpace bool
|
||||
VerbosePkgLists bool
|
||||
DisableDownloadTimeout bool
|
||||
Repos []Repository
|
||||
}
|
||||
|
||||
func (conf *Config) Repository(name string) *Repository {
|
||||
for _, repo := range conf.Repos {
|
||||
if repo.Name == name {
|
||||
return &repo
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
137
vendor/github.com/Morganamilo/go-pacmanconf/parser.go
generated
vendored
137
vendor/github.com/Morganamilo/go-pacmanconf/parser.go
generated
vendored
|
@ -1,137 +0,0 @@
|
|||
package pacmanconf
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Morganamilo/go-pacmanconf/ini"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type callbackData struct {
|
||||
conf *Config
|
||||
repo *Repository
|
||||
}
|
||||
|
||||
func parseCallback(fileName string, line int, section string,
|
||||
key string, value string, data interface{}) error {
|
||||
if line < 0 {
|
||||
return fmt.Errorf("unable to read file: %s: %s", fileName, section)
|
||||
}
|
||||
|
||||
d, ok := data.(*callbackData)
|
||||
if !ok {
|
||||
return fmt.Errorf("type assert failed when parsing: %s", fileName)
|
||||
}
|
||||
|
||||
if key == "" && value == "" {
|
||||
if section == "options" {
|
||||
d.repo = nil
|
||||
} else {
|
||||
d.conf.Repos = append(d.conf.Repos, Repository{})
|
||||
d.repo = &d.conf.Repos[len(d.conf.Repos)-1]
|
||||
d.repo.Name = section
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
if section == "" {
|
||||
return fmt.Errorf("line %d is not in a section: %s", line, fileName)
|
||||
}
|
||||
|
||||
if d.repo == nil {
|
||||
setOption(d.conf, key, value)
|
||||
} else {
|
||||
setRepo(d.repo, key, value)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func setRepo(repo *Repository, key string, value string) {
|
||||
switch key {
|
||||
case "Server":
|
||||
repo.Servers = append(repo.Servers, value)
|
||||
case "SigLevel":
|
||||
repo.SigLevel = append(repo.SigLevel, value)
|
||||
case "Usage":
|
||||
repo.Usage = append(repo.Usage, value)
|
||||
}
|
||||
}
|
||||
|
||||
func setOption(conf *Config, key string, value string) {
|
||||
switch key {
|
||||
case "RootDir":
|
||||
conf.RootDir = value
|
||||
case "DBPath":
|
||||
conf.DBPath = value
|
||||
case "CacheDir":
|
||||
conf.CacheDir = append(conf.CacheDir, value)
|
||||
case "HookDir":
|
||||
conf.HookDir = append(conf.HookDir, value)
|
||||
case "GPGDir":
|
||||
conf.GPGDir = value
|
||||
case "LogFile":
|
||||
conf.LogFile = value
|
||||
case "HoldPkg":
|
||||
conf.HoldPkg = append(conf.HoldPkg, value)
|
||||
case "IgnorePkg":
|
||||
conf.IgnorePkg = append(conf.IgnorePkg, value)
|
||||
case "IgnoreGroup":
|
||||
conf.IgnoreGroup = append(conf.IgnoreGroup, value)
|
||||
case "Architecture":
|
||||
conf.Architecture = value
|
||||
case "XferCommand":
|
||||
conf.XferCommand = value
|
||||
case "NoUpgrade":
|
||||
conf.NoUpgrade = append(conf.NoUpgrade, value)
|
||||
case "NoExtract":
|
||||
conf.NoExtract = append(conf.NoExtract, value)
|
||||
case "CleanMethod":
|
||||
conf.CleanMethod = append(conf.CleanMethod, value)
|
||||
case "SigLevel":
|
||||
conf.SigLevel = append(conf.SigLevel, value)
|
||||
case "LocalFileSigLevel":
|
||||
conf.LocalFileSigLevel = append(conf.LocalFileSigLevel, value)
|
||||
case "RemoteFileSigLevel":
|
||||
conf.RemoteFileSigLevel = append(conf.RemoteFileSigLevel, value)
|
||||
case "UseSyslog":
|
||||
conf.UseSyslog = true
|
||||
case "Color":
|
||||
conf.Color = true
|
||||
case "UseDelta":
|
||||
f, err := strconv.ParseFloat(value, 64)
|
||||
if err == nil {
|
||||
conf.UseDelta = f
|
||||
}
|
||||
case "TotalDownload":
|
||||
conf.TotalDownload = true
|
||||
case "CheckSpace":
|
||||
conf.CheckSpace = true
|
||||
case "VerbosePkgLists":
|
||||
conf.VerbosePkgLists = true
|
||||
case "DisableDownloadTimeout":
|
||||
conf.DisableDownloadTimeout = true
|
||||
}
|
||||
}
|
||||
|
||||
func Parse(iniData string) (*Config, error) {
|
||||
data := callbackData{&Config{}, nil}
|
||||
err := ini.Parse(iniData, parseCallback, &data)
|
||||
return data.conf, err
|
||||
}
|
||||
|
||||
func PacmanConf(args ...string) (*Config, string, error) {
|
||||
stdout, stderr, err := pacmanconf(args)
|
||||
|
||||
if err != nil {
|
||||
return nil, stderr, err
|
||||
}
|
||||
|
||||
conf, err := Parse(stdout)
|
||||
|
||||
return conf, "", err
|
||||
}
|
||||
|
||||
func ParseFile(path string) (*Config, string, error) {
|
||||
return PacmanConf("--config", path)
|
||||
}
|
14
vendor/github.com/Morganamilo/go-srcinfo/.travis.yml
generated
vendored
14
vendor/github.com/Morganamilo/go-srcinfo/.travis.yml
generated
vendored
|
@ -1,14 +0,0 @@
|
|||
language: go
|
||||
|
||||
go:
|
||||
- 1.8.x
|
||||
- tip
|
||||
|
||||
before_install:
|
||||
- go get -t -v ./...
|
||||
|
||||
script:
|
||||
- go test -race -coverprofile=coverage.txt -covermode=atomic
|
||||
|
||||
after_success:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
674
vendor/github.com/Morganamilo/go-srcinfo/LICENSE
generated
vendored
674
vendor/github.com/Morganamilo/go-srcinfo/LICENSE
generated
vendored
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
136
vendor/github.com/Morganamilo/go-srcinfo/README.md
generated
vendored
136
vendor/github.com/Morganamilo/go-srcinfo/README.md
generated
vendored
|
@ -1,136 +0,0 @@
|
|||
[![GPL3 license](https://img.shields.io/badge/License-GPL3-blue.svg)](LICENSE)
|
||||
[![GoDoc](https://godoc.org/github.com/Morganamilo/go-srcinfo?status.svg)](https://godoc.org/github.com/Morganamilo/go-srcinfo)
|
||||
[![Build Status](https://travis-ci.org/Morganamilo/go-srcinfo.svg?branch=master)](https://travis-ci.org/Morganamilo/go-srcinfo)
|
||||
[![codecov](https://codecov.io/gh/Morganamilo/go-srcinfo/branch/master/graph/badge.svg)](https://codecov.io/gh/Morganamilo/go-srcinfo)
|
||||
[![Go Report Card](https://goreportcard.com/badge/github.com/Morganamilo/go-srcinfo)](https://goreportcard.com/report/github.com/Morganamilo/go-srcinfo)
|
||||
|
||||
# go-srcinfo
|
||||
|
||||
A golang package for parsing `.SRCINFO` files. [SRCINFO](https://wiki.archlinux.org/index.php/.SRCINFO)
|
||||
|
||||
go-srcinfo aimes to be simple while ensuring each srcinfo is syntactically
|
||||
correct. Split packages and architecture specific fields are fully supported.
|
||||
|
||||
# Examples
|
||||
|
||||
Reading a srcinfo from a file
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Morganamilo/go-srcinfo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
info, err := srcinfo.ParseFile("SRCINFO")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(info)
|
||||
}
|
||||
```
|
||||
|
||||
Reading each package from a split package
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Morganamilo/go-srcinfo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
info, err := srcinfo.ParseFile("SRCINFO")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, pkg := range info.SplitPackages() {
|
||||
fmt.Printf("%s-%s: %s\n", pkg.Pkgname, info.Version(), pkg.Pkgdesc)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Showing the architecture of each source
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Morganamilo/go-srcinfo"
|
||||
)
|
||||
|
||||
func main() {
|
||||
info, err := srcinfo.ParseFile("SRCINFO")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
for _, source := range info.Source {
|
||||
if source.Arch == "" {
|
||||
fmt.Printf("This source is for %s: %s\n", "any", source.Value)
|
||||
} else {
|
||||
fmt.Printf("This source is for %s: %s\n", source.Arch, source.Value)
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Reading a srcinfo from a string
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Morganamilo/go-srcinfo"
|
||||
)
|
||||
|
||||
const str = `
|
||||
pkgbase = gdc-bin
|
||||
pkgver = 6.3.0+2.068.2
|
||||
pkgrel = 1
|
||||
url = https://gdcproject.org/
|
||||
arch = i686
|
||||
arch = x86_64
|
||||
license = GPL
|
||||
source_i686 = http://gdcproject.org/downloads/binaries/6.3.0/i686-linux-gnu/gdc-6.3.0+2.068.2.tar.xz
|
||||
md5sums_i686 = cc8dcd66b189245e39296b1382d0dfcc
|
||||
source_x86_64 = http://gdcproject.org/downloads/binaries/6.3.0/x86_64-linux-gnu/gdc-6.3.0+2.068.2.tar.xz
|
||||
md5sums_x86_64 = 16d3067ebb3938dba46429a4d9f6178f
|
||||
|
||||
pkgname = gdc-bin
|
||||
pkgdesc = Compiler for D programming language which uses gcc backend
|
||||
depends = gdc-gcc
|
||||
depends = perl
|
||||
depends = binutils
|
||||
depends = libgphobos
|
||||
provides = d-compiler=2.068.2
|
||||
provides = gdc=6.3.0+2.068.2
|
||||
|
||||
pkgname = gdc-gcc
|
||||
pkgdesc = The GNU Compiler Collection - C and C++ frontends (from GDC, gdcproject.org)
|
||||
provides = gcc=6.3.0
|
||||
provides = gcc-libs=6.3.0
|
||||
|
||||
pkgname = libgphobos-lib32
|
||||
pkgdesc = Standard library for D programming language, GDC port
|
||||
provides = d-runtime-lib32
|
||||
provides = d-stdlib-lib32
|
||||
`
|
||||
func main() {
|
||||
info, err := srcinfo.Parse(str)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Println(info)
|
||||
}
|
||||
```
|
||||
|
||||
|
38
vendor/github.com/Morganamilo/go-srcinfo/line_error.go
generated
vendored
38
vendor/github.com/Morganamilo/go-srcinfo/line_error.go
generated
vendored
|
@ -1,38 +0,0 @@
|
|||
package srcinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// LineError is an error type that stores the line number at which an error
|
||||
// occurred as well the full Line that cased the error and an error string.
|
||||
type LineError struct {
|
||||
LineNumber int // The line number at which the error occurred
|
||||
Line string // The line that caused the error
|
||||
ErrorStr string // An error string
|
||||
}
|
||||
|
||||
// Error Returns an error string in the format:
|
||||
// "Line <LineNumber>: <ErrorStr>: <Line>".
|
||||
func (le LineError) Error() string {
|
||||
return fmt.Sprintf("Line %d: %s: %s", le.LineNumber, le.ErrorStr, le.Line)
|
||||
}
|
||||
|
||||
// Error Returns a new LineError
|
||||
func Error(LineNumber int, Line string, ErrorStr string) *LineError {
|
||||
return &LineError{
|
||||
LineNumber,
|
||||
Line,
|
||||
ErrorStr,
|
||||
}
|
||||
}
|
||||
|
||||
// Errorf Returns a new LineError using the same formatting rules as
|
||||
// fmt.Printf.
|
||||
func Errorf(LineNumber int, Line string, ErrorStr string, args ...interface{}) *LineError {
|
||||
return &LineError{
|
||||
LineNumber,
|
||||
Line,
|
||||
fmt.Sprintf(ErrorStr, args...),
|
||||
}
|
||||
}
|
310
vendor/github.com/Morganamilo/go-srcinfo/parser.go
generated
vendored
310
vendor/github.com/Morganamilo/go-srcinfo/parser.go
generated
vendored
|
@ -1,310 +0,0 @@
|
|||
package srcinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// parser is used to track our current state as we parse the srcinfo.
|
||||
type parser struct {
|
||||
// srcinfo is a Pointer to the Srcinfo we are currently building.
|
||||
srcinfo *Srcinfo
|
||||
|
||||
// seenPkgnames is a set of pkgnames we have seen
|
||||
seenPkgnames map[string]struct{}
|
||||
}
|
||||
|
||||
func (psr *parser) currentPackage() (*Package, error) {
|
||||
if psr.srcinfo.Pkgbase == "" {
|
||||
return nil, fmt.Errorf("Not in pkgbase or pkgname")
|
||||
} else if len(psr.srcinfo.Packages) == 0 {
|
||||
return &psr.srcinfo.Package, nil
|
||||
} else {
|
||||
return &psr.srcinfo.Packages[len(psr.srcinfo.Packages)-1], nil
|
||||
}
|
||||
}
|
||||
|
||||
func (psr *parser) setHeaderOrField(key, value string) error {
|
||||
pkgbase := &psr.srcinfo.PackageBase
|
||||
|
||||
switch key {
|
||||
case "pkgbase":
|
||||
if psr.srcinfo.Pkgbase != "" {
|
||||
return fmt.Errorf("key \"%s\" can not occur after pkgbase or pkgname", key)
|
||||
}
|
||||
|
||||
pkgbase.Pkgbase = value
|
||||
return nil
|
||||
case "pkgname":
|
||||
if psr.srcinfo.Pkgbase == "" {
|
||||
return fmt.Errorf("key \"%s\" can not occur before pkgbase", key)
|
||||
}
|
||||
if _, ok := psr.seenPkgnames[value]; ok {
|
||||
return fmt.Errorf("pkgname \"%s\" can not occur more than once", value)
|
||||
}
|
||||
psr.seenPkgnames[value] = struct{}{}
|
||||
|
||||
psr.srcinfo.Packages = append(psr.srcinfo.Packages, Package{Pkgname: value})
|
||||
return nil
|
||||
}
|
||||
|
||||
if psr.srcinfo.Pkgbase == "" {
|
||||
return fmt.Errorf("key \"%s\" can not occur before pkgbase or pkgname", key)
|
||||
}
|
||||
|
||||
return psr.setField(key, value)
|
||||
}
|
||||
|
||||
func (psr *parser) setField(archKey, value string) error {
|
||||
pkg, err := psr.currentPackage()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pkgbase := &psr.srcinfo.PackageBase
|
||||
key, arch := splitArchFromKey(archKey)
|
||||
err = checkArch(psr.srcinfo.Arch, archKey, arch)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if value == "" {
|
||||
value = EmptyOverride
|
||||
}
|
||||
|
||||
// pkgbase only + not arch dependent
|
||||
found := true
|
||||
switch archKey {
|
||||
case "pkgver":
|
||||
pkgbase.Pkgver = value
|
||||
case "pkgrel":
|
||||
pkgbase.Pkgrel = value
|
||||
case "epoch":
|
||||
pkgbase.Epoch = value
|
||||
case "validpgpkeys":
|
||||
pkgbase.ValidPGPKeys = append(pkgbase.ValidPGPKeys, value)
|
||||
case "noextract":
|
||||
pkgbase.NoExtract = append(pkgbase.NoExtract, value)
|
||||
default:
|
||||
found = false
|
||||
}
|
||||
|
||||
if found {
|
||||
if len(psr.srcinfo.Packages) > 0 {
|
||||
return fmt.Errorf("key \"%s\" can not occur after pkgname", archKey)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// pkgbase only + arch dependent
|
||||
found = true
|
||||
switch key {
|
||||
case "source":
|
||||
pkgbase.Source = append(pkgbase.Source, ArchString{arch, value})
|
||||
case "md5sums":
|
||||
pkgbase.MD5Sums = append(pkgbase.MD5Sums, ArchString{arch, value})
|
||||
case "sha1sums":
|
||||
pkgbase.SHA1Sums = append(pkgbase.SHA1Sums, ArchString{arch, value})
|
||||
case "sha224sums":
|
||||
pkgbase.SHA224Sums = append(pkgbase.SHA224Sums, ArchString{arch, value})
|
||||
case "sha256sums":
|
||||
pkgbase.SHA256Sums = append(pkgbase.SHA256Sums, ArchString{arch, value})
|
||||
case "sha384sums":
|
||||
pkgbase.SHA384Sums = append(pkgbase.SHA384Sums, ArchString{arch, value})
|
||||
case "sha512sums":
|
||||
pkgbase.SHA512Sums = append(pkgbase.SHA512Sums, ArchString{arch, value})
|
||||
case "b2sums":
|
||||
pkgbase.B2Sums = append(pkgbase.B2Sums, ArchString{arch, value})
|
||||
case "makedepends":
|
||||
pkgbase.MakeDepends = append(pkgbase.MakeDepends, ArchString{arch, value})
|
||||
case "checkdepends":
|
||||
pkgbase.CheckDepends = append(pkgbase.CheckDepends, ArchString{arch, value})
|
||||
default:
|
||||
found = false
|
||||
}
|
||||
|
||||
if found {
|
||||
if len(psr.srcinfo.Packages) > 0 {
|
||||
return fmt.Errorf("key \"%s\" can not occur after pkgname", archKey)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// pkgbase or pkgname + not arch dependent
|
||||
found = true
|
||||
switch archKey {
|
||||
case "pkgdesc":
|
||||
pkg.Pkgdesc = value
|
||||
case "url":
|
||||
pkg.URL = value
|
||||
case "license":
|
||||
pkg.License = append(pkg.License, value)
|
||||
case "install":
|
||||
pkg.Install = value
|
||||
case "changelog":
|
||||
pkg.Changelog = value
|
||||
case "groups":
|
||||
pkg.Groups = append(pkg.Groups, value)
|
||||
case "arch":
|
||||
pkg.Arch = append(pkg.Arch, value)
|
||||
case "backup":
|
||||
pkg.Backup = append(pkg.Backup, value)
|
||||
case "options":
|
||||
pkg.Options = append(pkg.Options, value)
|
||||
default:
|
||||
found = false
|
||||
}
|
||||
|
||||
if found {
|
||||
return nil
|
||||
}
|
||||
|
||||
// pkgbase or pkgname + arch dependent
|
||||
switch key {
|
||||
case "depends":
|
||||
pkg.Depends = append(pkg.Depends, ArchString{arch, value})
|
||||
case "optdepends":
|
||||
pkg.OptDepends = append(pkg.OptDepends, ArchString{arch, value})
|
||||
case "conflicts":
|
||||
pkg.Conflicts = append(pkg.Conflicts, ArchString{arch, value})
|
||||
case "provides":
|
||||
pkg.Provides = append(pkg.Provides, ArchString{arch, value})
|
||||
case "replaces":
|
||||
pkg.Replaces = append(pkg.Replaces, ArchString{arch, value})
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func parse(data string) (*Srcinfo, error) {
|
||||
psr := &parser{
|
||||
&Srcinfo{},
|
||||
make(map[string]struct{}),
|
||||
}
|
||||
|
||||
lines := strings.Split(data, "\n")
|
||||
|
||||
for n, line := range lines {
|
||||
line = strings.TrimSpace(line)
|
||||
|
||||
if line == "" || strings.HasPrefix(line, "#") {
|
||||
continue
|
||||
}
|
||||
|
||||
key, value, err := splitPair(line)
|
||||
if err != nil {
|
||||
return nil, Error(n+1, line, err.Error())
|
||||
}
|
||||
|
||||
err = psr.setHeaderOrField(key, value)
|
||||
if err != nil {
|
||||
return nil, Error(n+1, line, err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if psr.srcinfo.Pkgbase == "" {
|
||||
return nil, fmt.Errorf("No pkgbase field")
|
||||
}
|
||||
|
||||
if len(psr.srcinfo.Packages) == 0 {
|
||||
return nil, fmt.Errorf("No pkgname field")
|
||||
}
|
||||
|
||||
if psr.srcinfo.Pkgver == "" {
|
||||
return nil, fmt.Errorf("No pkgver field")
|
||||
}
|
||||
|
||||
if psr.srcinfo.Pkgrel == "" {
|
||||
return nil, fmt.Errorf("No pkgrel field")
|
||||
}
|
||||
|
||||
if len(psr.srcinfo.Arch) == 0 {
|
||||
return nil, fmt.Errorf("No arch field")
|
||||
}
|
||||
|
||||
return psr.srcinfo, nil
|
||||
}
|
||||
|
||||
// splitPair splits a key value string in the form of "key = value",
|
||||
// whitespace being ignored. The key and the value is returned.
|
||||
func splitPair(line string) (string, string, error) {
|
||||
split := strings.SplitN(line, "=", 2)
|
||||
|
||||
if len(split) != 2 {
|
||||
return "", "", fmt.Errorf("Line does not contain =")
|
||||
}
|
||||
|
||||
key := strings.TrimSpace(split[0])
|
||||
value := strings.TrimSpace(split[1])
|
||||
|
||||
if key == "" {
|
||||
return "", "", fmt.Errorf("Key is empty")
|
||||
}
|
||||
|
||||
return key, value, nil
|
||||
}
|
||||
|
||||
// splitArchFromKey splits up architecture dependent field names, separating
|
||||
// the field name from the architecture they depend on.
|
||||
func splitArchFromKey(key string) (string, string) {
|
||||
split := strings.SplitN(key, "_", 2)
|
||||
if len(split) == 2 {
|
||||
return split[0], split[1]
|
||||
}
|
||||
|
||||
return split[0], ""
|
||||
}
|
||||
|
||||
// checkArg checks that the arch from an arch dependent string is actually
|
||||
// defined inside of the srcinfo and speicifly disallows the arch "any" as it
|
||||
// is not a real arch
|
||||
func checkArch(arches []string, key string, arch string) error {
|
||||
if arch == "" {
|
||||
return nil
|
||||
}
|
||||
|
||||
if arch == "any" {
|
||||
return fmt.Errorf("Invalid key \"%s\" arch \"%s\" is not allowed", key, arch)
|
||||
}
|
||||
|
||||
for _, a := range arches {
|
||||
if a == arch {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return fmt.Errorf("Invalid key \"%s\" unsupported arch \"%s\"", key, arch)
|
||||
}
|
||||
|
||||
// ParseFile parses a srcinfo file as specified by path.
|
||||
func ParseFile(path string) (*Srcinfo, error) {
|
||||
file, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to read file: %s: %s", path, err.Error())
|
||||
}
|
||||
|
||||
return Parse(string(file))
|
||||
}
|
||||
|
||||
// Parse parses a srcinfo in string form. Parsing will fail if:
|
||||
// A srcinfo does not contain all required fields
|
||||
// The same pkgname is specified more then once
|
||||
// arch is missing
|
||||
// pkgver is mising
|
||||
// pkgrel is missing
|
||||
// An architecture specific field is defined for an architecture that does not exist
|
||||
// An unknown key is specified
|
||||
// An empty value is specified
|
||||
//
|
||||
// Required fields are:
|
||||
// pkgbase
|
||||
// pkname
|
||||
// arch
|
||||
// pkgrel
|
||||
// pkgver
|
||||
func Parse(data string) (*Srcinfo, error) {
|
||||
return parse(data)
|
||||
}
|
155
vendor/github.com/Morganamilo/go-srcinfo/printsrcinfo.go
generated
vendored
155
vendor/github.com/Morganamilo/go-srcinfo/printsrcinfo.go
generated
vendored
|
@ -1,155 +0,0 @@
|
|||
package srcinfo
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
)
|
||||
|
||||
func appendHeader(buffer *bytes.Buffer, key string, value string) {
|
||||
if value == "" {
|
||||
return
|
||||
}
|
||||
|
||||
buffer.WriteString(key + " = " + value + "\n")
|
||||
}
|
||||
|
||||
func appendValue(buffer *bytes.Buffer, key string, value string) {
|
||||
if value == "" {
|
||||
return
|
||||
}
|
||||
|
||||
if value == EmptyOverride {
|
||||
value = ""
|
||||
}
|
||||
|
||||
buffer.WriteString("\t" + key + " = " + value + "\n")
|
||||
}
|
||||
|
||||
func appendMultiValue(buffer *bytes.Buffer, key string, values []string) {
|
||||
for _, value := range values {
|
||||
if value == EmptyOverride {
|
||||
value = ""
|
||||
}
|
||||
|
||||
buffer.WriteString("\t" + key + " = " + value + "\n")
|
||||
}
|
||||
}
|
||||
|
||||
func appendMultiArchValue(buffer *bytes.Buffer, key string, values []ArchString) {
|
||||
for _, value := range values {
|
||||
if value.Value == EmptyOverride {
|
||||
value.Value = ""
|
||||
}
|
||||
|
||||
if value.Arch == "" {
|
||||
buffer.WriteString("\t" + key + " = " + value.Value + "\n")
|
||||
} else {
|
||||
buffer.WriteString("\t" + key + "_" + value.Arch + " = " + value.Value + "\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//String generates a string that should be similar to the srcinfo data used to
|
||||
//create this Srcinfo struct. Fields will be printed in order and with the same
|
||||
//whitespcae rules that `makepkg --printsrcinfo` uses.
|
||||
//
|
||||
// The order of each global field is as follows:
|
||||
// pkgdesc
|
||||
// pkgver
|
||||
// pkgrel
|
||||
// epoch
|
||||
// url
|
||||
// install
|
||||
// changelog
|
||||
// arch
|
||||
// groups
|
||||
// license
|
||||
// checkdepends
|
||||
// makedepends
|
||||
// depends
|
||||
// optdepends
|
||||
// provides
|
||||
// conflicts
|
||||
// replaces
|
||||
// noextract
|
||||
// options
|
||||
// backup
|
||||
// source
|
||||
// validpgpkeys
|
||||
// md5suns
|
||||
// sha1sums
|
||||
// sha224sums
|
||||
// sha256sums
|
||||
// sha384sums
|
||||
// sha512sums
|
||||
//
|
||||
// The order of each overwritten field is as follows:
|
||||
// pkgdesc
|
||||
// url
|
||||
// install
|
||||
// changelog
|
||||
// arch
|
||||
// groups
|
||||
// license
|
||||
// checkdepends
|
||||
// depends
|
||||
// optdepends
|
||||
// provides
|
||||
// conflicts
|
||||
// replaces
|
||||
// options
|
||||
// backup
|
||||
func (si *Srcinfo) String() string {
|
||||
var buffer bytes.Buffer
|
||||
|
||||
appendHeader(&buffer, "pkgbase", si.Pkgbase)
|
||||
|
||||
appendValue(&buffer, "pkgdesc", si.Pkgdesc)
|
||||
appendValue(&buffer, "pkgver", si.Pkgver)
|
||||
appendValue(&buffer, "pkgrel", si.Pkgrel)
|
||||
appendValue(&buffer, "epoch", si.Epoch)
|
||||
appendValue(&buffer, "url", si.URL)
|
||||
appendValue(&buffer, "install", si.Install)
|
||||
appendValue(&buffer, "changelog", si.Changelog)
|
||||
appendMultiValue(&buffer, "arch", si.Arch)
|
||||
appendMultiValue(&buffer, "groups", si.Groups)
|
||||
appendMultiValue(&buffer, "license", si.License)
|
||||
appendMultiArchValue(&buffer, "checkdepends", si.CheckDepends)
|
||||
appendMultiArchValue(&buffer, "makedepends", si.MakeDepends)
|
||||
appendMultiArchValue(&buffer, "depends", si.Depends)
|
||||
appendMultiArchValue(&buffer, "optdepends", si.OptDepends)
|
||||
appendMultiArchValue(&buffer, "provides", si.Provides)
|
||||
appendMultiArchValue(&buffer, "conflicts", si.Conflicts)
|
||||
appendMultiArchValue(&buffer, "replaces", si.Replaces)
|
||||
appendMultiValue(&buffer, "noextract", si.NoExtract)
|
||||
appendMultiValue(&buffer, "options", si.Options)
|
||||
appendMultiValue(&buffer, "backup", si.Backup)
|
||||
appendMultiValue(&buffer, "validpgpkeys", si.ValidPGPKeys)
|
||||
appendMultiArchValue(&buffer, "source", si.Source)
|
||||
appendMultiArchValue(&buffer, "md5sums", si.MD5Sums)
|
||||
appendMultiArchValue(&buffer, "sha1sums", si.SHA1Sums)
|
||||
appendMultiArchValue(&buffer, "sha224sums", si.SHA224Sums)
|
||||
appendMultiArchValue(&buffer, "sha256sums", si.SHA256Sums)
|
||||
appendMultiArchValue(&buffer, "sha384sums", si.SHA384Sums)
|
||||
appendMultiArchValue(&buffer, "sha512sums", si.SHA512Sums)
|
||||
|
||||
for n, pkg := range si.Packages {
|
||||
appendHeader(&buffer, "\npkgname", si.Packages[n].Pkgname)
|
||||
|
||||
appendValue(&buffer, "pkgdesc", pkg.Pkgdesc)
|
||||
appendValue(&buffer, "url", pkg.URL)
|
||||
appendValue(&buffer, "install", pkg.Install)
|
||||
appendValue(&buffer, "changelog", pkg.Changelog)
|
||||
appendMultiValue(&buffer, "arch", pkg.Arch)
|
||||
appendMultiValue(&buffer, "groups", pkg.Groups)
|
||||
appendMultiValue(&buffer, "license", pkg.License)
|
||||
appendMultiArchValue(&buffer, "depends", pkg.Depends)
|
||||
appendMultiArchValue(&buffer, "optdepends", pkg.OptDepends)
|
||||
appendMultiArchValue(&buffer, "provides", pkg.Provides)
|
||||
appendMultiArchValue(&buffer, "conflicts", pkg.Conflicts)
|
||||
appendMultiArchValue(&buffer, "replaces", pkg.Replaces)
|
||||
appendMultiValue(&buffer, "options", pkg.Options)
|
||||
appendMultiValue(&buffer, "backup", pkg.Backup)
|
||||
}
|
||||
|
||||
return buffer.String()
|
||||
}
|
216
vendor/github.com/Morganamilo/go-srcinfo/srcinfo.go
generated
vendored
216
vendor/github.com/Morganamilo/go-srcinfo/srcinfo.go
generated
vendored
|
@ -1,216 +0,0 @@
|
|||
// Package srcinfo is a parser for srcinfo files. Typically generated by
|
||||
// makepkg, part of the pacman package manager.
|
||||
//
|
||||
// Split packages and architecture dependent fields are fully supported.
|
||||
//
|
||||
// This Package aimes to parse srcinfos but not interpret them in any way.
|
||||
// All values are fundamentally strings, other tools should be used for
|
||||
// things such as dependency parsing, validity checking etc.
|
||||
package srcinfo
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ArchString describes string values that may be architecture dependent.
|
||||
// For Example depends_x86_64.
|
||||
// If Arch is an empty string then the field is not architecture dependent.
|
||||
type ArchString struct {
|
||||
Arch string // Architecture name
|
||||
Value string // Value
|
||||
}
|
||||
|
||||
// Package describes the fields of a pkgbuild that may be overwritten by
|
||||
// in build_<pkgname> function.
|
||||
type Package struct {
|
||||
Pkgname string
|
||||
Pkgdesc string
|
||||
Arch []string
|
||||
URL string
|
||||
License []string
|
||||
Groups []string
|
||||
Depends []ArchString
|
||||
OptDepends []ArchString
|
||||
Provides []ArchString
|
||||
Conflicts []ArchString
|
||||
Replaces []ArchString
|
||||
Backup []string
|
||||
Options []string
|
||||
Install string
|
||||
Changelog string
|
||||
}
|
||||
|
||||
// PackageBase describes the fields of a pkgbuild that may not be overwritten
|
||||
// in package_<pkgname> function.
|
||||
type PackageBase struct {
|
||||
Pkgbase string
|
||||
Pkgver string
|
||||
Pkgrel string
|
||||
Epoch string
|
||||
Source []ArchString
|
||||
ValidPGPKeys []string
|
||||
NoExtract []string
|
||||
MD5Sums []ArchString
|
||||
SHA1Sums []ArchString
|
||||
SHA224Sums []ArchString
|
||||
SHA256Sums []ArchString
|
||||
SHA384Sums []ArchString
|
||||
SHA512Sums []ArchString
|
||||
B2Sums []ArchString
|
||||
MakeDepends []ArchString
|
||||
CheckDepends []ArchString
|
||||
}
|
||||
|
||||
// Srcinfo represents a full srcinfo. All global fields are defined here while
|
||||
// fields overwritten in the package_<pkgname> function are defined in the
|
||||
// Packages field.
|
||||
//
|
||||
// Note: The Packages field only contains the values that each package
|
||||
// overrides, global fields will be missing. A Package containing both global
|
||||
// and overwritten fields can be generated using the SplitPackage function.
|
||||
type Srcinfo struct {
|
||||
PackageBase // Fields that only apply to the package base
|
||||
Package // Fields that apply to the package globally
|
||||
Packages []Package // Fields for each package this package base contains
|
||||
}
|
||||
|
||||
// EmptyOverride is used to signal when a value has been overridden with an
|
||||
// empty value. An empty ovrride is when a value is defined in the pkgbuild but
|
||||
// then overridden inside the package function to be empty.
|
||||
//
|
||||
// For example "pkgdesc=''" is an empty override on the pkgdesc which would
|
||||
// lead to the line "pkgdesc=" in the srcinfo.
|
||||
//
|
||||
// This value is used internally to store empty overrides, mainly to avoid
|
||||
// using string pointers. It is possible to check for empty overrides using
|
||||
// the Packages slice in Packagebase.
|
||||
//
|
||||
// During normal use with the SplitPackage function this value will be
|
||||
// converted back to an empty string, or removed entirely for slice values.
|
||||
// This means the this value can be completley ignored unless you are
|
||||
// explicitly looking for empty overrides.
|
||||
const EmptyOverride = "\x00"
|
||||
|
||||
// Version formats a version string from the epoch, pkgver and pkgrel of the
|
||||
// srcinfo. In the format [epoch:]pkgver-pkgrel.
|
||||
func (si *Srcinfo) Version() string {
|
||||
if si.Epoch == "" {
|
||||
return si.Pkgver + "-" + si.Pkgrel
|
||||
}
|
||||
|
||||
return si.Epoch + ":" + si.Pkgver + "-" + si.Pkgrel
|
||||
}
|
||||
|
||||
// SplitPackages generates a splice of all packages that are part of this
|
||||
// srcinfo. This is equivalent to calling SplitPackage on every pkgname.
|
||||
func (si *Srcinfo) SplitPackages() []*Package {
|
||||
pkgs := make([]*Package, 0, len(si.Packages))
|
||||
|
||||
for _, pkg := range si.Packages {
|
||||
pkgs = append(pkgs, mergeSplitPackage(&si.Package, &pkg))
|
||||
}
|
||||
|
||||
return pkgs
|
||||
}
|
||||
|
||||
// SplitPackage generates a Package that contains all fields that the specified
|
||||
// pkgname has. But will fall back on global fields if they are not defined in
|
||||
// the Package.
|
||||
//
|
||||
// Note slice values will be passed by reference, it is not recommended you
|
||||
// modify this struct after it is returned.
|
||||
func (si *Srcinfo) SplitPackage(pkgname string) (*Package, error) {
|
||||
for n := range si.Packages {
|
||||
if si.Packages[n].Pkgname == pkgname {
|
||||
return mergeSplitPackage(&si.Package, &si.Packages[n]), nil
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("Package \"%s\" is not part of the package base \"%s\"", pkgname, si.Pkgbase)
|
||||
}
|
||||
|
||||
func mergeArchSlice(global, override []ArchString) []ArchString {
|
||||
overridden := make(map[string]struct{})
|
||||
merged := make([]ArchString, 0, len(override))
|
||||
|
||||
for _, v := range override {
|
||||
overridden[v.Arch] = struct{}{}
|
||||
if v.Value == EmptyOverride {
|
||||
continue
|
||||
}
|
||||
merged = append(merged, v)
|
||||
}
|
||||
|
||||
for _, v := range global {
|
||||
if _, ok := overridden[v.Arch]; !ok {
|
||||
merged = append(merged, v)
|
||||
}
|
||||
}
|
||||
|
||||
return merged
|
||||
}
|
||||
|
||||
func mergeSplitPackage(base, split *Package) *Package {
|
||||
pkg := &Package{}
|
||||
*pkg = *base
|
||||
|
||||
pkg.Pkgname = split.Pkgname
|
||||
|
||||
if split.Pkgdesc != "" {
|
||||
pkg.Pkgdesc = split.Pkgdesc
|
||||
}
|
||||
|
||||
if len(split.Arch) != 0 {
|
||||
pkg.Arch = split.Arch
|
||||
}
|
||||
|
||||
if split.URL != "" {
|
||||
pkg.URL = split.URL
|
||||
}
|
||||
|
||||
if len(split.License) != 0 {
|
||||
pkg.License = split.License
|
||||
}
|
||||
|
||||
if len(split.Groups) != 0 {
|
||||
pkg.Groups = split.Groups
|
||||
}
|
||||
|
||||
if len(split.Depends) != 0 {
|
||||
pkg.Depends = mergeArchSlice(pkg.Depends, split.Depends)
|
||||
}
|
||||
|
||||
if len(split.OptDepends) != 0 {
|
||||
pkg.OptDepends = mergeArchSlice(pkg.OptDepends, split.OptDepends)
|
||||
}
|
||||
|
||||
if len(split.Provides) != 0 {
|
||||
pkg.Provides = mergeArchSlice(pkg.Provides, split.Provides)
|
||||
}
|
||||
|
||||
if len(split.Conflicts) != 0 {
|
||||
pkg.Conflicts = mergeArchSlice(pkg.Conflicts, split.Conflicts)
|
||||
}
|
||||
|
||||
if len(split.Replaces) != 0 {
|
||||
pkg.Replaces = mergeArchSlice(pkg.Replaces, split.Replaces)
|
||||
}
|
||||
|
||||
if len(split.Backup) != 0 {
|
||||
pkg.Backup = split.Backup
|
||||
}
|
||||
|
||||
if len(split.Options) != 0 {
|
||||
pkg.Options = split.Options
|
||||
}
|
||||
|
||||
if split.Changelog != "" {
|
||||
pkg.Changelog = split.Changelog
|
||||
}
|
||||
|
||||
if split.Install != "" {
|
||||
pkg.Install = split.Install
|
||||
}
|
||||
|
||||
return pkg
|
||||
}
|
674
vendor/github.com/mikkeloscar/aur/LICENSE
generated
vendored
674
vendor/github.com/mikkeloscar/aur/LICENSE
generated
vendored
|
@ -1,674 +0,0 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
<program> Copyright (C) <year> <name of author>
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<http://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
23
vendor/github.com/mikkeloscar/aur/README.md
generated
vendored
23
vendor/github.com/mikkeloscar/aur/README.md
generated
vendored
|
@ -1,23 +0,0 @@
|
|||
[![GoDoc](https://godoc.org/github.com/mikkeloscar/aur?status.svg)](https://godoc.org/github.com/mikkeloscar/aur)
|
||||
|
||||
# go wrapper for the AUR JSON API
|
||||
|
||||
Wrapper around the json API v5 for AUR found at
|
||||
http://aur.archlinux.org/rpc.php
|
||||
|
||||
## LICENSE
|
||||
|
||||
Copyright (C) 2016 Mikkel Oscar Lyderik Larsen
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
159
vendor/github.com/mikkeloscar/aur/aur.go
generated
vendored
159
vendor/github.com/mikkeloscar/aur/aur.go
generated
vendored
|
@ -1,159 +0,0 @@
|
|||
package aur
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
//AURURL is the base string from which the query is built
|
||||
var AURURL = "https://aur.archlinux.org/rpc.php?"
|
||||
|
||||
var (
|
||||
// ErrServiceUnavailable represents a error when AUR is unavailable
|
||||
ErrServiceUnavailable = errors.New("AUR is unavailable at this moment")
|
||||
)
|
||||
|
||||
type response struct {
|
||||
Error string `json:"error"`
|
||||
Version int `json:"version"`
|
||||
Type string `json:"type"`
|
||||
ResultCount int `json:"resultcount"`
|
||||
Results []Pkg `json:"results"`
|
||||
}
|
||||
|
||||
//By specifies what to seach by in RPC searches
|
||||
type By int
|
||||
|
||||
const (
|
||||
Name By = iota + 1
|
||||
NameDesc
|
||||
Maintainer
|
||||
Depends
|
||||
MakeDepends
|
||||
OptDepends
|
||||
CheckDepends
|
||||
)
|
||||
|
||||
func (by By) String() string {
|
||||
switch by {
|
||||
case Name:
|
||||
return "name"
|
||||
case NameDesc:
|
||||
return "name-desc"
|
||||
case Maintainer:
|
||||
return "maintainer"
|
||||
case Depends:
|
||||
return "depends"
|
||||
case MakeDepends:
|
||||
return "makedepends"
|
||||
case OptDepends:
|
||||
return "optdepends"
|
||||
case CheckDepends:
|
||||
return "checkdepends"
|
||||
default:
|
||||
panic("invalid By")
|
||||
}
|
||||
}
|
||||
|
||||
// Pkg holds package information
|
||||
type Pkg struct {
|
||||
ID int `json:"ID"`
|
||||
Name string `json:"Name"`
|
||||
PackageBaseID int `json:"PackageBaseID"`
|
||||
PackageBase string `json:"PackageBase"`
|
||||
Version string `json:"Version"`
|
||||
Description string `json:"Description"`
|
||||
URL string `json:"URL"`
|
||||
NumVotes int `json:"NumVotes"`
|
||||
Popularity float64 `json:"Popularity"`
|
||||
OutOfDate int `json:"OutOfDate"`
|
||||
Maintainer string `json:"Maintainer"`
|
||||
FirstSubmitted int `json:"FirstSubmitted"`
|
||||
LastModified int `json:"LastModified"`
|
||||
URLPath string `json:"URLPath"`
|
||||
Depends []string `json:"Depends"`
|
||||
MakeDepends []string `json:"MakeDepends"`
|
||||
CheckDepends []string `json:"CheckDepends"`
|
||||
Conflicts []string `json:"Conflicts"`
|
||||
Provides []string `json:"Provides"`
|
||||
Replaces []string `json:"Replaces"`
|
||||
OptDepends []string `json:"OptDepends"`
|
||||
Groups []string `json:"Groups"`
|
||||
License []string `json:"License"`
|
||||
Keywords []string `json:"Keywords"`
|
||||
}
|
||||
|
||||
func get(values url.Values) ([]Pkg, error) {
|
||||
values.Set("v", "5")
|
||||
resp, err := http.Get(AURURL + values.Encode())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
if err := getErrorByStatusCode(resp.StatusCode); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
dec := json.NewDecoder(resp.Body)
|
||||
result := new(response)
|
||||
err = dec.Decode(result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(result.Error) > 0 {
|
||||
return nil, errors.New(result.Error)
|
||||
}
|
||||
|
||||
return result.Results, nil
|
||||
}
|
||||
|
||||
func searchBy(query, by string) ([]Pkg, error) {
|
||||
v := url.Values{}
|
||||
v.Set("type", "search")
|
||||
v.Set("arg", query)
|
||||
|
||||
if by != "" {
|
||||
v.Set("by", by)
|
||||
}
|
||||
|
||||
return get(v)
|
||||
}
|
||||
|
||||
func getErrorByStatusCode(code int) error {
|
||||
switch code {
|
||||
case http.StatusBadGateway, http.StatusGatewayTimeout:
|
||||
return ErrServiceUnavailable
|
||||
case http.StatusServiceUnavailable:
|
||||
return ErrServiceUnavailable
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Search searches for packages using the RPC's default search by.
|
||||
// This is the same as using SearchBy With NameDesc
|
||||
func Search(query string) ([]Pkg, error) {
|
||||
return searchBy(query, "")
|
||||
}
|
||||
|
||||
// SearchBy searches for packages with a specified search by
|
||||
func SearchBy(query string, by By) ([]Pkg, error) {
|
||||
return searchBy(query, by.String())
|
||||
}
|
||||
|
||||
func Orphans() ([]Pkg, error) {
|
||||
return SearchBy("", Maintainer)
|
||||
}
|
||||
|
||||
// Info shows info for one or multiple packages.
|
||||
func Info(pkgs []string) ([]Pkg, error) {
|
||||
v := url.Values{}
|
||||
v.Set("type", "info")
|
||||
for _, arg := range pkgs {
|
||||
v.Add("arg[]", arg)
|
||||
}
|
||||
return get(v)
|
||||
}
|
3
vendor/github.com/mikkeloscar/aur/go.mod
generated
vendored
3
vendor/github.com/mikkeloscar/aur/go.mod
generated
vendored
|
@ -1,3 +0,0 @@
|
|||
module github.com/mikkeloscar/aur
|
||||
|
||||
go 1.12
|
9
vendor/modules.txt
vendored
9
vendor/modules.txt
vendored
|
@ -1,9 +0,0 @@
|
|||
# github.com/Jguer/go-alpm v0.0.0-20191122171459-5cffc6e8fc69
|
||||
github.com/Jguer/go-alpm
|
||||
# github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f
|
||||
github.com/Morganamilo/go-pacmanconf
|
||||
github.com/Morganamilo/go-pacmanconf/ini
|
||||
# github.com/Morganamilo/go-srcinfo v1.0.0
|
||||
github.com/Morganamilo/go-srcinfo
|
||||
# github.com/mikkeloscar/aur v0.0.0-20200113170522-1cb4e2949656
|
||||
github.com/mikkeloscar/aur
|
Loading…
Reference in a new issue