summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Whited2019-06-19 17:25:25 -0500
committerSam Whited2019-06-19 17:25:25 -0500
commited271bcb88ffac3ecf14dd02b8dc08a229234b90 (patch)
treec03a5cb69db498a80f7899bb7ac7ebdba31cd4f1
parentc887cdd4a0bcab9605842a4f9a7d9c997d6a7be6 (diff)
downloadaur-ed271bcb88ffac3ecf14dd02b8dc08a229234b90.tar.gz
Follow packaging guidelines more closely
-rw-r--r--.SRCINFO6
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD48
3 files changed, 38 insertions, 20 deletions
diff --git a/.SRCINFO b/.SRCINFO
index ea73551d9706..1139a65b8538 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,14 +1,16 @@
pkgbase = nodejs-triton
pkgdesc = triton is a CLI tool for working with the CloudAPI for Joyent's Triton Public Cloud and Private Cloud
pkgver = 7.1.1
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/joyent/node-triton
arch = any
license = MPL
makedepends = npm
+ makedepends = jq
depends = nodejs
+ noextract = nodejs-triton-7.1.1.tar.gz
source = nodejs-triton-7.1.1.tar.gz::https://github.com/joyent/node-triton/archive/7.1.1.tar.gz
- md5sums = ac0c21c3f578147d8b51fb85c4b8abc6
+ sha256sums = f2aebe338af95c626b237ce9c472aedd57c1f5e26397a6483d40334b44be48b0
pkgname = nodejs-triton
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..93f5d9f2777e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+pkg/
+src/
+*.tar.gz
+*.tar.xz
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: