summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorFlorian Maunier2022-10-14 11:49:05 +0200
committerFlorian Maunier2022-10-14 11:49:05 +0200
commit75ea09ee8f08444ce7361dceceeddaa92ced1de1 (patch)
tree00da8ed76b84e4195012f04b171c2f7350932d29 /PKGBUILD
downloadaur-75ea09ee8f08444ce7361dceceeddaa92ced1de1.tar.gz
Initial commit with version 0.24.2
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD46
1 files changed, 46 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..f20f5e73dc85
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,46 @@
+# Maintainer: Florian Maunier <fmaunier@kuzzle.io>
+pkgname=kourou
+pkgver=0.24.2
+pkgrel=1
+pkgdesc="The CLI that helps you manage your Kuzzle application"
+arch=('any')
+url="https://github.com/kuzzleio/kourou"
+license=('Apache')
+depends=('nodejs')
+makedepends=('jq' 'npm')
+source=("https://registry.npmjs.org/$pkgname/-/$pkgname-$pkgver.tgz")
+noextract=("$pkgname-$pkgver.tgz")
+b2sums=('5a215d973c235c11dfe8bc531801dae916fae15fb8aabe0401d6bfda5555c4152e15dd0abe303b4e9bb002a5596272e2e64def4490752d10df3d0730d5cfa360')
+
+package() {
+ npm install -g --cache "$srcdir/npm-cache" --prefix "$pkgdir/usr" "$srcdir/$pkgname-$pkgver.tgz"
+
+ # Shell completions
+ cd "$pkgdir/usr/bin"
+ XDG_CACHE_HOME="$srcdir/cache" ./kourou autocomplete:create
+ install -Dm644 "$srcdir/cache/kourou/autocomplete/functions/zsh/_kourou" \
+ "$pkgdir/usr/share/zsh/site-functions/_kourou"
+ install -Dm644 "$srcdir/cache/kourou/autocomplete/functions/bash/kourou.bash" \
+ "$pkgdir/usr/share/bash-completion/completions/kourou"
+
+ # Remove references to $pkgdir
+ find "$pkgdir" -name package.json -print0 | xargs -r -0 sed -i '/_where/d'
+
+ # Remove references to $srcdir
+ local tmppackage="$(mktemp)"
+ local pkgjson="$pkgdir/usr/lib/node_modules/$pkgname/package.json"
+ jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+
+ find "$pkgdir" -type f -name package.json | while read pkgjson; do
+ local tmppackage="$(mktemp)"
+ jq 'del(.man)' "$pkgjson" > "$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+ done
+
+ # npm gives ownership of ALL FILES to build user
+ # https://bugs.archlinux.org/task/63396
+ chown -R root:root "$pkgdir"
+}