user/mastodon: upgrade to 3.5.3

This commit is contained in:
Antoine Martin 2022-11-04 23:54:06 -04:00
parent a9c6511e76
commit 5b24a3c0cf
Signed by: forge
GPG key ID: D62A472A4AA7D541
5 changed files with 238 additions and 78 deletions

View file

@ -0,0 +1,114 @@
From 0ddbfb1fe1de4052ee0c64e4c4c05669254a66c6 Mon Sep 17 00:00:00 2001
From: Antoine Martin <dev@ayakael.net>
Date: Wed, 27 Jul 2022 10:31:02 -0400
Subject: [PATCH 1/1] ruby-3.1-support
---
Gemfile | 3 ++-
Gemfile.lock | 29 ++++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
diff --git a/Gemfile b/Gemfile
index 2e77fb42a..2fb22a217 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,7 +1,7 @@
# frozen_string_literal: true
source 'https://rubygems.org'
-ruby '>= 2.6.0', '< 3.1.0'
+ruby '>= 2.6.0', '< 3.2.0'
gem 'pkg-config', '~> 1.4'
gem 'rexml', '~> 3.2'
@@ -153,3 +153,4 @@ gem 'concurrent-ruby', require: false
gem 'connection_pool', require: false
gem 'xorcist', '~> 1.1'
+gem 'mail', '~> 2.8.0.rc1'
diff --git a/Gemfile.lock b/Gemfile.lock
index e12fdc237..a3c6298f7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -192,6 +192,7 @@ GEM
devise (>= 4.0.0)
rpam2 (~> 4.0)
diff-lcs (1.5.0)
+ digest (3.1.0)
discard (1.2.1)
activerecord (>= 4.2, < 8)
docile (1.3.4)
@@ -377,8 +378,11 @@ GEM
loofah (2.18.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
- mail (2.7.1)
+ mail (2.8.0.rc1)
mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
makara (0.5.1)
activerecord (>= 5.2.0)
marcel (1.0.2)
@@ -399,9 +403,23 @@ GEM
msgpack (1.5.1)
multi_json (1.15.0)
multipart-post (2.1.1)
+ net-imap (0.2.3)
+ digest
+ net-protocol
+ strscan
net-ldap (0.17.0)
+ net-pop (0.1.1)
+ digest
+ net-protocol
+ timeout
+ net-protocol (0.1.3)
+ timeout
net-scp (3.0.0)
net-ssh (>= 2.6.5, < 7.0.0)
+ net-smtp (0.3.1)
+ digest
+ net-protocol
+ timeout
net-ssh (6.1.0)
nio4r (2.5.8)
nokogiri (1.13.6)
@@ -643,6 +661,7 @@ GEM
stoplight (3.0.0)
strong_migrations (0.7.9)
activerecord (>= 5)
+ strscan (3.0.4)
swd (1.3.0)
activesupport (>= 3)
attr_required (>= 0.0.5)
@@ -654,6 +673,7 @@ GEM
climate_control (>= 0.0.3, < 1.0)
thor (1.2.1)
tilt (2.0.10)
+ timeout (0.3.0)
tpm-key_attestation (0.9.0)
bindata (~> 2.4)
openssl-signature_algorithm (~> 0.4.0)
@@ -780,6 +800,7 @@ DEPENDENCIES
letter_opener_web (~> 2.0)
link_header (~> 0.0)
lograge (~> 0.12)
+ mail (~> 2.8.0.rc1)
makara (~> 0.5)
mario-redis-lock (~> 1.2)
memory_profiler
@@ -846,3 +867,9 @@ DEPENDENCIES
webpacker (~> 5.4)
webpush (~> 0.3)
xorcist (~> 1.1)
+
+RUBY VERSION
+ ruby 3.1.2p20
+
+BUNDLED WITH
+ 2.3.14
--
2.36.2

View file

@ -1,96 +1,135 @@
# Maintainer: Antoine Martin <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=mastodon
pkgver=3.4.3
pkgver=3.5.3
pkgrel=0
pkgdesc='Self-hosted social media and network server based on ActivityPub and OStatus'
arch='x86_64'
url=https://github.com/tootsuite/mastodon
license='AGPL3'
depends='ffmpeg
imagemagick
libidn
libpqxx
libxml2
libxslt
libyaml
icu-libs
libpq
libressl
nodejs
npm
postgresql
redis
ruby
ruby-bundler
protobuf
yarn
gnu-libiconv
zlib
ruby-bigdecimal
ruby-io-console
ruby-irb
ruby-json
ruby-nokogiri
gcompat
ruby-etc'
makedepends='git libffi-dev ruby-rdoc ruby-dev icu-dev protobuf-dev libidn-dev openssl-dev postgresql-dev libxml2-dev libxslt-dev zlib-dev'
install="$pkgname.post-install $pkgname.post-upgrade"
source="mastodon-$pkgver.tar.gz::https://github.com/tootsuite/mastodon/archive/v$pkgver.tar.gz mastodon-web.initd mastodon-sidekiq.initd mastodon-streaming.initd"
pkgdesc="Self-hosted social media and network server based on ActivityPub and OStatus"
arch="all"
url="https://github.com/tootsuite/mastodon"
license="AGPL-3.0-only"
_ruby_duplicate="
ruby-addressable
ruby-builder
ruby-charlock_holmes
ruby-concurrent-ruby
ruby-erubi
ruby-ffi
ruby-i18n
ruby-mini_portile2
ruby-minitest
ruby-multi_json
ruby-net-imap
ruby-net-ldap
ruby-net-pop
ruby-net-smtp
ruby-nokogiri
ruby-ox
ruby-pg
ruby-posix-spawn
ruby-public_suffix
ruby-rake
ruby-rexml
ruby-thor
ruby-unf_ext
"
[ "$CARCH" = "armhf" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
[ "$CARCH" = "armv7" ] && _ruby_duplicate="${_ruby_duplicate/ruby-ox/}"
depends="
ffmpeg
gcompat
imagemagick
nodejs
npm
protobuf
redis
ruby
ruby-bigdecimal
ruby-bundler
ruby-etc
ruby-io-console
ruby-irb
ruby-json
yarn
$_ruby_duplicate
"
makedepends="
gnu-libiconv-dev
icu-dev
libffi-dev
libidn-dev
libressl-dev
libxml2-dev
libxslt-dev
openssl-dev
postgresql-dev
protobuf-dev
ruby-dev
ruby-rdoc
yaml-dev
zlib-dev
"
install="
$pkgname.pre-install
$pkgname.post-install
$pkgname.post-upgrade
"
source="
mastodon-$pkgver.tar.gz::https://github.com/tootsuite/mastodon/archive/v$pkgver.tar.gz
mastodon-web.initd
mastodon-sidekiq.initd
mastodon-streaming.initd
0001-ruby-3.1-support.patch
"
subpackages="$pkgname-openrc"
options="!check !strip"
prepare() {
cd "$srcdir"/mastodon-$pkgver
default_prepare
# Allow use of any bundler
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
# Allow use of any bundler
sed -i -e '/BUNDLED/,+1d' Gemfile.lock
# Allow use of higher Node versions
sed -i 's/"node": .*"/"node": ">=14.15"/' package.json
# Allow use of higher Node versions
sed -i 's/"node": .*"/"node": ">=14.15"/' package.json
}
build() {
cd "$srcdir"/mastodon-$pkgver
bundle config set deployment 'true'
bundle config set without 'development test'
bundle install -j$(getconf _NPROCESSORS_ONLN)
yarn install --pure-lockfile --ignore-engines
# RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
bundle config build.nokogiri --use-system-libraries --with-iconv-lib=/usr/lib --with-iconv-include=/usr/include
bundle config set deployment 'true'
bundle config set without 'development test'
bundle config set no-cache 'true'
bundle install -j"$(getconf _NPROCESSORS_ONLN)"
yarn install --pure-lockfile --ignore-engines
RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
}
package() {
cd "$srcdir"/mastodon-$pkgver/dist
# directory creation
install -dm 755 \
"$pkgdir"/usr/share/webapps \
"$pkgdir"/etc/init.d
# Fix path discrepancies
for f in mastodon-*.service; do
sed -e '0,/home/s/home/var\/lib/' \
-e 's/\/live//' \
-e 's/=\/usr\/bin/=\/var\/lib\/mastodon/' \
-e 's/home\/mastodon\/.rbenv\/shims/usr\/bin/' \
-i $f
done
cp -a "$builddir" "$pkgdir"/usr/share/webapps/mastodon
install -d "$pkgdir"/usr/share/webapps
install -d "$pkgdir"/etc
cp -a "$srcdir"/mastodon-$pkgver "$pkgdir"/usr/share/webapps/mastodon
# Put the config file in /etc and link to it
touch "$pkgdir"/etc/mastodon.conf
ln -s /etc/mastodon.conf "$pkgdir"/usr/share/webapps/mastodon/.env.production
ln -s /usr/bin/node "$pkgdir"/usr/share/webapps/mastodon/node
# Put the config file in /etc and link to it
touch "$pkgdir"/etc/mastodon.conf
ln -s /etc/mastodon.conf "$pkgdir"/usr/share/webapps/mastodon/.env.production
ln -s /usr/bin/node "$pkgdir"/usr/share/webapps/mastodon/node
install -Dm 755 "$srcdir"/*.initd "$pkgdir"/etc/init.d/
install -Dm 755 "$srcdir"/mastodon-web.initd "$pkgdir"/etc/init.d/mastodon-web
install -Dm 755 "$srcdir"/mastodon-streaming.initd "$pkgdir"/etc/init.d/mastodon-streaming
install -Dm 755 "$srcdir"/mastodon-sidekiq.initd "$pkgdir"/etc/init.d/mastodon-sidekiq
for i in $_ruby_duplicate; do
rm -R "$pkgdir"/usr/share/webapps/mastodon/vendor/bundle/ruby/*/gems/${i/ruby-/}*
done
rm -R "$pkgdir"/usr/share/webapps/mastodon/vendor/bundle/ruby/*/gems/nokogiri-*-x86_64-linux
# Removing all prebuilt artifacts
rm -R "$pkgdir"/usr/share/webapps/mastodon/node_modules/*/prebuilds 2>&1 || true
}
sha512sums="
cb89b27d48bb6849f66ba31d8e869a0f0590fbe52b28b1fc8da612d2df39d45f7a0137926adcb19fbd2c19d227314a9863f56246d0e4e6d1bc1fe52e8fa72319 mastodon-3.4.3.tar.gz
9035184ead64b46f28630d8a5d57ae414b34a81604f7acb146ef56f7c76483fbb8892197e16a4a61bea0572ae2861f2f7a76912885bb8005f5bc64d3f62d8db1 mastodon-3.5.3.tar.gz
9e77061fbdebe90492398f8089a7d2612ff4b6e70b5462dd67330b66d9788cb0133eab38c372b1f27a7214aacdd9f7f70381d4ecc6e92c8c38d794404ae0f840 mastodon-web.initd
06ebff4b4f51e0c7122db9ed175958fbcadf7e25d1d33c4cfd43992865b1ba183dbe6b4c8c244575f30a45a72d7d4ea3d887c597060e9cf2203bb00ae1a7ac79 mastodon-sidekiq.initd
eb8af0188c49b3507f9eedf54baf9d848f11288ce475963bde70686a1e5ff8960d32560771479651597703728bf0c8663a7bd068ccd8d32b620eba442a9a8ff1 mastodon-streaming.initd
0172f8867cc730c4094fcf40c640d3235cad834280e1a731d5175825e33907806ed0d6f7cc44d188dde9ecbf0cf7b68d8d75078d2d083702d10a71ff4efed17b 0001-ruby-3.1-support.patch
"

View file

@ -1,9 +1,6 @@
echo "To setup Mastodon, enable and start PostgreSQL and Redis:
# systemctl enable --now postgresql redis
Create the Mastodon PostgreSQL user and grant it the ability to create databases with:
# su - postgres -s /bin/sh -c \"createuser -d mastodon\"
Then, run:
# su - mastodon -s /bin/sh -c \"cd '/var/lib/mastodon'; RAILS_ENV=production bundle exec rails mastodon:setup\"
Finally, enable and start all the required services:
# systemctl enable --now mastodon.target"
#!/bin/sh
RAILS_ENV='production' OTP_SECRET=precompile_placeholder SECRET_KEY_BASE=precompile_placeholder bundle exec rails assets:precompile
exit 0

View file

@ -1,5 +1,8 @@
#!/bin/sh
echo "To upgrade the database schema, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails db:migrate\"
To pre-compile assets, run:
# su - mastodon -s /bin/sh -c \"RAILS_ENV=production bundle exec rails assets:precompile\""
exit 0

View file

@ -0,0 +1,7 @@
#!/bin/sh
addgroup -S -g 82 www-data 2>/dev/null
adduser -S -D -H -h /var/lib/mastodon -s /sbin/nologin -G www-data -g Mastodon mastodon 2>/dev/null
exit 0