You are not logged in.

#1 2023-10-20 14:40:43

tofu_li
Member
Registered: 2023-10-20
Posts: 2

PKGBUILD review: nextcloud-talk-desktop

Hello,

I'm trying to package the electron app for nextcloud-talk.
I dislike the use of 'find' in line 48, but am not sure how to handle that nicer.
From the Wiki I understand that I should not skip on the hashes, but didn't see the prefered way for git repos (unless this is the right way)?

# Maintainer: Michel von Czettritz <mvc AT emlix DOT com>
pkgname=nextcloud-talk-desktop
pkgver=0.12.0
pkgrel=1
pkgdesc="Nextcloud Talk Desktop Client Preview"
arch=('any')
url="https://github.com/nextcloud/talk-desktop"
license=('AGPL3')
depends=('electron'
        'bash')
makedepends=('node-gyp'
             'npm'
              'curl'
              'git')
provides=('nextcloud-talk-desktop')
conflicts=('nextcloud-talk-desktop')
_talk_tag=b102b40e8f685854b319bb5562c56da3237de58b
_spreed_tag=6a7a29285d519b246523cd1cbb9b1e6489920531
source=("git+https://github.com/nextcloud/talk-desktop.git?signed=${_talk_tag}"
      "git+https://github.com/nextcloud/spreed.git?signed=${_spreed_tag}")
md5sums=('SKIP'
         'SKIP')

prepare () {
  export TALK_PATH=${srcdir}/spreed
  cd spreed
  HOME="$srcdir/.electron-gyp" npm install
  cd ../talk-desktop
  HOME="$srcdir/.electron-gyp" npm install
}


build() {
  cd talk-desktop
  HOME="$srcdir/.electron-gyp" npm run package:linux
  mv "./out/Nextcloud Talk-linux-x64/" "./out/${pkgname}"
}

package() {
  install -d "$pkgdir/usr/lib/$pkgname/"
  cd talk-desktop
  install -Dm644 -t "${pkgdir}/usr/share/licenses/${pkgname}" LICENSE
  install -Dm755 /dev/null "${pkgdir}/usr/bin/$pkgname"
cat >>"${pkgdir}/usr/bin/$pkgname" <<EOD
#! /usr/bin/sh
exec electron /usr/lib/$pkgname "\$@"
EOD
  cd out/$pkgname/resources/app
  find ./ -type f -exec install -Dm 644 "{}" "$pkgdir/usr/lib/$pkgname/{}" \;

}

I've tried to follow the PKGBUILD of the rocket chat package and the arch wiki as much as possible. Any feedback would be much appreciated.

Cheers Tofu

Last edited by tofu_li (2023-10-20 14:43:15)

Offline

#2 2023-10-21 21:48:46

yochananmarqos
Member
Registered: 2020-02-05
Posts: 211

Re: PKGBUILD review: nextcloud-talk-desktop

  • The architecture is not 'any' as Electron applications build for the current architecture

  • Packages already provide and conflict with themselves

  • Either use {} for variables or don't. Either way, quotes should be used to prevent globbing

  • While the talk-desktop commit is signed, it is not on the default GPG keyserver (https://keyserver.ubuntu.com/).
      The spreed commit is only signed with GitHub’s verified signature.
      When using signed commits, you must have the PGP key in a validgpgkeys() array.

  • Use a local NPM cache, see Node.js package guidelines

  • Don't rename the output folder as it will be different per architecture

  • No need to install a duplicate AGPL3 license. It's a common license already installed via the `licenses` package

  • Do not use MD5 for checksums, it's insecure

  • Since this uses electron-forge instead of electron-builder, I don't know of any way build using the system Electron yet

Here's a preliminary working PKGBULD. It's currently missing a desktop file.


# Maintainer: Michel von Czettritz <mvc AT emlix DOT com>
pkgname=nextcloud-talk-desktop
pkgver=0.12.0
pkgrel=1
pkgdesc="Nextcloud Talk Desktop Client Preview"
arch=('x86_64')
url="https://github.com/nextcloud/talk-desktop"
license=('AGPL3')
depends=('alsa-lib' 'gtk3' 'nss')
makedepends=('git' 'npm')
_talk_tag=b102b40e8f685854b319bb5562c56da3237de58b  # tags/0.12.0^0
_spreed_tag=6a7a29285d519b246523cd1cbb9b1e6489920531  # tags/v0.17.11^0
source=("git+https://github.com/nextcloud/talk-desktop.git#commit=${_talk_tag}"
        "git+https://github.com/nextcloud/spreed.git#commit=${_spreed_tag}")
sha256sums=('SKIP'
            'SKIP')

prepare () {
  export npm_config_cache="${srcdir}/npm_cache"
  export TALK_PATH="${srcdir}/spreed"

  cd spreed
  npm install

  cd "${srcdir}/talk-desktop"
  npm install
}


build() {
  cd talk-desktop
  export npm_config_cache="${srcdir}/npm_cache"
  HOME="${srcdir}/.electron-gyp" npm run package:linux
}

package() {
  cd talk-desktop
  install -d "${pkgdir}/opt/${pkgname}"
  cp -r out/Nextcloud\ Talk-linux-x64/* "${pkgdir}/opt/${pkgname}"

  install -d "${pkgdir}/usr/bin"
  ln -s "/opt/${pkgname}/Nextcloud Talk" "${pkgdir}/usr/bin/$pkgname"

  install -Dm644 img/icons/icon.png "${pkgdir}/usr/share/pixmaps/${pkgname}.png"
}

Last edited by yochananmarqos (2023-10-21 22:03:45)

Offline

#3 2023-10-23 08:02:38

tofu_li
Member
Registered: 2023-10-20
Posts: 2

Re: PKGBUILD review: nextcloud-talk-desktop

Hi yochananmarqos,

thank you for the in depth review. I'll integrate the changes later today, but am curious as to why you've put using the elf binary in? Using the resource folder and invoking with the system electron works on my 2 setups. Though given that arch has no package for electron 26 or 27 even, its a version miss match when running.
Would the packaging of the resource folder be ok if the electron app version was pinned/aligned? Its around 100MB of another unneeded electron I'd rather not ship with packages.

Cheers Tofu

Last edited by tofu_li (2023-10-23 08:03:05)

Offline

Board footer

Powered by FluxBB