# Maintainer: Sampson Crowley # Contributor: Rhys Kenwell # Github Contributor: Michael Herold pkgname=heroku-cli pkgver=7.47.2 pkgrel=3 _builddir=cli-$pkgver-$pkgrel pkgdesc="CLI to manage Heroku apps and services with forced auto-update removed" arch=('any') url="https://devcenter.heroku.com/articles/heroku-cli" license=('custom' 'ISC') depends=('nodejs') makedepends=('npm' 'perl') optdepends=('git: Deploying to Heroku') conflicts=('heroku-cli-bin' 'heroku-client-standalone' 'heroku-toolbelt' 'ruby-heroku') source=("https://github.com/heroku/cli/archive/v$pkgver.tar.gz") sha256sums=('296710bdde3e4b856adc66c5dedb6a07e2b2490a2a205feb81a08d6cecaf7add') sha512sums=('7ef0ea969e6ba8bcddd085658f08b659ece5fe204c3448338f7af48e86c4df5436773c9c35e622c4b0a52db0b3b2ceca9c7e9811c421528c7d9b15050d7e80b5') options=('!strip') provides=('heroku' 'heroku-cli') append_path () { case ":$PATH:" in *:"$1":*) ;; *) PATH="${PATH:+$PATH:}$1" esac } prepare() { # Set path to perl scriptdirs if they exist # https://wiki.archlinux.org/index.php/Perl_Policy#Binaries_and_scripts # Added /usr/bin/*_perl dirs for scripts [ -d /usr/bin/site_perl ] && append_path '/usr/bin/site_perl' [ -d /usr/bin/vendor_perl ] && append_path '/usr/bin/vendor_perl' [ -d /usr/bin/core_perl ] && append_path '/usr/bin/core_perl' export PATH pushd "$srcdir" pushd "cli-$pkgver" # install packaging tools npm install pushd packages/cli # remove forced auto-update plugin sed -i "/oclif\/plugin-update/d" ./package.json # install dependencies npm install # remove dist folder if necessary if [[ -d "./dist" ]]; then rm -r ./dist fi npx oclif-dev pack --targets="linux-x64" pushd dist/heroku-v$pkgver/ # move package source to src root mv -f ./heroku-v$pkgver-linux-x64.tar.xz $srcdir/ popd popd popd # extract oclif package tar -xvf "heroku-v$pkgver-linux-x64.tar.xz" -C "$srcdir/" # unneeded compilation files for file in *; do if [[ "$file" = "heroku" ]]; then continue else rm -rf "$file" fi done # remove packaged node binary and fall back to whatever node is on the PATH rm -f ./heroku/bin/heroku rm -f ./heroku/bin/heroku.cmd rm -f ./heroku/bin/node popd } package() { install -dm755 "$pkgdir/usr/lib/heroku" install -dm755 "$pkgdir/usr/bin" install -dm755 "$pkgdir/usr/share/licenses/$pkgname" herokulibdir="$pkgdir/usr/lib" for foundherokudir in $(find "$srcdir/heroku" -mindepth 1 -type d) ; do herokuinstalldir="${foundherokudir/$srcdir/$herokulibdir}" install -dm755 "$herokuinstalldir" done for foundherokufile in $(find "$srcdir/heroku" -mindepth 1 -type f) ; do herokuinstallperm=$(stat -c "%a" "$foundherokufile") herokuinstallfile="${foundherokufile/$srcdir/$herokulibdir}" install -Dm$herokuinstallperm "$foundherokufile" "$herokuinstallfile" done ln -sf "../../../lib/heroku/LICENSE" "$pkgdir/usr/share/licenses/$pkgname" ln -sf "../../lib/heroku/bin/run" "$pkgdir/usr/bin/heroku" }