summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authoréclairevoyant2023-06-02 00:45:18 -0400
committeréclairevoyant2023-06-02 00:45:18 -0400
commit90393e89de07ed6eae9bebab4e42cd842b1ad245 (patch)
treee065414d0a6a2f55c45a421419f99c8fcc3f2fe5
parent783bc10062d36e3f3763ac0da27a834a4efc0201 (diff)
downloadaur-90393e89de07ed6eae9bebab4e42cd842b1ad245.tar.gz
bitwarden-cli-git: use repo PKGBUILD; fix pkgver
-rw-r--r--.SRCINFO21
-rw-r--r--.gitignore9
-rw-r--r--PKGBUILD78
3 files changed, 66 insertions, 42 deletions
diff --git a/.SRCINFO b/.SRCINFO
index bc2bd116a973..d4d6f612e1ac 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,19 +1,20 @@
pkgbase = bitwarden-cli-git
pkgdesc = Bitwarden Command-line Interface
- pkgver = 1.7.4.r17.g3915e43
+ pkgver = 2023.5.0.r8.2d9fdd68da2
pkgrel = 1
- url = https://github.com/bitwarden/cli
+ url = https://github.com/bitwarden/clients/apps/cli
arch = x86_64
license = GPL3
- makedepends = nodejs
+ makedepends = git
makedepends = npm
- depends = nodejs
+ makedepends = modclean
+ depends = nodejs-lts-gallium
+ provides = bitwarden-cli
conflicts = bitwarden-cli
- options = !strip
- source = bitwarden-cli-git-repo::git+https://github.com/bitwarden/cli.git
- source = jslib-git-repo::git+https://github.com/bitwarden/jslib.git
- sha512sums = SKIP
- sha512sums = SKIP
+ options = !emptydirs
+ source = bitwarden-cli::git+https://github.com/bitwarden/clients.git
+ source = git+https://github.com/bitwarden/jslib.git
+ b2sums = SKIP
+ b2sums = SKIP
pkgname = bitwarden-cli-git
-
diff --git a/.gitignore b/.gitignore
index 4782637367b7..713f6f80aff8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,4 @@
-pkg/
-src/
-bitwarden-cli-git-repo/
-jslib-git-repo/
-bitwarden-cli-git-1.*
+/*
+!/.gitignore
+!/.SRCINFO
+!/PKGBUILD
diff --git a/PKGBUILD b/PKGBUILD
index 6e3834cb6a54..6c48cefd5a0c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,42 +1,66 @@
-# Maintainer: libertylocked <libertylocked@disroot.org>
+# Maintainer: éclairevoyant
+# Contributor: Alexander Epaneshnikov <alex19ep at archlinux dot com>
+# Contributor: libertylocked <libertylocked at disroot dot org>
-pkgname=bitwarden-cli-git
_pkgname=bitwarden-cli
-pkgver=1.7.4.r17.g3915e43
+pkgname="$_pkgname-git"
+pkgver=2023.5.0.r8.2d9fdd68da2
pkgrel=1
pkgdesc='Bitwarden Command-line Interface'
-arch=('x86_64')
-url='https://github.com/bitwarden/cli'
-license=('GPL3')
-makedepends=('nodejs' 'npm')
-depends=('nodejs')
-conflicts=('bitwarden-cli')
-options=('!strip')
-source=("${_pkgname}-git-repo::git+https://github.com/bitwarden/cli.git"
- 'jslib-git-repo::git+https://github.com/bitwarden/jslib.git')
-sha512sums=('SKIP'
- 'SKIP')
+arch=(x86_64)
+url='https://github.com/bitwarden/clients/apps/cli'
+license=(GPL3)
+depends=(nodejs-lts-gallium)
+makedepends=(git npm modclean)
+provides=("$_pkgname")
+conflicts=("$_pkgname")
+options=(!emptydirs)
+source=("$_pkgname::git+https://github.com/bitwarden/clients.git"
+ 'git+https://github.com/bitwarden/jslib.git')
+b2sums=('SKIP'
+ 'SKIP')
-pkgver() {
- cd "${_pkgname}-git-repo"
- git describe --long --tags | sed 's/^v//' | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
+prepare() {
+ cd $_pkgname
+ export npm_config_build_from_source=true
+ export npm_config_cache="$srcdir/npm_cache"
+
+ npm ci
}
-prepare() {
- rmdir "${srcdir}/${_pkgname}-git-repo/jslib"
- ln -s "${srcdir}/jslib-git-repo" "${srcdir}/${_pkgname}-git-repo/jslib"
- sed -i 's/"postinstall": "npm run sub:init",//' "${_pkgname}-git-repo/package.json"
+pkgver() {
+ cd $_pkgname
+ git blame -s -L"/\"version\"/,+1" apps/cli/package.json | awk '{
+ ver = gensub(/[^0-9.]/, "", "g", $4);
+ "git rev-list --count "$1"..HEAD" | getline commit_count;
+ print ver".r"commit_count"."$1
+ }'
}
build() {
- cd "${_pkgname}-git-repo"
- npm install
- npm run dist:lin
+ cd $_pkgname/apps/cli
+ export npm_config_cache="$srcdir/npm_cache"
+ npm run dist:lin
+ npm run clean
+ node ./build/bw.js completion --shell zsh > _bw
}
package() {
- cd "${_pkgname}-git-repo"
+ cd $_pkgname/apps/cli
+ npm install --production -g --prefix "$pkgdir"/usr $(npm pack . | tail -1)
+
+ # Non-deterministic race in npm gives 777 permissions to random directories.
+ # See https://github.com/npm/npm/issues/9359 for details.
+ chmod -R u=rwX,go=rX "$pkgdir"
+ # npm gives ownership of ALL FILES to build user
+ # https://bugs.archlinux.org/task/63396
+ chown -R root:root "${pkgdir}"
+
+ # package zsh completions
+ install -vDm644 _bw -t "${pkgdir}/usr/share/zsh/site-functions"
- install -dm755 "${pkgdir}/usr/bin"
- install -Dm755 ./dist/linux/bw "${pkgdir}/usr/bin/bw"
+ # cleanup
+ sed -e "s|${srcdir}|/|" -i "$pkgdir"/usr/lib/node_modules/@bitwarden/cli/package.json
+ find "$pkgdir"/usr/lib/node_modules -name 'package.json' -exec sed -e "s|${srcdir}||" -i {} \;
+ modclean --path "$pkgdir"/usr/lib -r -a "*.ts,.bin,.github,.vscode,bin.js" --ignore='license'
}