summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3f537efa3d72a3bbbb6e6fdad9c588ce46f0c787 (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
# Maintainer: Kazuya Yokogawa <mapk0y at gmail.com>

pkgname='cfn-guard-git'
pkgver=3.0.3.r20.g42e2d5b
pkgrel=1
pkgdesc='Guard offers a policy-as-code domain-specific language (DSL) to write rules and validate JSON- and YAML-formatted data such as CloudFormation Templates, K8s configurations, and Terraform JSON plans/configurations against those rules.'
url='https://github.com/aws-cloudformation/cloudformation-guard'
depends=('gcc-libs')
makedepends=('rust')
license=('Apache')
arch=('x86_64')
conflicts=("cfn-guard")
source=('git+https://github.com/aws-cloudformation/cloudformation-guard')
md5sums=('SKIP')

pkgver() {
  cd "$srcdir"/cloudformation-guard
  git describe --long --tags|sed 's/\([^-]*-g\)/r\1/;s/[-_]/./g;s/^release.//'
}

build() {
  cd "$srcdir"/cloudformation-guard
  cargo build --release
  target/release/cfn-guard completions --shell='zsh' > cfn-guard.zsh
  target/release/cfn-guard completions --shell='bash' > cfn-guard.bash
  target/release/cfn-guard completions --shell='fish' > cfn-guard.fish
}

package() {
  cd "$srcdir"/cloudformation-guard
  install -Dm755 target/release/cfn-guard "$pkgdir/usr/bin/cfn-guard"
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 README.md "$pkgdir/usr/share/doc/${pkgname%-*}/README.md"
  install -Dm644 cfn-guard.zsh "$pkgdir/usr/share/zsh/site-functions/_cfn-guard"
  install -Dm644 cfn-guard.bash "$pkgdir/usr/share/bash-completion/completions/cfn-guard"
  install -Dm644 cfn-guard.fish "$pkgdir/usr/share/fish/completions/cfn-guard.fish"
}

check() {
  "$srcdir"/cloudformation-guard/target/release/cfn-guard --version
}