summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorSam Whited2019-06-19 17:25:25 -0500
committerSam Whited2019-06-19 17:25:25 -0500
commited271bcb88ffac3ecf14dd02b8dc08a229234b90 (patch)
treec03a5cb69db498a80f7899bb7ac7ebdba31cd4f1 /PKGBUILD
parentc887cdd4a0bcab9605842a4f9a7d9c997d6a7be6 (diff)
downloadaur-ed271bcb88ffac3ecf14dd02b8dc08a229234b90.tar.gz
Follow packaging guidelines more closely
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD48
1 files changed, 30 insertions, 18 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 79dcfbc42bd4..01c0ab051a9e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,35 +1,47 @@
-# Maintainer: j605
+# Maintainer: Sam Whited <sam@samwhited.com>
+# Contributor: j605
_npmname=triton
pkgname=nodejs-$_npmname
pkgver=7.1.1
-pkgrel=1
+pkgrel=2
pkgdesc="triton is a CLI tool for working with the CloudAPI for Joyent's Triton Public Cloud and Private Cloud"
arch=('any')
url="https://github.com/joyent/node-triton"
license=('MPL')
depends=('nodejs')
-makedepends=('npm')
+makedepends=('npm' 'jq')
source=($pkgname-$pkgver.tar.gz::"https://github.com/joyent/node-triton/archive/$pkgver.tar.gz")
-md5sums=('ac0c21c3f578147d8b51fb85c4b8abc6')
-
-build() {
- cd node-$_npmname-$pkgver
- npm install --no-optional
-}
+noextract=("$pkgname-$pkgver.tar.gz")
+sha256sums=('f2aebe338af95c626b237ce9c472aedd57c1f5e26397a6483d40334b44be48b0')
package() {
- cd node-$_npmname-$pkgver
-
- mkdir -p "${pkgdir}"/usr/{bin,lib/node_modules/triton/}
- cp -r * "${pkgdir}"/usr/lib/node_modules/triton/
- rm -rf "${pkgdir}"/usr/lib/node_modules/triton/node_modules
+ npm install --cache "${srcdir}"/npm-cache --no-optional -g --user root --prefix "$pkgdir/usr" "$srcdir/$pkgname-$pkgver.tar.gz"
- mkdir -p "${pkgdir}"/etc/bash_completion.d
- ./bin/triton completion > "${pkgdir}"/etc/bash_completion.d/triton
+ install -dm755 "${pkgdir}"/etc/bash_completion.d
+ "${pkgdir}"/usr/bin/triton completion > "${pkgdir}"/etc/bash_completion.d/triton
- # security issue (see wiki)
+ # Non-deterministic race in npm gives 777 permissions to random directories.
+ # See https://github.com/npm/npm/issues/9359 for details.
find "${pkgdir}"/usr -type d -exec chmod 755 {} +
+ chown -R root:root "${pkgdir}"
- ln -s ../lib/node_modules/triton/bin/triton "${pkgdir}"/usr/bin/triton
+ # Remove references to $pkgdir
+ find "$pkgdir" -type f -name package.json -print0 | xargs -0 sed -i '/_where/d'
+ for pkgjson in `find "$pkgdir" -type f -name package.json`; do
+ local tmppackage="$(mktemp)"
+ jq '.|=with_entries(select(.key|test("man")|not))' "$pkgjson" > "$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+ done
+
+ # Remove references to $srcdir
+ for pkgjson in `find "$pkgdir" -type f -name package.json`; do
+ local tmppackage="$(mktemp)"
+ jq '.|=with_entries(select(.key|test("_.+")|not))' "$pkgjson" > "$tmppackage"
+ mv "$tmppackage" "$pkgjson"
+ chmod 644 "$pkgjson"
+ done
}
+
+# vim: ts=2 sw=2 et: