From ccb29bcb2ae5f8d42e26f37d2e653b641b1ed3bd Mon Sep 17 00:00:00 2001 From: Esteve Varela Colominas Date: Sat, 20 Dec 2025 16:56:06 +0100 Subject: [PATCH] www-servers/copyparty: New package I'm honestly surprised this hasn't been packaged in gentoo, I kind of expected this to be the sort of tool that makes this community salivate. I definitely intend to make this the backbone of my file server. Signed-off-by: Esteve Varela Colominas --- www-servers/copyparty/Manifest | 1 + .../copyparty/copyparty-1.19.23.ebuild | 125 ++++++++++++++++++ www-servers/copyparty/metadata.xml | 11 ++ 3 files changed, 137 insertions(+) create mode 100644 www-servers/copyparty/Manifest create mode 100644 www-servers/copyparty/copyparty-1.19.23.ebuild create mode 100644 www-servers/copyparty/metadata.xml diff --git a/www-servers/copyparty/Manifest b/www-servers/copyparty/Manifest new file mode 100644 index 0000000000..449af8504e --- /dev/null +++ b/www-servers/copyparty/Manifest @@ -0,0 +1 @@ +DIST copyparty-1.19.23.tar.gz 1662026 BLAKE2B ba6ff615f407f5afdc26dc1bcd21a05ff8c0737630e04b3dbf7c0e82c656621b0d6376390fd2da6487b213662d2f3574180b381de3e352281a982e110dacb7cc SHA512 0477ddac96038dac3e82d5af3266917d73716d436794d48e902d6785739abf3130992426f21e19fef37f0d8a2e1bf63b13c6e8e8348a58dfefeac166a6c5a3b1 diff --git a/www-servers/copyparty/copyparty-1.19.23.ebuild b/www-servers/copyparty/copyparty-1.19.23.ebuild new file mode 100644 index 0000000000..d4219c90b5 --- /dev/null +++ b/www-servers/copyparty/copyparty-1.19.23.ebuild @@ -0,0 +1,125 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +PYTHON_COMPAT=( python3_{11..14} ) +DISTUTILS_USE_PEP517=setuptools +inherit distutils-r1 optfeature edo + +DESCRIPTION="Easy-to-use, feature-packed, protable file server" +HOMEPAGE="https://github.com/9001/copyparty" + +SRC_URI="https://github.com/9001/copyparty/releases/download/v${PV}/copyparty-${PV}.tar.gz" + +LICENSE="MIT" # TODO: licenses of copyparty/web/deps +SLOT="0" +KEYWORDS="~amd64" +IUSE="test" +RESTRICT="!test? ( test )" + +DEPEND=" + test? ( dev-python/strip-hints ) +" + +# TODO: This package is unfinished and lacks some features: +# - Service scripts: +# - contrib/openrc/copyparty: Hardcodes /usr/local/bin, runs as root, exposes /mnt as RW (!?) +# - contrib/systemd/copyparty.service: Hardcodes /usr/local/bin, runs as root, in /var/lib/copyparty +# - contrib/systemd/copyparty@.service: Runs as an arbitrary user, in /var/lib/copyparty-jail, at boot +# - contrib/systemd/copyparty-user.service: User service, runs in /var/lib/copyparty-jail +# Ideally, both systemd and openrc scripts would have the same behavior. +# I also think it'd be sane to default to a new user/group named copyparty, +# and create /var/lib/copyparty with the correct permissions. +# +# - Default configuration: There's a bunch of examples, find them using: +# `find docs contrib -name '*.conf'`. +# Ideally one of these would be installed as /etc/copyparty.conf, and an +# /etc/copyparty.d directory would be created. I'm not sure what would be +# acceptable defaults. +# +# - Jailing the service with prisonparty/bubbleparty: This program is very +# feature-packed, and has a decent security track record, but just has a +# massive attack surface with serious repercussions. Some packages provide a +# "prisonparty" service, which runs the program in a chroot. This script +# hardcodes a lot of things that I'm not sure will work on gentoo, and would +# need matching openrc/systemd services as well. + +# Bundled dependency notice: +# A few "web dependencies" are supplied in the copyparty/web/deps directory. +# These are mostly things that run in the web browser, such as javascript +# libraries, markdown editors, some assets such as fonts, and a sha512 function +# implemented in webassembly. +# An attempt at rebuilding these was made, but the scripts required too much +# patching and should be adapted upstream to be more easily buildable without +# docker. Additionally, it's difficult to package npm dependencies in gentoo. +# https://gist.github.com/mid-kid/cc7c0c2e1c188c8b135663d547e3dd35 + +src_prepare() { + # Reuse the bundled copy of fusepy for partyfuse + # patched in scripts/deps-docker/Dockerfile (under "build fusepy") + sed -e '/from fuse import/s/fuse/copyparty.web.deps.&/' \ + -i bin/partyfuse.py || die + + distutils-r1_src_prepare +} + +python_test() { + edo bash scripts/run-tests.sh python3 +} + +python_install() { + distutils-r1_python_install + + # Useful utilities listed in bin/README.md + # These need to be executed inside the server's data directory + # Installed into /usr/libexec as not a single other package installs them + python_scriptinto /usr/libexec/copyparty + python_newscript bin/partyjournal.py partyjournal + python_newscript bin/dbtool.py dbtool +} + +src_install() { + distutils-r1_src_install + + # Not all of the documentation is useful, but it's hard to filter, + # and plenty of it is quite useful. + dodoc -r docs contrib + + # These additional scripts can be used through command-line flags or + # configuration files, so it makes sense to put them in a predictable + # location. A few of these will require customization, the user should + # copy them to /etc. + insinto /usr/share/copyparty + doins -r bin/handlers bin/hooks bin/mtag + + # Every other package seems to install this, but it needs a service script, + # as well as proper creation of the jail + testing. + #newbin bin/prisonparty.sh prisonparty + + # Bubbleparty seems more reasonable, yet I don't see this included in other + # packages. Would need an optional sys-apps/bubblewrap dependency. + #newbin bin/bubbleparty.sh bubbleparty + + # Skipped tools: + # - bin/partyfuse-streaming.py: Doc tells me this doesn't exist + # - bin/partyfuse2.py: The regular partyfuse.py is better supported + # - bin/unforget.py: Not listed in README.md, questionable utility + # - bin/zmq-recv.py: Not listed in README.md, questionable utility +} + +pkg_postinst() { + # Optfeature descriptions from copyparty/svchub.py:SvcHub._feature_test() + optfeature "sessions and file/media indexing" dev-lang/python[sqlite] + optfeature "image thumbnails (plenty fast)" dev-python/pillow + #optfeature "image thumbnails (faster, eats more ram)" vips # pyvips not packaged (yet) + optfeature "create thumbnails as webp files" dev-python/pillow[webp] + optfeature "transcode audio, create spectrograms, video thumbnails, \ +good-but-slow image thumbnails, read audio/media tags" media-video/ffmpeg + optfeature "read audio tags (ffprobe is better but slower)" media-libs/mutagen + optfeature "secure password hashing (advanced users only)" dev-python/argon2-cffi + optfeature "send zeromq messages from event-hooks" dev-python/pyzmq + optfeature "read .heif images with pillow (rarely useful)" dev-python/pillow-heif + optfeature "read .avif images with pillow (rarely useful)" dev-python/pillow[avif] + #optfeature "read RAW images" rawpy # rawpy not packaged (yet) +} diff --git a/www-servers/copyparty/metadata.xml b/www-servers/copyparty/metadata.xml new file mode 100644 index 0000000000..c8a2aa852a --- /dev/null +++ b/www-servers/copyparty/metadata.xml @@ -0,0 +1,11 @@ + + + + + esteve.varela@gmail.com + Esteve Varela Colominas + + + 9001/copyparty + +