summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorVlad Petrov2021-05-18 16:25:36 +0300
committerVlad Petrov2021-05-18 16:25:36 +0300
commit850edacbb6fd81be8cb1384132366493456c15e0 (patch)
tree6d415aa5416868a5103903d2cae535d89b7ceda5
parent02c97d7e0906428606ca190b84a4311e48f9e016 (diff)
downloadaur-850edacbb6fd81be8cb1384132366493456c15e0.tar.gz
go-jira: build go-jira from source
-rw-r--r--.SRCINFO18
-rw-r--r--PKGBUILD55
-rw-r--r--_jira14
-rw-r--r--jira10
4 files changed, 82 insertions, 15 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 28b19450306d..7fe8f6dc710b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,12 +1,18 @@
pkgbase = go-jira
- pkgdesc = Simple command line client for Atlassian's Jira service written in Go
- pkgver = 1.0.26
+ pkgdesc = simple jira command line client in Go
+ pkgver = 1.0.27
pkgrel = 1
- url = https://github.com/Netflix-Skunkworks/go-jira
+ url = https://github.com/go-jira/jira
arch = x86_64
- license = APACHE
- source = jira-1.0.26::https://github.com/Netflix-Skunkworks/go-jira/releases/download/v1.0.26/jira-linux-amd64
- sha256sums = 27a1bb92e763ebdb4ba4204a1d7874d3d5e9094f6d6b15299c6e41f6a3546e83
+ license = Apache
+ makedepends = go
+ optdepends = bash-completion: support auto completion for bash
+ source = go-jira-1.0.27.tar.gz::https://github.com/go-jira/jira/archive/refs/tags/v1.0.27.tar.gz
+ source = jira
+ source = _jira
+ sha256sums = c5bcf7b61300b67a8f4e42ab60e462204130c352050e8551b1c23ab2ecafefc7
+ sha256sums = 737b5bcf05a0121bf5db7baec080446a3c85c9bcdeaf53867d2cba3b86049e48
+ sha256sums = 0ddd0422eb74510bd71b8d370ef8e6b698126fd66abebbb18a00ede45cc9facf
pkgname = go-jira
diff --git a/PKGBUILD b/PKGBUILD
index 418caeaaa4a4..6ee30a190d36 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,15 +1,52 @@
-# Maintainer: Stas Rudakou <stas at garage22 dot net>
-
pkgname=go-jira
-pkgver=1.0.26
+_pkgname=jira
+pkgver=1.0.27
pkgrel=1
-pkgdesc="Simple command line client for Atlassian's Jira service written in Go"
-url="https://github.com/Netflix-Skunkworks/go-jira"
+pkgdesc='simple jira command line client in Go'
arch=('x86_64')
-license=('APACHE')
-source=("jira-$pkgver::https://github.com/Netflix-Skunkworks/go-jira/releases/download/v$pkgver/jira-linux-amd64")
-sha256sums=('27a1bb92e763ebdb4ba4204a1d7874d3d5e9094f6d6b15299c6e41f6a3546e83')
+url="https://github.com/go-jira/jira"
+license=('Apache')
+makedepends=('go')
+optdepends=('bash-completion: support auto completion for bash')
+source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz"
+ "jira"
+ "_jira")
+sha256sums=('c5bcf7b61300b67a8f4e42ab60e462204130c352050e8551b1c23ab2ecafefc7'
+ '737b5bcf05a0121bf5db7baec080446a3c85c9bcdeaf53867d2cba3b86049e48'
+ '0ddd0422eb74510bd71b8d370ef8e6b698126fd66abebbb18a00ede45cc9facf')
+
+prepare(){
+ cd "${_pkgname}-${pkgver}"
+ mkdir -p build/
+}
+
+build() {
+ cd "${_pkgname}-${pkgver}"
+ export CGO_CPPFLAGS="${CPPFLAGS}"
+ export CGO_CFLAGS="${CFLAGS}"
+ export CGO_CXXFLAGS="${CXXFLAGS}"
+ export CGO_LDFLAGS="${LDFLAGS}"
+ export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
+ go build -o build ./cmd/...
+}
package() {
- install -Dm755 jira-$pkgver "$pkgdir/usr/bin/jira"
+ cd "$_pkgname-$pkgver"
+ install -Dm755 build/$_pkgname "$pkgdir"/usr/bin/$_pkgname
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+ install -dm 755 "${pkgdir}/etc/bash_completion.d/" \
+ "${pkgdir}/usr/share/zsh/site-functions/"
+
+ # Autocomplete generated by the binary are quite outdated due to old version of kingpin
+ # For some reason go-jira returns non-zero exit code for completions
+ # https://github.com/go-jira/jira/issues/326
+ #
+ # "${pkgdir}/usr/bin/${_pkgname}" --completion-script-bash > "${pkgdir}/etc/bash_completion.d/${_pkgname}" || true
+ # "${pkgdir}/usr/bin/${_pkgname}" --completion-script-zsh > "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}" || true
+
+ # Our modified autocomplete
+ cd ..
+ install -Dm644 ${_pkgname} "${pkgdir}/etc/bash_completion.d/${_pkgname}"
+ install -Dm644 _${_pkgname} "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
}
diff --git a/_jira b/_jira
new file mode 100644
index 000000000000..c5dc6a2eda51
--- /dev/null
+++ b/_jira
@@ -0,0 +1,14 @@
+#compdef jira
+
+_jira() {
+ local matches=($(${words[1]} --completion-bash "${(@)words[1,$CURRENT]}"))
+ compadd -a matches
+ if [[ $compstate[nmatches] -eq 0 && $words[$CURRENT] != -* ]]; then
+ _files
+ fi
+}
+
+# don't run the completion function when being source-ed or eval-ed
+if [ "$funcstack[1]" = "_jira" ]; then
+ _jira
+fi
diff --git a/jira b/jira
new file mode 100644
index 000000000000..d7708664451f
--- /dev/null
+++ b/jira
@@ -0,0 +1,10 @@
+_jira_bash_autocomplete() {
+ local cur prev opts base
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ opts=$( ${COMP_WORDS[0]} --completion-bash "${COMP_WORDS[@]:1:$COMP_CWORD}" )
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+}
+complete -F _jira_bash_autocomplete -o default jira
+