summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7e1e19e6e098b5dbf46eb2832601d08c908dc949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# Maintainer: Tom Whitwell <tom.whitwell@digital.cabinet-office.gov.uk>
pkgname=gds-cli-git
pkgver=2.5.0.r4.g0d39742
pkgrel=1
pkgdesc="CLI for GDS Staff"
arch=('i686' 'x86_64')
url="https://github.com/alphagov/gds-cli"
license=('unknown')
optdepends=("aws-cli: CLI for Amazon AWS"
	"aws-vault: Manager for AWS Credentials"
	"yubikey-manager: Manager for yubikey"
    "govuk-guix: CLI tool for managing GOV.UK services")
makedepends=('git' 'go-pie')
provides=("gds-cli=${pkgver}")
conflicts=('gds-cli')
source=("${pkgname}"::"git+https://github.com/alphagov/gds-cli")
sha512sums=('SKIP')

pkgver() {
	pushd "${srcdir}/${pkgname}" >/dev/null
	{
		git describe --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g' | sed 's/^v\(.*\)/\1/'
	}
	popd >/dev/null
}

build() {
	msg2 'building gds'
	pushd "${srcdir}/${pkgname}" >/dev/null
	{
		rm -rf gds
		make gds
	}
	popd >/dev/null
}

check() {
	msg2 'gds binary'
	pushd ${srcdir}/${pkgname} >/dev/null
	{
		./gds --version
	}
	popd >/dev/null
}

package() {
	msg2 'gds binary'
	pushd "${srcdir}/${pkgname}" >/dev/null
	{
		install -Dm755 "gds" "${pkgdir}/usr/bin/gds"
	}
	popd >/dev/null

	msg2 'completion files'
	pushd "${srcdir}/${pkgname}" >/dev/null
	{
		mkdir completion
		./gds zsh-completion >completion/_gds
		install -Dm644 "completion/_gds" "${pkgdir}/usr/share/zsh/site-functions/_gds"
		./gds bash-completion >completion/gds
		install -Dm644 "completion/gds" "${pkgdir}/usr/share/bash-completion/completions/gds"
	}
	popd >/dev/null
}