Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

List of Extra Changes

Besides making the PKGBUILD work for golang I added some small extra changes that aren't strictly necessary but nice:

  • Changed old maintainers to Contributors as per AUR submission rules
  • added conflict/provide 'cheat' in case someone wants to make a PKGBUILD for stable releases
  • added example configuration to package for reference

How to apply patch

You might very well know this, but I often forget how to do myself so, in the spirit of this package, I figured I'd write it down just to refresh your memory:

This is a git patch; you can easilly add it as a commit wholesale to your HEAD with:
git am --signoff 0001-Update-pkgbuild-to-version-3.0.0.patch.

Or, if you want to make some edits first you can run
git apply 0001-Update-pkgbuild-to-version-3.0.0.patch to apply the changes but not commit them yet.

From 51a01c152597abaa8a84c8d9c7ac6c86d267e5b3 Mon Sep 17 00:00:00 2001
From: Joost Bremmer <contact@madeofmagicandwires.online>
Date: Mon, 21 Oct 2019 19:06:41 +0200
Subject: [PATCH] Update pkgbuild to version 3.0.0
Signed-off-by: Joost Bremmer <contact@madeofmagicandwires.online>
---
.SRCINFO | 18 ++++++---------
PKGBUILD | 67 +++++++++++++++++++++++++++++++++++++++++++-------------
2 files changed, 59 insertions(+), 26 deletions(-)
diff --git a/.SRCINFO b/.SRCINFO
index 8bfce7b..0f176e9 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,22 +1,18 @@
-# Generated by mksrcinfo v8
-# Wed Jan 30 10:02:34 UTC 2019
pkgbase = cheat-git
pkgdesc = Cheat allows you to create and view interactive cheatsheets on the command-line
- pkgver = 2.4.2
+ pkgver = 3.0.0
pkgrel = 1
url = https://github.com/chrisallenlane/cheat
- arch = any
+ arch = x86_64
license = GPL3
makedepends = git
- makedepends = python-setuptools
- depends = python2
- depends = python2-docopt
- optdepends = python2-pygments
- optdepends = bash-completion
- optdepends = zsh-completions
- optdepends = fish
+ makedepends = go-pie
+ optdepends = fzf: For Fuzzy Finder intergration
+ optdepends = bash: for Fuzzy Finder intergration
+ provides = cheat
conflicts = cheat-bash-git
conflicts = python-cheat
+ conflicts = cheat
source = cheat-git::git+https://github.com/chrisallenlane/cheat.git
md5sums = SKIP
diff --git a/PKGBUILD b/PKGBUILD
index faaaa8d..fa942f5 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,34 +1,71 @@
# Maintainer: Alexandr Skurikhin <askurihin@gmail.com>
-# Maintainer: Robert Orzanna <orschiro@gmail.com>
-# Maintainer: Quan Guo < guotsuan@gmail.com>
+# Contributor: Joost Bremmer <contact@madeofmagicandwires.online>
+# Contributor: Robert Orzanna <orschiro@gmail.com>
+# Contributor: Quan Guo < guotsuan@gmail.com>
pkgname=cheat-git
_gitname=cheat
-pkgver=2.4.2
+pkgver=3.0.0
pkgrel=1
pkgdesc="Cheat allows you to create and view interactive cheatsheets on the command-line"
-arch=('any')
+arch=('x86_64')
license=('GPL3')
url="https://github.com/chrisallenlane/cheat"
-depends=('python2' 'python2-docopt')
-optdepends=('python2-pygments' 'bash-completion' 'zsh-completions' 'fish')
-makedepends=('git' 'python-setuptools')
-conflicts=('cheat-bash-git' 'python-cheat')
+optdepends=('fzf: For Fuzzy Finder intergration'
+ 'bash: for Fuzzy Finder intergration')
+makedepends=('git' 'go-pie')
+conflicts=('cheat-bash-git' 'python-cheat' 'cheat')
+provides=('cheat')
source=("$pkgname::git+https://github.com/chrisallenlane/cheat.git")
md5sums=('SKIP')
-
pkgver() {
cd $pkgname
git describe | sed 's/^v//;s/-/./g'
}
+prepare() {
+ cd "$srcdir"
+
+ # create gopath
+ mkdir -p "${srcdir}/gopath/src/github.com/${_gitname}"
+ ln -rTsf "${pkgname}" "${srcdir}/gopath/src/github.com/${_gitname}/${_gitname}"
+ export GOPATH="${srcdir}/gopath"
+
+ # fetch dependencies
+ msg "Fetching Go dependencies"
+ go get -u -d -v github.com/alecthomas/chroma
+ go get -u -d -v github.com/davecgh/go-spew/spew
+ go get -u -d -v github.com/danwakefield/fnmatch
+ go get -u -d -v github.com/docopt/docopt-go
+ go get -u -d -v github.com/mgutz/ansi
+ go get -u -d -v github.com/mitchellh/go-homedir
+ go get -u -d -v github.com/tj/front
+ go get -u -d -v gopkg.in/yaml.v2
+}
+
+build() {
+ cd "${srcdir}/${pkgname}"
+ go clean "./cmd/cheat"
+ go generate "./cmd/cheat"
+ GOOS=linux \
+ GOARCH=amd64 go build \
+ -v \
+ -trimpath \
+ -gcflags "all=-trimpath=${srcdir}" \
+ -asmflags "all=-trimpath=${srcdir}" \
+ -ldflags "-extldflags ${LDFLAGS}" \
+ -o "./dist/cheat" ./cmd/cheat
+}
+
package(){
- cd "$pkgname"
- python2 setup.py install --root=$pkgdir --optimize=1
- install -dm755 ${pkgdir}/usr/share/{bash-completion/completions/,zsh/site-functions,fish/completions}
- install -m 644 ${srcdir}/$pkgname/cheat/autocompletion/cheat.bash $pkgdir/usr/share/bash-completion/completions/
- install -m 644 "$srcdir/$pkgname/$_gitname/autocompletion/cheat.zsh" "$pkgdir/usr/share/zsh/site-functions/$_gitname"
- install -m 644 "$srcdir/$pkgname/$_gitname/autocompletion/cheat.fish" "$pkgdir/usr/share/fish/completions/$_gitname"
+ install -Dm755 "${srcdir}/${pkgname}/dist/cheat" "${pkgdir}/usr/bin/cheat"
+ install -Dm755 "$srcdir/${pkgname}/scripts/fzf.bash" \
+ "${pkgdir}/usr/share/${pkgname}/fzf.bash"
+ # Install autocompletion once it becomes available
+ install -Dm644 "$srcdir/${pkgname}/configs/conf.yml" \
+ "${pkgdir}/usr/share/docs/${pkgname}/conf.yml"
+ # Install LICENSE file once it becomes available
}
+# vim: set ts=2 sts=2 sw=2 et :
--
2.23.0
From d1d62c1709c63e43fd7b1642a9abe83da024daad Mon Sep 17 00:00:00 2001
From: Joost Bremmer <contact@madeofmagicandwires.online>
Date: Sat, 2 Nov 2019 23:17:33 +0100
Subject: [PATCH 2/2] Update package to version 3.0.3
Signed-off-by: Joost Bremmer <contact@madeofmagicandwires.online>
---
.SRCINFO | 4 ++--
PKGBUILD | 30 ++++++++++++------------------
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/.SRCINFO b/.SRCINFO
index 0f176e9..bb5ddd8 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,10 +1,10 @@
pkgbase = cheat-git
pkgdesc = Cheat allows you to create and view interactive cheatsheets on the command-line
- pkgver = 3.0.0
+ pkgver = 3.0.3
pkgrel = 1
url = https://github.com/chrisallenlane/cheat
arch = x86_64
- license = GPL3
+ license = MIT
makedepends = git
makedepends = go-pie
optdepends = fzf: For Fuzzy Finder intergration
diff --git a/PKGBUILD b/PKGBUILD
index fa942f5..4ee852b 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,12 +4,11 @@
# Contributor: Quan Guo < guotsuan@gmail.com>
pkgname=cheat-git
-_gitname=cheat
-pkgver=3.0.0
+pkgver=3.0.3
pkgrel=1
pkgdesc="Cheat allows you to create and view interactive cheatsheets on the command-line"
arch=('x86_64')
-license=('GPL3')
+license=('MIT')
url="https://github.com/chrisallenlane/cheat"
optdepends=('fzf: For Fuzzy Finder intergration'
'bash: for Fuzzy Finder intergration')
@@ -20,42 +19,37 @@ source=("$pkgname::git+https://github.com/chrisallenlane/cheat.git")
md5sums=('SKIP')
pkgver() {
- cd $pkgname
- git describe | sed 's/^v//;s/-/./g'
+ cd "$srcdir/$pkgname"
+ git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
cd "$srcdir"
# create gopath
- mkdir -p "${srcdir}/gopath/src/github.com/${_gitname}"
- ln -rTsf "${pkgname}" "${srcdir}/gopath/src/github.com/${_gitname}/${_gitname}"
+ mkdir -p "${srcdir}/gopath"
export GOPATH="${srcdir}/gopath"
# fetch dependencies
msg "Fetching Go dependencies"
- go get -u -d -v github.com/alecthomas/chroma
- go get -u -d -v github.com/davecgh/go-spew/spew
- go get -u -d -v github.com/danwakefield/fnmatch
- go get -u -d -v github.com/docopt/docopt-go
- go get -u -d -v github.com/mgutz/ansi
- go get -u -d -v github.com/mitchellh/go-homedir
- go get -u -d -v github.com/tj/front
- go get -u -d -v gopkg.in/yaml.v2
+ cd "${srcdir}/${pkgname}"
+ go get -d ./...
}
build() {
cd "${srcdir}/${pkgname}"
- go clean "./cmd/cheat"
- go generate "./cmd/cheat"
GOOS=linux \
- GOARCH=amd64 go build \
+ GOARCH=amd64 \
+ go build \
-v \
-trimpath \
-gcflags "all=-trimpath=${srcdir}" \
-asmflags "all=-trimpath=${srcdir}" \
-ldflags "-extldflags ${LDFLAGS}" \
-o "./dist/cheat" ./cmd/cheat
+
+ # Clean mod cache for makepkg -C
+ go clean -modcache
}
package(){
--
2.23.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.