From 307af8fd5a3e74ebcb64ac5bbe57493b59ead233 Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Fri, 14 Oct 2022 21:04:20 +0200 Subject: feat: shamelessly copy pkgkit from sr.ht-apkbuilds Copy some code from sourcehut's alpine build[0] to build my own packages. [0]: https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds --- pkgs/gallery-dl/APKBUILD | 42 +++++++++++++++++ pkgs/genpass/APKBUILD | 54 ++++++++++++++++++++++ pkgs/genpass/genpass.nginx.conf | 4 ++ pkgs/jsonpickle/APKBUILD | 43 +++++++++++++++++ pkgs/jsonpickle/tests.patch | 15 ++++++ pkgs/midr/APKBUILD | 51 ++++++++++++++++++++ pkgs/midr/midr.confd | 2 + pkgs/midr/midr.initd | 21 +++++++++ pkgs/midr/midr.pre-install | 9 ++++ pkgs/nextcloud-api-wrapper/APKBUILD | 26 +++++++++++ pkgs/reddit-nextcloud-importer/APKBUILD | 47 +++++++++++++++++++ .../reddit-nextcloud-importer.confd | 7 +++ .../reddit-nextcloud-importer.initd | 18 ++++++++ .../reddit-nextcloud-importer.pre-install | 9 ++++ 14 files changed, 348 insertions(+) create mode 100644 pkgs/gallery-dl/APKBUILD create mode 100644 pkgs/genpass/APKBUILD create mode 100644 pkgs/genpass/genpass.nginx.conf create mode 100644 pkgs/jsonpickle/APKBUILD create mode 100644 pkgs/jsonpickle/tests.patch create mode 100644 pkgs/midr/APKBUILD create mode 100644 pkgs/midr/midr.confd create mode 100644 pkgs/midr/midr.initd create mode 100644 pkgs/midr/midr.pre-install create mode 100644 pkgs/nextcloud-api-wrapper/APKBUILD create mode 100644 pkgs/reddit-nextcloud-importer/APKBUILD create mode 100644 pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.confd create mode 100644 pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.initd create mode 100644 pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.pre-install (limited to 'pkgs') diff --git a/pkgs/gallery-dl/APKBUILD b/pkgs/gallery-dl/APKBUILD new file mode 100644 index 0000000..e503ca3 --- /dev/null +++ b/pkgs/gallery-dl/APKBUILD @@ -0,0 +1,42 @@ +# Contributor: Hoang Nguyen +# Maintainer: Hoang Nguyen +pkgname=gallery-dl +pkgver=1.23.2 +pkgrel=0 +pkgdesc="CLI tool to download image galleries" +url="https://github.com/mikf/gallery-dl" +arch="noarch" +license="GPL-2.0-or-later" +option="!check" #check requires docker +depends=" + py3-requests + python3 + " +makedepends="py3-setuptools" +checkdepends="py3-pytest yt-dlp" +subpackages=" + $pkgname-doc + $pkgname-bash-completion + $pkgname-zsh-completion + $pkgname-fish-completion + " +source="$pkgname-$pkgver.tar.gz::https://github.com/mikf/gallery-dl/archive/v$pkgver.tar.gz" + +build() { + python3 setup.py build + + make man completion +} + +package() { + python3 setup.py install --prefix=/usr --root="$pkgdir" + + # Install fish completion to the correct directory + rm -r "$pkgdir"/usr/share/fish/vendor_completions.d + install -Dm644 data/completion/gallery-dl.fish \ + -t "$pkgdir"/usr/share/fish/completions +} + +sha512sums=" +75defb234faf0467e5a957594a58a02cfc75180d63a4b2c24d84061d326fbb46f08ad3230b72adf525f1ba82621963564c556047d4aa06c16cc5124ecd8c075f gallery-dl-1.23.2.tar.gz +" diff --git a/pkgs/genpass/APKBUILD b/pkgs/genpass/APKBUILD new file mode 100644 index 0000000..3c74124 --- /dev/null +++ b/pkgs/genpass/APKBUILD @@ -0,0 +1,54 @@ +# Maintainer: Gabriel Arakaki Giovanini +pkgname=genpass +pkgver=0.1.0 +pkgrel=0 +pkgdesc="Website password generator in wasm" +url="https://git.sr.ht/~gabrielgio/genpass" +arch="all" +license="MIT" +depends="" +makedepends=" + curl + build-base + firefox + make + npm + cargo + openssl-dev + bzip2-dev +" +builddir="$srcdir/$pkgname-$pkgver/" +subpackages="$pkgname-nginx:_nginx" + +source=" + https://artifacts.gabrielgio.me/$pkgname/$pkgname-$pkgver.tar.gz + $pkgname.nginx.conf +" + +build() { + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --quiet -y + source $HOME/.cargo/env + curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh + make +} + +check() { + make test +} + +_nginx() { + depends="nginx" + pkgdesc="nginx configuration for $pkgname" + install -Dm644 "$srcdir"/"$package"/"$pkgname".nginx.conf \ + "$subpkgdir"/etc/nginx/http.d/"$pkgname".nginx.conf +} + +package() { + mkdir -p "$pkgdir"/var/www + cp -dr public "$pkgdir"/var/www/"$pkgname" +} + +sha512sums=" +1b3079701557f97a0380dcfb4d67e7b96fb340a1c5f9b822a718a4c68b638ad09ba33afe33babc8bd4454390d128ed0b55bb1cd7aa513ced90fe443cddf022d1 genpass-0.1.0.tar.gz +6e6b9d80b26006efd5b6e368bd3925425b2080bf88dca38c91a9dd8a1db2b3774b2cb8ecba67ac01d2c822f0ad75106d6e103cc3371076f3f40232dd38b57fd4 genpass.nginx.conf +" diff --git a/pkgs/genpass/genpass.nginx.conf b/pkgs/genpass/genpass.nginx.conf new file mode 100644 index 0000000..a11fd3b --- /dev/null +++ b/pkgs/genpass/genpass.nginx.conf @@ -0,0 +1,4 @@ +server { + server_name genpass.lan; + root /var/www/genpass; +} diff --git a/pkgs/jsonpickle/APKBUILD b/pkgs/jsonpickle/APKBUILD new file mode 100644 index 0000000..6cfc40e --- /dev/null +++ b/pkgs/jsonpickle/APKBUILD @@ -0,0 +1,43 @@ +# Maintainer: +pkgname=py3-jsonpickle +pkgver=2.2.0 +pkgrel=0 +pkgdesc="Serializing any arbitrary object graph into JSON" +url="https://pypi.python.org/pypi/jsonpickle/" +arch="noarch" +license="BSD-3-Clause" +depends="python3 py3-numpy py3-pandas" +makedepends="py3-setuptools py3-setuptools_scm" +checkdepends="py3-pytest" +source="https://files.pythonhosted.org/packages/source/j/jsonpickle/jsonpickle-$pkgver.tar.gz + tests.patch + " +builddir="$srcdir/jsonpickle-$pkgver" + +replaces="py-jsonpickle" # Backwards compatibility +provides="py-jsonpickle=$pkgver-r$pkgrel" # Backwards compatibility + +prepare() { + default_prepare + + sed -e '/setuptools_scm/d' \ + -e "/^\[metadata\]/a verison = $pkgver" \ + -i setup.cfg +} + +build() { + python3 setup.py build +} + +check() { + PYTHONPATH=$PWD/build/lib pytest-3 -c /dev/null +} + +package() { + python3 setup.py install --prefix=/usr --root="$pkgdir" +} + +sha512sums=" +b6cb35316e32f38875cbfa3784a3930f669d4ea730ead6117242070590647987383e9f933c193b8c246c40dba87ad56600a65db89c45c18a790b3c1f9232b245 jsonpickle-2.2.0.tar.gz +8df533695556bc7b329211dfbb5ad667fbd8f9b569721a054f9dead9402ac365666f50ff4343feda536e679a58f1244708ab10fa2f6f8b33b2469dfdc57c576c tests.patch +" diff --git a/pkgs/jsonpickle/tests.patch b/pkgs/jsonpickle/tests.patch new file mode 100644 index 0000000..99d78af --- /dev/null +++ b/pkgs/jsonpickle/tests.patch @@ -0,0 +1,15 @@ +diff --git a/jsonpickle/pickler.py b/jsonpickle/pickler.py +index ce64592..62ba575 100644 +--- a/jsonpickle/pickler.py ++++ b/jsonpickle/pickler.py +@@ -462,6 +462,9 @@ class Pickler(object): + if has_getinitargs: + data[tags.INITARGS] = self._flatten(obj.__getinitargs__()) + ++ if type(obj).__name__ == 'TextIOWrapper': ++ return None ++ + if has_getstate: + try: + state = obj.__getstate__() + diff --git a/pkgs/midr/APKBUILD b/pkgs/midr/APKBUILD new file mode 100644 index 0000000..b985257 --- /dev/null +++ b/pkgs/midr/APKBUILD @@ -0,0 +1,51 @@ +# Maintainer: Gabriel Arakaki Giovanini +pkgname=midr +pkgver=0.1.1 +pkgrel=3 +pkgdesc="yt-dlp simple frontend" +url="https://git.sr.ht/~gabrielgio/midr" +arch="x86_64" +license="MIT" +depends=" + yt-dlp + ffmpeg +" +makedepends=" + go +" +builddir="$srcdir/$pkgname-v$pkgver/" +install="$pkgname.pre-install" +subpackages="$pkgname-openrc" +source=" + ${pkgname}-${pkgver}.tar.gz::https://artifacts.gabrielgio.me/${pkgname}/${pkgname}-v${pkgver}.tar.gz + midr.initd + midr.confd +" + +build() { + go mod vendor + go build \ + -trimpath \ + -mod=vendor \ + -ldflags="-X 'main.Version=${pkgver}'" \ + . +} + +package() { + + install -Dm755 "$pkgname" "$pkgdir"/usr/lib/"$pkgname"/"$pkgname" + + mkdir -p "$pkgdir"/usr/bin + ln -s /usr/lib/"$pkgname"/"$pkgname" "$pkgdir"/usr/bin/"$pkgname" + + install -m755 -D "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname +} + +sha512sums=" +a114bfe718d95ad5157aa55870b6bceb61dfcea7e0cb5d76b2ecd3b29a266d1c1e8c1204a4020da798a8bd24210b3eccdf1779311b524897458be511652692ba midr-0.1.1.tar.gz +b540b2a8210ef525226ca798f39866bebcd60e2c17296e4d256dc6e8e887f37f493835c4e9f25c5ef7e6cee3e903f91afdbf2abf8bcb903c1a485c89b1e85411 midr.initd +eaa355698e89b978c2158360802fa7ced7ead961187a0145af862fac09704b73d4e22e906a280c87e2280d2567dde0644382c5b226cb18d4165750a0a029d79f midr.confd +" diff --git a/pkgs/midr/midr.confd b/pkgs/midr/midr.confd new file mode 100644 index 0000000..79693ed --- /dev/null +++ b/pkgs/midr/midr.confd @@ -0,0 +1,2 @@ +datadir="/var/lib/midr" +opts="-p" diff --git a/pkgs/midr/midr.initd b/pkgs/midr/midr.initd new file mode 100644 index 0000000..20a069f --- /dev/null +++ b/pkgs/midr/midr.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run + +# Sample init.d file for alpine linux. + +name="midr" +command="/usr/bin/$name" +command_user=www-data:www-data +command_args="-d ${datadir} ${opts}" +command_background="yes" + +start_stop_daemon_args="--user www-data:www-data" +pidfile="/run/$name.pid" + +depend() { + need net + after firewall +} + +start_pre() { + checkpath -d -o $command_user "$datadir" +} diff --git a/pkgs/midr/midr.pre-install b/pkgs/midr/midr.pre-install new file mode 100644 index 0000000..74f1b59 --- /dev/null +++ b/pkgs/midr/midr.pre-install @@ -0,0 +1,9 @@ +#!/bin/sh + +user=www-data +group=www-data + +addgroup -S $group 2>/dev/null +adduser -S -D -h /var/lib/$user -s /sbin/nologin -G $group -g $user $user 2>/dev/null + +exit 0 diff --git a/pkgs/nextcloud-api-wrapper/APKBUILD b/pkgs/nextcloud-api-wrapper/APKBUILD new file mode 100644 index 0000000..4b3bafe --- /dev/null +++ b/pkgs/nextcloud-api-wrapper/APKBUILD @@ -0,0 +1,26 @@ +# Maintainer: Gabriel Arakaki Giovanini +pkgname=py3-nextcloud-api-wrapper +_pkgorig=nextcloud-API +pkgver=0.2.3 +pkgrel=0 +pkgdesc="Python wrapper for NextCloud api" +url="https://github.com/luffah/nextcloud-API" +arch="noarch" +license="GPL-3.0" +option="!check" #check requires docker +depends="python3 py3-requests" +makedepends="python3-dev py3-setuptools_scm" +source="$pkgname-$pkgver.tar.gz::https://github.com/luffah/nextcloud-API/archive/refs/tags/$pkgver.tar.gz" +builddir="$srcdir/$_pkgorig-$pkgver" + +build() { + python3 setup.py build +} + +package() { + python3 setup.py install --prefix=/usr --root="$pkgdir" +} + +sha512sums=" +71200082db3ca9069284931123fa184921c1d8ae0037d51763e9146a1aabac33c791fbcb766071921718fc8aefb32ca403e6c80c4c3890e37699d10877dbb6df py3-nextcloud-api-wrapper-0.2.3.tar.gz +" diff --git a/pkgs/reddit-nextcloud-importer/APKBUILD b/pkgs/reddit-nextcloud-importer/APKBUILD new file mode 100644 index 0000000..b4ea7fa --- /dev/null +++ b/pkgs/reddit-nextcloud-importer/APKBUILD @@ -0,0 +1,47 @@ +# Maintainer: Gabriel Arakaki Giovanini +pkgname=reddit-nextcloud-importer +pkgver=0.1.1 +pkgrel=0 +pkgdesc="A process to import images and videos from saved post on reddit to a instance of Nextcloud." +url="https://git.sr.ht/~gabrielgio/reddit-nextcloud-importer" +arch="noarch" +license="Apache-2.0" +depends=" + python3 + py3-requests + gallery-dl + py3-jsonpickle + py3-nextcloud-api-wrapper + py3-praw +" +makedepends="python3-dev py3-setuptools_scm" +builddir="$srcdir/$pkgname-$pkgver" +install="$pkgname.pre-install" +subpackages="$pkgname-openrc" +source="$pkgname-$pkgver.tar.gz::https://artifacts.gabrielgio.me/$pkgname/$pkgname-$pkgver.tar.gz + $pkgname.initd + $pkgname.confd" +provides="py3-reddit-nextcloud-importer=$pkgver-r$pkgrel" +# TODO: requires many many many dependencies +options="!check" + + +build() { + python3 setup.py build +} + +package() { + # install scripts + install -m755 -D "$srcdir"/$pkgname.initd \ + "$pkgdir"/etc/init.d/$pkgname + install -m644 -D "$srcdir"/$pkgname.confd \ + "$pkgdir"/etc/conf.d/$pkgname + + python3 setup.py install --prefix=/usr --root="$pkgdir" +} + +sha512sums=" +dd983f438f7750d089f87623d183c130c17cdb0850e875993a905e59306c503e7340bdedb67c0a0ab36f50469a0d711733cdc46182e2ce8269c3db0a5996c841 reddit-nextcloud-importer-0.1.1.tar.gz +bccdb30b9a9149647ef11bbeb50fcc169f5da7b9d445d1aa981751dfe121c9df834379ce787899bcf070eac68d5f39995e6bfa647c5e004cbc592e481916a938 reddit-nextcloud-importer.initd +64e63e65506478f5b9ad89b84539c8e4310e9f0239278d8776dae26ff60eee5f21621cc665e343a1f92e4705e2f95308d2108cf16012a5c9d8cbc5c20c89eb89 reddit-nextcloud-importer.confd +" diff --git a/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.confd b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.confd new file mode 100644 index 0000000..ad77d8b --- /dev/null +++ b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.confd @@ -0,0 +1,7 @@ +client_id="" +client_secret="" +reddit_username="" +reddit_password="" +nextcloud_host="" +nextcloud_username="" +nextcloud_password="" diff --git a/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.initd b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.initd new file mode 100644 index 0000000..b78cf29 --- /dev/null +++ b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.initd @@ -0,0 +1,18 @@ +#!/sbin/openrc-run +supervisor="supervise-daemon" + +name="reddit-nextcloud-importer" +command="/usr/bin/python3" +command_args="-m reddit-nextcloud-importer -c ${client_id} -s ${client_secret} -u ${reddit_username} -p ${reddit_password} -P ${nextcloud_password} -U ${nextcloud_username} -o ${nextcloud_host}" +command_background="yes" + +#output_log="/var/log/$name/$name.log" +#error_log="/var/log/$name/$name.err" +supervise_daemon_args="--user www-data:www-data" +pidfile="/run/$name.pid" + + +depend() { + use net +} + diff --git a/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.pre-install b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.pre-install new file mode 100644 index 0000000..74f1b59 --- /dev/null +++ b/pkgs/reddit-nextcloud-importer/reddit-nextcloud-importer.pre-install @@ -0,0 +1,9 @@ +#!/bin/sh + +user=www-data +group=www-data + +addgroup -S $group 2>/dev/null +adduser -S -D -h /var/lib/$user -s /sbin/nologin -G $group -g $user $user 2>/dev/null + +exit 0 -- cgit v1.2.3