From 8a4a8507fb2b94a7e62c7a7e4870593a5145cba0 Mon Sep 17 00:00:00 2001 From: tastytea Date: Tue, 7 Feb 2023 12:47:20 +0100 Subject: [PATCH] www-apps/misskey: add 13.4.0 Signed-off-by: tastytea --- www-apps/misskey/Manifest | 4 +- www-apps/misskey/misskey-13.4.0.ebuild | 161 +++++++++++++++++++++++++ 2 files changed, 163 insertions(+), 2 deletions(-) create mode 100644 www-apps/misskey/misskey-13.4.0.ebuild diff --git a/www-apps/misskey/Manifest b/www-apps/misskey/Manifest index 371388a15..cc2b7f7cf 100644 --- a/www-apps/misskey/Manifest +++ b/www-apps/misskey/Manifest @@ -1,6 +1,6 @@ -DIST misskey-13.2.5-deps.tar.xz 332229176 BLAKE2B 35549ae9fb3cf7637343abbeadeccb90642e5374094497b444d3483dac39c8e7722003e000ac9c1498d0d81882890ab4584ed36a2b72e97ef281b60df0f29235 SHA512 21623eb3d579aadf9b0a30fbe11dabe534eacc86955f14967c8f1a1f7baa6dc6925b6105825c99e0625745d4393dbe4c3f5984d425bdc71921a3c9ee41e14ea5 -DIST misskey-13.2.5.tar.gz 20100930 BLAKE2B 10b7a27ece8e6dab142062d23ce7bf39658abd0e07e2fe9164e350268f468691e469e50d79368a259361b18ca1847550236f560da1205d5717c77a2daa1a461d SHA512 99877aeef97d1bcce384802c0f94e9dc2ce874c90fececcb3b1c04db448fd370b22910b22ea8cfa198d7e5650eacd6dbdb575cf147f818112bc8745e4916c0ca DIST misskey-13.3.4-deps.tar.xz 336423560 BLAKE2B 6b49cba6e393cde77e97eb47c00fa2a36b34314c7ee8e8969584b3e1b0115345e5c9cefa38708c77acfadb3fa026cf60c6516d65408f6c0d50250e1dbf0b1e86 SHA512 42802ef45982d9a4c6b881831dd7d620694558706a253e4807fe52c59a3369222d711697fa0ca39b0eceb8f9631db6d2f189930407e840c7f96c5dc15bd9e1d4 DIST misskey-13.3.4.tar.gz 20103516 BLAKE2B 84aab4d386b7a77dac65a0b162331ea225c981a17ade8786e21c20aa2d5da35044c81de3ed5a5fe9d2ac85b5abd4540b71eb447456f3434906af5ac82469a045 SHA512 b97146e4bcb3e559a31aeefb726d685453ddce2a753b7d54a593ecfbb556633214f9dcd2d12e7d83902d7e7a1450b7fd916735d2f62f52efc1b9ee753fcc3fbb +DIST misskey-13.4.0-deps.tar.xz 336401424 BLAKE2B 9751911ad0c9fa57f01da4f7b1f82460cde52504ee594b0c01f9fbf648f06e6c8c33448d3ce63576eb319cd5ab26c17d552f33640b7b796ffccb51ac6b4ea547 SHA512 609ea5b0e69e1a2b47b483e00bc4c1fb82e95c8620761fd30c82002e82a74e184a9b10e27d58a05354b34aae4fb49a396d4470db9740b7f5694d8b6d23b1a905 +DIST misskey-13.4.0.tar.gz 20108366 BLAKE2B 5e2bb75c818720c70f21e24950638026ea9f43be3805e9945231d3e047bfb5eabf78e37bbaa13a82c69d2ea58601986e00164478d5c25ed37ad2cff3656dd892 SHA512 3ebbd69c7564683a24f6c4c86b1b81c2adb3f283522267d27acbab0eedb1c352644bb6bb0ff3689785b3cd2b406519ed39f63ae66ae9bc66d4fb785deff97a5e DIST misskey-assets-0179793ec891856d6f37a3be16ba4c22f67a81b5.tar.gz 40471635 BLAKE2B 5305b5b316aa9d27f860e0e2c86f55eeb4140fd76c9cc7a753f78f93c509a10237033ec2109d2e806605f302d3fc9e9b916d2967053a4bce9b2cdea14df5885b SHA512 b4de7d8ab43f27e14372bb7246be4b032b142f22913ceaaa01e7631a1f702ba77ccf25482038cf2341f7a0ae92d54a1200bb654cac1d409b1ddcc113513b3f16 DIST misskey-emojis-cae981eb4c5189ea9ea3230e83b876a5068df7d1.tar.gz 12933900 BLAKE2B e37df7009b21276debd2118d1fb12bc917aa148a088e186a2fe85597cb5ea1a9aa79600919e7d0196af2bf8dfc6fee7f1b9cc6b898cda00810ece2969291e5a7 SHA512 68fce9f6afd7bd3db40ca5e990514f9d88506253f100b7c9db2032be97594919c36ab4bdc235ebb98647b7cc827f88d53bf9bdb59b4017888a1ec3a68e2e06fb diff --git a/www-apps/misskey/misskey-13.4.0.ebuild b/www-apps/misskey/misskey-13.4.0.ebuild new file mode 100644 index 000000000..264e5ed5b --- /dev/null +++ b/www-apps/misskey/misskey-13.4.0.ebuild @@ -0,0 +1,161 @@ +# Copyright 2022-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit optfeature savedconfig + +# NOTE: check for updates on each bump +MY_COMMIT_ASSETS="0179793ec891856d6f37a3be16ba4c22f67a81b5" +MY_COMMIT_EMOJIS="cae981eb4c5189ea9ea3230e83b876a5068df7d1" + +DESCRIPTION="An interplanetary microblogging platform" +HOMEPAGE="https://misskey-hub.net/" +SRC_URI=" + https://github.com/misskey-dev/misskey/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz + https://github.com/misskey-dev/assets/archive/${MY_COMMIT_ASSETS}.tar.gz -> ${PN}-assets-${MY_COMMIT_ASSETS}.tar.gz + https://github.com/misskey-dev/emojis/archive/${MY_COMMIT_EMOJIS}.tar.gz -> ${PN}-emojis-${MY_COMMIT_EMOJIS}.tar.gz + https://tastytea.de/files/gentoo/${P}-deps.tar.xz +" + +# NOTE: to generate the deps archive: +# export CYPRESS_CACHE_FOLDER="$(realpath ./packages-cache)" +# export npm_config_cache="$(realpath ./packages-cache)" +# pnpm config set store-dir "$(realpath ./packages-cache)" +# pnpm install --frozen-lockfile +# tar -caf ${P}-deps.tar.xz packages-cache +# unset CYPRESS_CACHE_FOLDER npm_config_cache + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64" +IUSE="nginx +savedconfig source" + +REQUIRED_USE="savedconfig" + +RESTRICT="strip network-sandbox" + +COMMON_DEPEND=" + >=net-libs/nodejs-18.13:=[npm] +" +BDEPEND=" + ${COMMON_DEPEND} + dev-lang/nasm + virtual/pkgconfig +" +RDEPEND=" + ${COMMON_DEPEND} + acct-user/misskey + >=dev-db/postgresql-15 + dev-db/redis + nginx? ( www-servers/nginx ) +" + +QA_PREBUILT=" + /opt/misskey/misskey/packages/backend/node_modules/msgpackr-extract/prebuilds/* + /opt/misskey/misskey/packages/client/node_modules/microtime/prebuilds/* +" + +pkg_setup() { + # check if pnpm from nodejs is installed + if ! type pnpm > /dev/null 2>&1; then + eerror "pnpm not found. It can be installed with 'corepack enable'" + fi +} + +src_unpack() { + default + mv --no-target-directory assets-${MY_COMMIT_ASSETS} ${P}/${PN}-assets \ + || die "Could not move assets" + mv --no-target-directory emojis-${MY_COMMIT_EMOJIS} ${P}/fluent-emojis \ + || die "Could not move emojis" + mv packages-cache "${T}"/ || die "Could not move packages cache" +} + +src_prepare() { + export CYPRESS_CACHE_FOLDER="${T}"/packages-cache + export npm_config_cache="${T}"/packages-cache + export PNPMFLAGS="--verbose" + pnpm config set cache "${T}"/packages-cache + pnpm config set store-dir "${T}"/packages-cache + + # use system node-gyp + PATH+=":/usr/lib64/node_modules/npm/bin/node-gyp-bin" + export npm_config_nodedir=/usr/include/node/ + + restore_config .config/default.yml + if [[ ! -f .config/default.yml ]]; then + eerror "Edit .config/example.yml and save it to the location mentioned above" + die "No config file found" + fi + + default +} + +src_compile() { + pnpm ${PNPMFLAGS} install --frozen-lockfile || die "dependency installation failed" + NODE_ENV=production pnpm ${PNPMFLAGS} run build || die "build failed" +} + +src_install() { + insinto opt/misskey/misskey + insopts -o misskey -g misskey + if use source; then + doins -r . + else + doins -r package.json .node-version .config built node_modules packages \ + fluent-emojis pnpm-workspace.yaml pnpm-lock.yaml + fi + + # insopts doesn't affect directories + chown --recursive misskey:misskey "${ED}"/opt/misskey/misskey + chmod o= "${ED}"/opt/misskey/misskey + + newinitd "${FILESDIR}"/${PN}.initd ${PN} + if use nginx; then + sed -i 's/use logger$/use logger nginx/' "${ED}"/etc/init.d/${PN} \ + || die "Could not modify OpenRC init script" + fi + + einstalldocs +} + +pkg_preinst() { + # Apparently Misskey creates files at runtime that can interfere + # after an upgrade. Normally you would run 'yarn cleanall'. + einfo "Cleaning up Misskey directory …" + su --shell /bin/bash --login --command \ + "rm -rf misskey/{built,node_modules} && rm -rf misskey/packages/{backend,client,sw}/{built,node_modules}" \ + misskey || die "cleanup failed" +} + +pkg_postinst() { + # Only run migrations if database exists + if su --command "psql misskey -c ''" postgres; then + einfo "Running migration…" + su --shell /bin/bash --login --command \ + "cd misskey && pnpm run migrate" misskey || die "migration failed" + else + elog "Run emerge --config ${CATEGORY}/${PN} to initialise the PostgreSQL database" + fi + + if use nginx; then + einfo "An nginx example config can be found at " + fi + + optfeature "thumbnail generation support" media-video/ffmpeg +} + +pkg_config() { + einfo "Initialising PostgreSQL database" + echo -n "password for misskey user: " + read -r MY_PASSWORD || die "Reading password failed" + echo "create database misskey with encoding = 'UTF8'; create user misskey with encrypted password '${MY_PASSWORD}'; grant all privileges on database misskey to misskey; \q" \ + | su --command psql postgres || die "database creation failed" + + su --shell /bin/bash --login --command \ + "cd misskey && pnpm run init" misskey || die "database initialisation failed" + + ewarn "When you first start Misskey you will be asked to add an admin account via the web interface, and registrations are enabled." + ewarn "Do not expose the web interface to the public until after you configured your instance\!" +}