From 4b6c6d38842a8ea1889dc8b3d17ed43d9ee975c2 Mon Sep 17 00:00:00 2001 From: Antonio Date: Thu, 21 Nov 2024 20:14:53 +0100 Subject: [PATCH] bruno: add package (#4360) * bruno: add package * Add nvm * Update PKGBUILD * Update PKGBUILD * Update to-release * Update PKGBUILD * Update PKGBUILD --- lists/to-release | 2 + packages/bruno/PKGBUILD | 99 +++++++++++++++++++ packages/bruno/com.usebruno.app.Bruno.desktop | 9 ++ packages/nvm/PKGBUILD | 46 +++++++++ packages/nvm/init-nvm.sh | 4 + packages/nvm/install-nvm-exec | 4 + packages/nvm/nvm.install | 36 +++++++ 7 files changed, 200 insertions(+) create mode 100644 packages/bruno/PKGBUILD create mode 100644 packages/bruno/com.usebruno.app.Bruno.desktop create mode 100644 packages/nvm/PKGBUILD create mode 100644 packages/nvm/init-nvm.sh create mode 100644 packages/nvm/install-nvm-exec create mode 100644 packages/nvm/nvm.install diff --git a/lists/to-release b/lists/to-release index e69de29bb2d..942302d24e9 100644 --- a/lists/to-release +++ b/lists/to-release @@ -0,0 +1,2 @@ +bruno +nvm diff --git a/packages/bruno/PKGBUILD b/packages/bruno/PKGBUILD new file mode 100644 index 00000000000..652cf406caa --- /dev/null +++ b/packages/bruno/PKGBUILD @@ -0,0 +1,99 @@ +# This file is part of BlackArch Linux ( https://www.blackarch.org/ ). +# See COPYING for license details. + +# Initial PKGBUILD from AUR. +# Old Maintainer: Vianney Bouchaud + +pkgname=bruno +pkgver=v1.34.2.r3.g4894ac2 +pkgrel=1 +pkgdesc='Opensource API Client for Exploring and Testing APIs.' +groups=('blackarch' 'blackarch-webapp') +arch=('x86_64') +url="https://www.usebruno.com/" +license=('MIT') +_electron=electron31 +depends=("$_electron" 'alsa-lib') +makedepends=('nvm' 'asar' 'python-setuptools' 'python') +source=("git+https://github.com/usebruno/$pkgname.git" + "com.usebruno.app.Bruno.desktop") +sha512sums=('SKIP' + '0c303dd2a3cb1d1628d25b33d515df4fdaf116298520bed5a251d8320d5f771146a625165ab07fbbf7f4698ebc3bcfc7682a44aaa635d980493c7fc208389884') + +_ensure_local_nvm() { + # lets be sure we are starting clean + which nvm >/dev/null 2>&1 && nvm deactivate && nvm unload + + export NVM_DIR="${srcdir}/${pkgname}-${pkgver}/.nvm" + # The init script returns 3 if version + # specified in ./.nvrc is not (yet) installed in $NVM_DIR + # but nvm itself still gets loaded ok + source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] +} + +pkgver() { + cd $pkgname + + ( set -o pipefail + git describe --long --tags --abbrev=7 2>/dev/null | + sed 's/\([^-]*-g\)/r\1/;s/-/./g' || + printf "%s.%s" "$(git rev-list --count HEAD)" \ + "$(git rev-parse --short=7 HEAD)" + ) +} + +prepare() { + _ensure_local_nvm + cd $pkgname + + nvm install + + # https://typicode.github.io/husky/how-to.html#ci-server-and-docker + export HUSKY=0 + + npm install --cache "$srcdir/npm-cache" + + npm install electron-builder --save-dev --cache "$srcdir/npm-cache" + npm install node-addon-api --save-dev --cache "$srcdir/npm-cache" +} + +build() { + _ensure_local_nvm + export NODE_ENV=production + export NODE_OPTIONS=--openssl-legacy-provider + + cd $pkgname + + npm run build:graphql-docs + npm run build:bruno-query + npm run build:bruno-common + npm run sandbox:bundle-libraries --workspace=packages/bruno-js + npm run build:web + + electronDist="/usr/lib/$_electron" + electronVer="$(cat $electronDist/version)" + sed -i -e "s~\"dist:linux\":.*~\"dist:linux\": \"electron-builder --linux --x64 --dir --config electron-builder-config.js -c.electronDist=$electronDist -c.electronVersion=$electronVer\",~g" packages/bruno-electron/package.json + + npm run build:electron:linux +} + +package() { + install -Dm0644 com.usebruno.app.Bruno.desktop -t "$pkgdir/usr/share/applications/" + + cd $pkgname + + install -Dm0755 /dev/null "$pkgdir/usr/bin/$pkgname" + cat >> "$pkgdir/usr/bin/$pkgname" < + +pkgname=nvm +pkgver=0.40.1 +pkgrel=1 +pkgdesc='Node Version Manager - Simple bash script to manage multiple active node.js versions.' +url='https://github.com/nvm-sh/nvm' +arch=('any') +license=('MIT') +optdepends=('bash: bash completion') +install="${pkgname}.install" +source=("${pkgname}-${pkgver}.tar.gz::https://github.com/nvm-sh/nvm/archive/v${pkgver}.tar.gz" + "init-nvm.sh" + "install-nvm-exec") +sha512sums=('ccf4d43abc3c812ffc694e95770fef39bdd9963c77606636f1cd54dcd64a8ec3e338aa56ba907a81a671191eda6accbb0fcda25ccf14d439d7a7d7a96acfba4d' + 'b6a1906f644aa3cab17baeaf9e8bf0b256215b5fa082d73261095f45b5f16769fa91bccc597b22c2cfda0751b0e7f5865e2ff77176bb3e0998966be1fee5a76c' + '148753d8d76cda4be75139628c04784b7abb70859d3815aa651bfd91a326b8c6b71897c27e7c1482c3255f271057ebc09147cbaba9faa36a66c2e6e2c6d4612a') + +package() { + cd "${srcdir}" + + # convenience script + install -Dm644 init-nvm.sh "$pkgdir/usr/share/$pkgname/init-nvm.sh" + + # companion script which installs symlinks in NVM_DIR (see comment in script) + install -Dm644 install-nvm-exec "$pkgdir/usr/share/$pkgname/install-nvm-exec" + + cd "${pkgname}-${pkgver}" + + # nvm itself + install -Dm644 nvm.sh "$pkgdir/usr/share/$pkgname/nvm.sh" + + # nvm-exec script for 'nvm exec' command + install -Dm755 nvm-exec "$pkgdir/usr/share/$pkgname/nvm-exec" + + # bash completion + install -Dm644 bash_completion "$pkgdir/usr/share/$pkgname/bash_completion" + + # license + install -Dm644 LICENSE.md "$pkgdir/usr/share/licenses/$pkgname/LICENSE.md" +} + diff --git a/packages/nvm/init-nvm.sh b/packages/nvm/init-nvm.sh new file mode 100644 index 00000000000..3ef3fbf57d1 --- /dev/null +++ b/packages/nvm/init-nvm.sh @@ -0,0 +1,4 @@ +[ -z "$NVM_DIR" ] && export NVM_DIR="$HOME/.nvm" +source /usr/share/nvm/nvm.sh +source /usr/share/nvm/bash_completion +source /usr/share/nvm/install-nvm-exec diff --git a/packages/nvm/install-nvm-exec b/packages/nvm/install-nvm-exec new file mode 100644 index 00000000000..214ff4a41c8 --- /dev/null +++ b/packages/nvm/install-nvm-exec @@ -0,0 +1,4 @@ +# "nvm exec" and certain 3rd party scripts expect "nvm.sh" and "nvm-exec" to exist under $NVM_DIR +[ -e "$NVM_DIR" ] || mkdir -p "$NVM_DIR" +[ -e "$NVM_DIR/nvm.sh" ] || ln -s /usr/share/nvm/nvm.sh "$NVM_DIR/nvm.sh" +[ -e "$NVM_DIR/nvm-exec" ] || ln -s /usr/share/nvm/nvm-exec "$NVM_DIR/nvm-exec" diff --git a/packages/nvm/nvm.install b/packages/nvm/nvm.install new file mode 100644 index 00000000000..326f1b10ca6 --- /dev/null +++ b/packages/nvm/nvm.install @@ -0,0 +1,36 @@ +## arg 1: the new package version +post_install() { + echo " +You need to source nvm before you can use it. Do one of the following +or similar depending on your shell (and then restart your shell): + + echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.bashrc + echo 'source /usr/share/nvm/init-nvm.sh' >> ~/.zshrc + +You can now install node.js versions (e.g. nvm install 10) and +activate them (e.g. nvm use 10). + +init-nvm.sh is a convenience script which does the following: +" + cat usr/share/nvm/init-nvm.sh + echo " +You may wish to customize and put these lines directly in your +.bashrc (or similar) if, for example, you would like an NVM_DIR +other than ~/.nvm or you don't want bash completion. + +See the nvm readme for more information: https://github.com/creationix/nvm +" +} + +## arg 1: the old package version +post_remove() { + echo " +Don't forget to clean up any lines added to your shell's startup script! + +For example, from your .bashrc (or .zshrc etc.), delete the line: + +source /usr/share/nvm/init-nvm.sh +" +} + +# vim:set ts=2 sw=2 et: