由于安装 AUR 中的 ghq 时出现错误,所以采取了措施解决
尝试安装AUR的ghq时遇到了问题。
安装ghq之后,在build()函数中会出现以下错误。
它说找不到motemen/ghq/utils,但是即使你自己下载了0.9.0版本的源码并调用了make build命令,也会出现相同的错误,所以可能是由于版本问题。
==> Starting build()...
github.com/mitchellh/go-homedir (download)
created GOPATH=/home/myuser/.cache/yay/ghq/src/build; see 'go help gopath'
github.com/motemen/ghq (download)
package github.com/motemen/ghq/utils: cannot find package "github.com/motemen/ghq/utils" in an
y of:
/usr/lib/go/src/github.com/motemen/ghq/utils (from $GOROOT)
/home/myuser/.cache/yay/ghq/src/build/src/github.com/motemen/ghq/utils (from $GOPATH
)
github.com/urfave/cli (download)
github.com/onsi/gomega (download)
Fetching https://golang.org/x/net/html/charset?go-get=1
Parsing meta tags from https://golang.org/x/net/html/charset?go-get=1 (status code 200)
get "golang.org/x/net/html/charset": found meta tag get.metaImport{Prefix:"golang.org/x/net",
VCS:"git", RepoRoot:"https://go.googlesource.com/net"} at https://golang.org/x/net/html/charse
t?go-get=1
get "golang.org/x/net/html/charset": verifying non-authoritative meta tag
Fetching https://golang.org/x/net?go-get=1
Parsing meta tags from https://golang.org/x/net?go-get=1 (status code 200)
golang.org/x/net (download)
Fetching https://golang.org/x/text/encoding?go-get=1
Parsing meta tags from https://golang.org/x/text/encoding?go-get=1 (status code 200)
get "golang.org/x/text/encoding": found meta tag get.metaImport{Prefix:"golang.org/x/text", VC
S:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/encoding?go
-get=1
get "golang.org/x/text/encoding": verifying non-authoritative meta tag
Fetching https://golang.org/x/text?go-get=1
Parsing meta tags from https://golang.org/x/text?go-get=1 (status code 200)
golang.org/x/text (download)
Fetching https://golang.org/x/text/transform?go-get=1
Parsing meta tags from https://golang.org/x/text/transform?go-get=1 (status code 200)
get "golang.org/x/text/transform": found meta tag get.metaImport{Prefix:"golang.org/x/text", V
CS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/transform?
go-get=1
get "golang.org/x/text/transform": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/encoding/charmap?go-get=1
Parsing meta tags from https://golang.org/x/text/encoding/charmap?go-get=1 (status code 200)
get "golang.org/x/text/encoding/charmap": found meta tag get.metaImport{Prefix:"golang.org/x/t
ext", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/enc
oding/charmap?go-get=1
get "golang.org/x/text/encoding/charmap": verifying non-authoritative meta tag
Fetching https://golang.org/x/text/encoding/htmlindex?go-get=1
Parsing meta tags from https://golang.org/x/text/encoding/htmlindex?go-get=1 (status code 200)
get "golang.org/x/text/encoding/htmlindex": found meta tag get.metaImport{Prefix:"golang.org/x
/text", VCS:"git", RepoRoot:"https://go.googlesource.com/text"} at https://golang.org/x/text/e
ncoding/htmlindex?go-get=1
get "golang.org/x/text/encoding/htmlindex": verifying non-authoritative meta tag
Fetching https://gopkg.in/yaml.v2?go-get=1
Parsing meta tags from https://gopkg.in/yaml.v2?go-get=1 (status code 200)
get "gopkg.in/yaml.v2": found meta tag get.metaImport{Prefix:"gopkg.in/yaml.v2", VCS:"git", Re
poRoot:"https://gopkg.in/yaml.v2"} at https://gopkg.in/yaml.v2?go-get=1
gopkg.in/yaml.v2 (download)
==> ERROR: A failure occurred in build().
Aborting...
Error making: ghq
所以我对 PKGBUILD 进行了以下修改。
虽然现在可能把版本更新得更新一些,但我暂时只是将次要版本提升了一个,并进行了实验。
# Maintainer: NOGISAKA Sadata <ngsksdt@gmail.com>
# Contributor: Kohei Suzuki <eagletmt@gmail.com>
pkgname=ghq
pkgver=0.10.2
pkgrel=1
pkgdesc="Remote repository management made easy"
arch=('i686' 'x86_64')
url="https://github.com/motemen/ghq"
license=('MIT')
makedepends=('go' 'git')
optdepends=('zsh: ghq function for zsh')
source=("ghq-${pkgver}.tar.gz::https://github.com/motemen/ghq/archive/v${pkgver}.tar.gz")
build() {
cd "$srcdir/$pkgname-$pkgver"
export GOPATH="$srcdir/build"
go get -t -d -v
go build .
}
check() {
cd "$srcdir/$pkgname-$pkgver"
export GOPATH="$srcdir/build"
go test -x -v .
}
package() {
cd "$srcdir/$pkgname-$pkgver"
install -Dm 755 ghq "$pkgdir/usr/bin/ghq"
install -Dm 644 zsh/_ghq "$pkgdir/usr/share/zsh/site-functions/_ghq"
install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/ghq/LICENSE"
}
# vim: set et sw=2 sts=2:
sha512sums=('05fb25852001f14c91eb2412d67441ce1a9e7b7e8022b2305862acd39dc692d3edfa5a7a049e8d6f4ecb9b61d134336309873d0ce7db00d73477d65dba3f0ac9')
diff 包含以下内容。
pkgname=ghq
-pkgver=0.9.0
+pkgver=0.10.2
pkgrel=1
pkgdesc="Remote repository management made easy"
arch=('i686' 'x86_64')
@@ -27,12 +27,11 @@
package() {
cd "$srcdir/$pkgname-$pkgver"
- install -Dm 755 ghq-$pkgver "$pkgdir/usr/bin/ghq"
+ install -Dm 755 ghq "$pkgdir/usr/bin/ghq"
install -Dm 644 zsh/_ghq "$pkgdir/usr/share/zsh/site-functions/_ghq"
install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/ghq/LICENSE"
}
# vim: set et sw=2 sts=2:
-sha512sums=('ba85652abe38f03d8eb96e6eba6393723a21710880df2a6dc3821f125a543a20e9f33b3c95f3a9d42ce7b9c263b6e96bfd5913edd088a19d31c8eaf034eaae63')
+sha512sums=('05fb25852001f14c91eb2412d67441ce1a9e7b7e8022b2305862acd39dc692d3edfa5a7a049e8d6f4ecb9b61d134336309873d0ce7db00d73477d65dba3f0ac9')
只要运行 makepkg -si,安装就成功了。