diff options
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | PKGBUILD | 48 |
3 files changed, 38 insertions, 20 deletions
@@ -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 @@ -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: |