From 90d8b15c5990a226312353edcbe1f80f0af1e621 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sat, 15 Sep 2018 17:32:44 +0100 Subject: [PATCH 1/2] Convert to go modules --- .go/src | 1 - Gopkg.lock | 49 ------- Gopkg.toml | 20 --- Makefile | 6 +- go.mod | 8 ++ go.sum | 8 ++ .../Morganamilo/go-srcinfo/.travis.yml | 14 ++ .../Morganamilo/go-srcinfo/README.md | 136 ++++++++++++++++++ vendor/github.com/jguer/go-alpm/.gitignore | 1 + vendor/github.com/jguer/go-alpm/.travis.yml | 16 +++ vendor/github.com/jguer/go-alpm/README.md | 34 +++++ vendor/github.com/mikkeloscar/aur/README.md | 23 +++ vendor/modules.txt | 9 ++ 13 files changed, 251 insertions(+), 74 deletions(-) delete mode 120000 .go/src delete mode 100644 Gopkg.lock delete mode 100644 Gopkg.toml create mode 100644 go.mod create mode 100644 go.sum create mode 100644 vendor/github.com/Morganamilo/go-srcinfo/.travis.yml create mode 100644 vendor/github.com/Morganamilo/go-srcinfo/README.md create mode 100644 vendor/github.com/jguer/go-alpm/.gitignore create mode 100644 vendor/github.com/jguer/go-alpm/.travis.yml create mode 100644 vendor/github.com/jguer/go-alpm/README.md create mode 100644 vendor/github.com/mikkeloscar/aur/README.md create mode 100644 vendor/modules.txt diff --git a/.go/src b/.go/src deleted file mode 120000 index 9c39cc9f..00000000 --- a/.go/src +++ /dev/null @@ -1 +0,0 @@ -../vendor \ No newline at end of file diff --git a/Gopkg.lock b/Gopkg.lock deleted file mode 100644 index f59b46ad..00000000 --- a/Gopkg.lock +++ /dev/null @@ -1,49 +0,0 @@ -# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. - - -[[projects]] - branch = "master" - digest = "1:4e8f84eb856dd3ed05982f065caf7866a4995be9cc3718614dcecbd57e26c260" - name = "github.com/Morganamilo/go-pacmanconf" - packages = [ - ".", - "ini", - ] - pruneopts = "NUT" - revision = "9c5265e1b14f7e21dafabbad9ccf801d3815d707" - -[[projects]] - branch = "master" - digest = "1:5f709618dc8a0ff9221d3685c95d69ed7d80ca94e58f3483f5d9bdefb4e6bb25" - name = "github.com/Morganamilo/go-srcinfo" - packages = ["."] - pruneopts = "NUT" - revision = "368edc79b2c53cd9c065818fd4e65843ef3e9e11" - -[[projects]] - branch = "master" - digest = "1:6eef31522b3a2349e9399c903ffa76c084c7fb9ef9d17a4e3da420649b0f5d17" - name = "github.com/jguer/go-alpm" - packages = ["."] - pruneopts = "NUT" - revision = "643c287316a5456348cc689e1f2c980410e17d47" - -[[projects]] - branch = "master" - digest = "1:07c508c49b9c13cf582c2b986635d0acd11e113e0535fa4b147026e15bc64185" - name = "github.com/mikkeloscar/aur" - packages = ["."] - pruneopts = "NUT" - revision = "f998dbf94dc47ef839c76740efeb673d3459be1f" - -[solve-meta] - analyzer-name = "dep" - analyzer-version = 1 - input-imports = [ - "github.com/Morganamilo/go-pacmanconf", - "github.com/Morganamilo/go-srcinfo", - "github.com/jguer/go-alpm", - "github.com/mikkeloscar/aur", - ] - solver-name = "gps-cdcl" - solver-version = 1 diff --git a/Gopkg.toml b/Gopkg.toml deleted file mode 100644 index d7fdafcf..00000000 --- a/Gopkg.toml +++ /dev/null @@ -1,20 +0,0 @@ -[prune] - non-go = true - unused-packages = true - go-tests = true - -[[constraint]] - branch = "master" - name = "github.com/jguer/go-alpm" - -[[constraint]] - branch = "master" - name = "github.com/mikkeloscar/aur" - -[[constraint]] - branch = "master" - name = "github.com/Morganamilo/go-srcinfo" - -[[constraint]] - branch = "master" - name = "github.com/Morganamilo/go-pacmanconf" diff --git a/Makefile b/Makefile index 2c23b15d..bb37aa8b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ .PHONY: all default install uninstall test build release clean -PREFIX := /usr +PREFIX := /usr/local DESTDIR := ifndef VERSION @@ -15,8 +15,6 @@ PKGNAME := yay BINNAME := yay PACKAGE := ${PKGNAME}_${VERSION}_${ARCH} -export GOPATH=$(shell pwd)/.go - default: build all: | clean package @@ -42,7 +40,7 @@ test: go test -v build: - go build -v ${LDFLAGS} -o ${BINNAME} + go build -mod=vendor -v ${LDFLAGS} -o ${BINNAME} release: | test build mkdir ${PACKAGE} diff --git a/go.mod b/go.mod new file mode 100644 index 00000000..102da9fc --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/Jguer/yay + +require ( + github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f + github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5 + github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5 + github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4 +) diff --git a/go.sum b/go.sum new file mode 100644 index 00000000..ab0a4401 --- /dev/null +++ b/go.sum @@ -0,0 +1,8 @@ +github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f h1:ptFKynTV1p8JCzqk81NcMj0DV0Xle+PdKxfHjPbdIOU= +github.com/Morganamilo/go-pacmanconf v0.0.0-20180910220353-9c5265e1b14f/go.mod h1:Hk55m330jNiwxRodIlMCvw5iEyoRUCIY64W1p9D+tHc= +github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5 h1:0mWTtDLD9MmZO8Qk21aRFfsQpGU3uS7mSLbSzDTuguY= +github.com/Morganamilo/go-srcinfo v0.0.0-20180702014333-368edc79b2c5/go.mod h1:MP6VGY1NNpVUmYIEgoM9acix95KQqIRyqQ0hCLsyYUY= +github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5 h1:JPIXUHXLZYwYUTlGpCCRMNFt8IRAyLPUsnXYqOJ6U/w= +github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5/go.mod h1:1F60/e8oQFVJrZRH0TBqwtiB5ajJ5avOc4MoGRY9CFU= +github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4 h1:qgHSZbD0g3W7KAkZFzXlSqgriYnzEUFS1gkgEiv2GrE= +github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4/go.mod h1:n1NKHoldRNhIEufSx1PiDYcd2W+wpbz5/5K+p2eNDVk= diff --git a/vendor/github.com/Morganamilo/go-srcinfo/.travis.yml b/vendor/github.com/Morganamilo/go-srcinfo/.travis.yml new file mode 100644 index 00000000..0d34586a --- /dev/null +++ b/vendor/github.com/Morganamilo/go-srcinfo/.travis.yml @@ -0,0 +1,14 @@ +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) diff --git a/vendor/github.com/Morganamilo/go-srcinfo/README.md b/vendor/github.com/Morganamilo/go-srcinfo/README.md new file mode 100644 index 00000000..54a81dfa --- /dev/null +++ b/vendor/github.com/Morganamilo/go-srcinfo/README.md @@ -0,0 +1,136 @@ +[![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) +} +``` + + diff --git a/vendor/github.com/jguer/go-alpm/.gitignore b/vendor/github.com/jguer/go-alpm/.gitignore new file mode 100644 index 00000000..e4827159 --- /dev/null +++ b/vendor/github.com/jguer/go-alpm/.gitignore @@ -0,0 +1 @@ +_obj/ diff --git a/vendor/github.com/jguer/go-alpm/.travis.yml b/vendor/github.com/jguer/go-alpm/.travis.yml new file mode 100644 index 00000000..7fa5d5f6 --- /dev/null +++ b/vendor/github.com/jguer/go-alpm/.travis.yml @@ -0,0 +1,16 @@ +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" diff --git a/vendor/github.com/jguer/go-alpm/README.md b/vendor/github.com/jguer/go-alpm/README.md new file mode 100644 index 00000000..bc962160 --- /dev/null +++ b/vendor/github.com/jguer/go-alpm/README.md @@ -0,0 +1,34 @@ +## 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 diff --git a/vendor/github.com/mikkeloscar/aur/README.md b/vendor/github.com/mikkeloscar/aur/README.md new file mode 100644 index 00000000..084941c2 --- /dev/null +++ b/vendor/github.com/mikkeloscar/aur/README.md @@ -0,0 +1,23 @@ +[![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 . diff --git a/vendor/modules.txt b/vendor/modules.txt new file mode 100644 index 00000000..82cb7d5f --- /dev/null +++ b/vendor/modules.txt @@ -0,0 +1,9 @@ +# 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 v0.0.0-20180702014333-368edc79b2c5 +github.com/Morganamilo/go-srcinfo +# github.com/jguer/go-alpm v0.0.0-20180914002751-643c287316a5 +github.com/jguer/go-alpm +# github.com/mikkeloscar/aur v0.0.0-20180725140122-f998dbf94dc4 +github.com/mikkeloscar/aur From f556389fa8294a43e599aa7ce63de759a90f2cf1 Mon Sep 17 00:00:00 2001 From: morganamilo Date: Sat, 15 Sep 2018 18:51:45 +0100 Subject: [PATCH 2/2] Update Readme for building with modules enabled --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 333d0258..0791b402 100644 --- a/README.md +++ b/README.md @@ -87,10 +87,9 @@ Following are the dependencies managed under dep: Run `make` to build Yay. This command will generate a binary called `yay` in the same directory as the Makefile. -Note: Yay's Makefile automatically sets the `GOPATH` to `$PWD/.go`. This path will -ensure dependencies in `vendor/` are built. Running manual go commands such as -`go build` will require that you either set the `GOPATH` manually or `go get` -the vendored dependencies into your own `GOPATH`. +Note: Yay's Makefile sources its dependencies from `vendor/`. When +building manually, dependencies will instead be sourced from `GOPATH`. To +build against `vendor/` you must specify `-mod=vendor` in the build command. ### Code Style