[arch-commits] Commit in matrix-appservice-irc/trunk (4 files)

David Runge dvzrv at archlinux.org
Sat Mar 7 22:27:19 UTC 2020


    Date: Saturday, March 7, 2020 @ 22:27:19
  Author: dvzrv
Revision: 591363

upgpkg: matrix-appservice-irc 0.16.0-1: Upgrading to 0.16.0. Updating maintainer info. Generating a dummy registration.yaml in prepare().
Making path to provisioning.rules.yaml FHS compliant in prepare(). Running npm audit and npm test in check().
Removing plenty of clutter files and folders before copying files to pkgdir (not using npm install for that, as it would install all clutter and mess up ownership/permissions anyways). 
Installing a systemd service, sysusers.d and tmpfiles.d integration. Installing python scripts to /usr/bin and updating the required python packages in optdepends. Installing docs.

Added:
  matrix-appservice-irc/trunk/matrix-appservice-irc.service
  matrix-appservice-irc/trunk/matrix-appservice-irc.sysusers
  matrix-appservice-irc/trunk/matrix-appservice-irc.tmpfiles
Modified:
  matrix-appservice-irc/trunk/PKGBUILD

--------------------------------+
 PKGBUILD                       |  135 +++++++++++++++++++++++++++++++++------
 matrix-appservice-irc.service  |   33 +++++++++
 matrix-appservice-irc.sysusers |    1 
 matrix-appservice-irc.tmpfiles |    1 
 4 files changed, 151 insertions(+), 19 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-03-07 22:26:32 UTC (rev 591362)
+++ PKGBUILD	2020-03-07 22:27:19 UTC (rev 591363)
@@ -1,27 +1,124 @@
-# Maintainer: Bruno Pagani <archange at archlinux.org>
+# Maintainer: David Runge <dvzrv at archlinux.org>
+# Contributor: Bruno Pagani <archange at archlinux.org>
 
 pkgname=matrix-appservice-irc
-pkgver=0.13.0
+pkgver=0.16.0
 pkgrel=1
 pkgdesc="Node.js IRC bridge for Matrix"
-arch=(any)
+arch=('x86_64')
 url="https://github.com/matrix-org/matrix-appservice-irc"
-license=(Apache)
-depends=(nodejs)
-makedepends=(npm git)
-optdepends=('python: for maintenance scripts')
-source=("${url}/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz")
-sha256sums=('9a3057223f8506f19d52c22030fba08327fdd0627d136512faf6b563c94fff7c')
+license=('Apache')
+depends=('nodejs')
+makedepends=('git' 'npm' 'python')
+optdepends=('python-urllib3: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py'
+            'python-requests: for grant-ops-in-room.py, migrate-users.py, remove-idle-users.py and remove-user.py'
+            'python-pyaml: for grant-ops-in-room.py, migrate-users.py and remove-user.py')
+source=("https://github.com/matrix-org/matrix-appservice-irc/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz"
+        "${pkgname}.service"
+        "${pkgname}.sysusers"
+        "${pkgname}.tmpfiles")
+sha512sums=('1a87082d15c9cae7a7e357fa4737fc36405f67ec1f10ae748ed703dc89ac68bc398887e287bd2f8a42e0a40e7703cf68d774b5c7aa06218e15428ded2de5e9de'
+            '8d7a290dda62e70ac8e368b07325ac5e183ce2671395e2561cb8f9cf9f381319e55c24cb2bcf37435a7cd55ceb11dfe0278d550993f0bdab2063b768441d47b4'
+            'f615e5da11be8d834d6f48f064a65a9b7aa129d255be7865a171522d5aed921eb549a33661ab2c4fff4625d2ca5a7f9c43be95c188e7a77bdde4062aa3983edd'
+            '60b7afdd68aaf2c8e47caf10efefb6c4dc54f40d187ad495a604786b30c00dac7e5c77a7b596d86c2a62a7cdbe3727e11f75494f86d26c9fc51ea7a1bf6ab7f0')
 
-package() {
-  cd ${pkgbase}-${pkgver}
-  npm install --cache "${srcdir}"/npm-cache -g --user root --prefix "${pkgdir}"/usr
+prepare() {
+  cd "${pkgname}-${pkgver}"
+  sed -e "s|./provisioning.rules.yaml|/etc/${pkgname}/provisioning.rules.yaml|" \
+      -i config.sample.yaml
+  touch registration.yaml
+}
 
-  # Apparently it now symlinks to the source folder…
-  rm -f "${pkgdir}"/usr/lib/node_modules/matrix-appservice-irc
-  mkdir -p "${pkgdir}"/usr/lib/node_modules/matrix-appservice-irc
-  cp -r * "${pkgdir}"/usr/lib/node_modules/matrix-appservice-irc/
-  chmod -R go-w "${pkgdir}"/usr/lib/node_modules/
-  chmod go-w "${pkgdir}"/usr/bin
-  chown -R root:root "${pkgdir}"/usr
+build() {
+  cd "${pkgname}-${pkgver}"
+  npm install --cache "${srcdir}"/npm-cache
 }
+
+check() {
+  cd "${pkgname}-${pkgver}"
+  npm audit || echo "npm audit output might return non-zero"
+  npm test
+}
+
+package() {
+  cd "${pkgname}-${pkgver}"
+  # removing unneeded files and directories
+  find node_modules -type f \
+          \( \
+         -iname '*Makefile*' -o \
+         -iname '*appveyor.yml' -o \
+         -iname '*.babelrc' -o \
+         -iname '*.bak' -o \
+         -iname '*bower.json' -o \
+         -iname '*.c' -o \
+         -iname '*.cc' -o \
+         -iname '*.cpp' -o \
+         -iname '*.md' -o \
+         -iname '*.markdown' -o \
+         -iname '*.rst' -o \
+         -iname '*.nycrc' -o \
+         -iname '*.npmignore' -o \
+         -iname '*.editorconfig' -o \
+         -iname '*.el' -o \
+         -iname '*.eslintignore' -o \
+         -iname '*.eslintrc*' -o \
+         -iname '*.fimbullinter.yaml' -o \
+         -iname '*.gitattributes' -o \
+         -iname '*.gitmodules' -o \
+         -iname '*.h' -o \
+         -iname '*.html' -o \
+         -iname '*.jshintrc' -o \
+         -iname '*.jscs.json' -o \
+         -iname '*.log' -o \
+         -iname '*logo.svg' -o \
+         -iname '*.nvmrc' -o \
+         -iname '*.o' -o \
+         -iname '*package.json' -o \
+         -iname '*package-lock.json' -o \
+         -iname '*.travis.yml' -o \
+         -iname '*.prettierrc' -o \
+         -iname '*.sh' -o \
+         -iname '*.tags*' -o \
+         -iname '*.tm_properties' -o \
+         -iname '*.wotanrc.yaml' -o \
+         -iname '*tsconfig.json' -o \
+         -iname '*yarn.lock' \
+         \) \
+         -delete
+  find node_modules -type d \
+          \( \
+         -iwholename '*.github' -o \
+         -iwholename '*.tscache' -o \
+         -iwholename '*/man' -o \
+         -iwholename '*/test' -o \
+         -iwholename '*/scripts' -o \
+         -iwholename '*/git-hooks' \
+         \) \
+         -exec rm -rvf {} +
+  find node_modules -empty -type d -delete
+  install -vdm 755 "${pkgdir}/usr/lib/node_modules/${pkgname}/"
+  # copy vendored modules, lib and entry point
+  cp -av {lib,node_modules,app.js,config.schema.yml} "${pkgdir}/usr/lib/node_modules/${pkgname}/"
+  # configuration
+  install -vDm 640 config.sample.yaml "${pkgdir}/etc/${pkgname}/config.yaml"
+  install -vDm 640 provisioning.rules.sample.yaml \
+    "${pkgdir}/etc/${pkgname}/provisioning.rules.yaml"
+  install -vDm 640 registration.yaml \
+    -t "${pkgdir}/etc/${pkgname}/"
+  # service
+  install -vDm 644 "../${pkgname}.service" -t "${pkgdir}/usr/lib/systemd/system"
+  # tmpfiles.d and sysusers.d
+  install -vDm 644 "../${pkgname}.sysusers" \
+    "${pkgdir}/usr/lib/sysusers.d/${pkgname}.conf"
+  install -vDm 644 "../${pkgname}.tmpfiles" \
+    "${pkgdir}/usr/lib/tmpfiles.d/${pkgname}.conf"
+  # python scripts
+  install -vDm 755 scripts/{grant-ops-in-room,migrate-users,remove-idle-users,remove-user}.py \
+    -t "${pkgdir}/usr/bin"
+  # add nodejs based scripts (which are location dependent)
+  install -vDm 755 scripts/{migrate-db-to-pgres.sh,unbridge.js} \
+    -t "${pkgdir}/usr/lib/node_modules/${pkgname}/scripts"
+  # docs
+  install -vDm 644 {CHANGELOG,CONTRIBUTING,HOWTO,README}.md \
+    -t "${pkgdir}/usr/share/doc/${pkgname}"
+}

Added: matrix-appservice-irc.service
===================================================================
--- matrix-appservice-irc.service	                        (rev 0)
+++ matrix-appservice-irc.service	2020-03-07 22:27:19 UTC (rev 591363)
@@ -0,0 +1,33 @@
+[Unit]
+Description=Matrix IRC Bridge
+After=network.target
+
+[Service]
+CapabilityBoundingSet=CAP_NET_BIND_SERVICE
+ExecStart=/usr/bin/node /usr/lib/node_modules/matrix-appservice-irc/app.js -c /etc/matrix-appservice-irc/config.yaml -f /etc/matrix-appservice-irc/registration.yaml
+Group=matrix-appservice-irc
+LockPersonality=yes
+MemoryDenyWriteExecute=true
+NoNewPrivileges=true
+PrivateDevices=true
+PrivateTmp=true
+ProtectControlGroups=yes
+ProtectHome=yes
+ProtectHostname=yes
+ProtectKernelLogs=yes
+ProtectKernelModules=yes
+ProtectKernelTunables=yes
+ProtectSystem=strict
+RemoveIPC=true
+Restart=on-failure
+RestrictAddressFamilies=AF_INET AF_INET6
+RestrictNamespaces=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+SystemCallArchitectures=native
+SystemCallFilter=@system-service
+SystemCallFilter=~@resources @privileged
+User=matrix-appservice-irc
+
+[Install]
+WantedBy=multi-user.target

Added: matrix-appservice-irc.sysusers
===================================================================
--- matrix-appservice-irc.sysusers	                        (rev 0)
+++ matrix-appservice-irc.sysusers	2020-03-07 22:27:19 UTC (rev 591363)
@@ -0,0 +1 @@
+u matrix-appservice-irc - "Matrix IRC Bridge"

Added: matrix-appservice-irc.tmpfiles
===================================================================
--- matrix-appservice-irc.tmpfiles	                        (rev 0)
+++ matrix-appservice-irc.tmpfiles	2020-03-07 22:27:19 UTC (rev 591363)
@@ -0,0 +1 @@
+z /etc/matrix-appservice-irc/*.yaml 0640 root matrix-appservice-irc -



More information about the arch-commits mailing list