~dricottone/huttese-apk

fcdbf827885021e41c64080d693d8387f9c70498 — Dominic Ricottone 2 years ago 4bbaacb
Reshaping repo

The repo is designed for use with an existing builds.sr.ht service.
Besides lacking that, I am more interested in a containerized workflow
powered by a Makefile. Package source code will live in `pkgsrc/`,
packages will be built into `pkg/`, and packaging keys will be
generated into `keys/`.

Alos trimmed the packages down to what I will build.
206 files changed, 0 insertions(+), 2940 deletions(-)

D README.md
D build-edge.yml
D build.yml
D pkgkit
R sr.ht/builds.sr.ht/APKBUILD => pkgsrc/builds.sr.ht/APKBUILD
R sr.ht/builds.sr.ht/builds.sr.ht-api.confd => pkgsrc/builds.sr.ht/builds.sr.ht-api.confd
R sr.ht/builds.sr.ht/builds.sr.ht-api.initd => pkgsrc/builds.sr.ht/builds.sr.ht-api.initd
R sr.ht/builds.sr.ht/builds.sr.ht-worker.confd => pkgsrc/builds.sr.ht/builds.sr.ht-worker.confd
R sr.ht/builds.sr.ht/builds.sr.ht-worker.initd => pkgsrc/builds.sr.ht/builds.sr.ht-worker.initd
R sr.ht/builds.sr.ht/builds.sr.ht.confd => pkgsrc/builds.sr.ht/builds.sr.ht.confd
R sr.ht/builds.sr.ht/builds.sr.ht.gunicorn.conf.py => pkgsrc/builds.sr.ht/builds.sr.ht.gunicorn.conf.py
R sr.ht/builds.sr.ht/builds.sr.ht.initd => pkgsrc/builds.sr.ht/builds.sr.ht.initd
R sr.ht/builds.sr.ht/builds.sr.ht.post-upgrade => pkgsrc/builds.sr.ht/builds.sr.ht.post-upgrade
R sr.ht/builds.sr.ht/builds.sr.ht.pre-install => pkgsrc/builds.sr.ht/builds.sr.ht.pre-install
R sr.ht/git.sr.ht/APKBUILD => pkgsrc/git.sr.ht/APKBUILD
R sr.ht/git.sr.ht/git.sr.ht-api.confd => pkgsrc/git.sr.ht/git.sr.ht-api.confd
R sr.ht/git.sr.ht/git.sr.ht-api.initd => pkgsrc/git.sr.ht/git.sr.ht-api.initd
R sr.ht/git.sr.ht/git.sr.ht-webhooks.confd => pkgsrc/git.sr.ht/git.sr.ht-webhooks.confd
R sr.ht/git.sr.ht/git.sr.ht-webhooks.initd => pkgsrc/git.sr.ht/git.sr.ht-webhooks.initd
R sr.ht/git.sr.ht/git.sr.ht.confd => pkgsrc/git.sr.ht/git.sr.ht.confd
R sr.ht/dispatch.sr.ht/dispatch.sr.ht.gunicorn.conf.py => pkgsrc/git.sr.ht/git.sr.ht.gunicorn.conf.py
R sr.ht/git.sr.ht/git.sr.ht.initd => pkgsrc/git.sr.ht/git.sr.ht.initd
R sr.ht/git.sr.ht/git.sr.ht.post-install => pkgsrc/git.sr.ht/git.sr.ht.post-install
R sr.ht/git.sr.ht/git.sr.ht.post-upgrade => pkgsrc/git.sr.ht/git.sr.ht.post-upgrade
R sr.ht/lists.sr.ht/APKBUILD => pkgsrc/lists.sr.ht/APKBUILD
R sr.ht/lists.sr.ht/lists.sr.ht-api.confd => pkgsrc/lists.sr.ht/lists.sr.ht-api.confd
R sr.ht/lists.sr.ht/lists.sr.ht-api.initd => pkgsrc/lists.sr.ht/lists.sr.ht-api.initd
R sr.ht/lists.sr.ht/lists.sr.ht-lmtp.confd => pkgsrc/lists.sr.ht/lists.sr.ht-lmtp.confd
R sr.ht/lists.sr.ht/lists.sr.ht-lmtp.initd => pkgsrc/lists.sr.ht/lists.sr.ht-lmtp.initd
R sr.ht/lists.sr.ht/lists.sr.ht-process.confd => pkgsrc/lists.sr.ht/lists.sr.ht-process.confd
R sr.ht/lists.sr.ht/lists.sr.ht-process.initd => pkgsrc/lists.sr.ht/lists.sr.ht-process.initd
R sr.ht/lists.sr.ht/lists.sr.ht-webhooks.confd => pkgsrc/lists.sr.ht/lists.sr.ht-webhooks.confd
R sr.ht/lists.sr.ht/lists.sr.ht-webhooks.initd => pkgsrc/lists.sr.ht/lists.sr.ht-webhooks.initd
R sr.ht/lists.sr.ht/lists.sr.ht.confd => pkgsrc/lists.sr.ht/lists.sr.ht.confd
R sr.ht/git.sr.ht/git.sr.ht.gunicorn.conf.py => pkgsrc/lists.sr.ht/lists.sr.ht.gunicorn.conf.py
R sr.ht/lists.sr.ht/lists.sr.ht.initd => pkgsrc/lists.sr.ht/lists.sr.ht.initd
R sr.ht/lists.sr.ht/lists.sr.ht.post-install => pkgsrc/lists.sr.ht/lists.sr.ht.post-install
R sr.ht/lists.sr.ht/lists.sr.ht.post-upgrade => pkgsrc/lists.sr.ht/lists.sr.ht.post-upgrade
R sr.ht/meta.sr.ht/APKBUILD => pkgsrc/meta.sr.ht/APKBUILD
R sr.ht/meta.sr.ht/meta.sr.ht-api.confd => pkgsrc/meta.sr.ht/meta.sr.ht-api.confd
R sr.ht/meta.sr.ht/meta.sr.ht-api.initd => pkgsrc/meta.sr.ht/meta.sr.ht-api.initd
R sr.ht/meta.sr.ht/meta.sr.ht-webhooks.confd => pkgsrc/meta.sr.ht/meta.sr.ht-webhooks.confd
R sr.ht/meta.sr.ht/meta.sr.ht-webhooks.initd => pkgsrc/meta.sr.ht/meta.sr.ht-webhooks.initd
R sr.ht/meta.sr.ht/meta.sr.ht.confd => pkgsrc/meta.sr.ht/meta.sr.ht.confd
R sr.ht/hg.sr.ht/hg.sr.ht.gunicorn.conf.py => pkgsrc/meta.sr.ht/meta.sr.ht.gunicorn.conf.py
R sr.ht/meta.sr.ht/meta.sr.ht.initd => pkgsrc/meta.sr.ht/meta.sr.ht.initd
R sr.ht/meta.sr.ht/meta.sr.ht.post-install => pkgsrc/meta.sr.ht/meta.sr.ht.post-install
R sr.ht/meta.sr.ht/meta.sr.ht.post-upgrade => pkgsrc/meta.sr.ht/meta.sr.ht.post-upgrade
R sr.ht/py3-amqp/APKBUILD => pkgsrc/py3-amqp/APKBUILD
R sr.ht/py3-ansi2html/APKBUILD => pkgsrc/py3-ansi2html/APKBUILD
R sr.ht/py3-anyjson/APKBUILD => pkgsrc/py3-anyjson/APKBUILD
R sr.ht/py3-asyncpg/APKBUILD => pkgsrc/py3-asyncpg/APKBUILD
R sr.ht/py3-billiard/APKBUILD => pkgsrc/py3-billiard/APKBUILD
R sr.ht/py3-case/APKBUILD => pkgsrc/py3-case/APKBUILD
R sr.ht/py3-celery/7446.patch => pkgsrc/py3-celery/7446.patch
R sr.ht/py3-celery/APKBUILD => pkgsrc/py3-celery/APKBUILD
R sr.ht/py3-click-didyoumean/APKBUILD => pkgsrc/py3-click-didyoumean/APKBUILD
R sr.ht/py3-click-repl/APKBUILD => pkgsrc/py3-click-repl/APKBUILD
R sr.ht/py3-colour/APKBUILD => pkgsrc/py3-colour/APKBUILD
R sr.ht/py3-colour/setup.cfg => pkgsrc/py3-colour/setup.cfg
R sr.ht/py3-colour/setup.py => pkgsrc/py3-colour/setup.py
R sr.ht/py3-emailthreads/APKBUILD => pkgsrc/py3-emailthreads/APKBUILD
R sr.ht/py3-furl/APKBUILD => pkgsrc/py3-furl/APKBUILD
R sr.ht/py3-humanize/APKBUILD => pkgsrc/py3-humanize/APKBUILD
R sr.ht/py3-infinity/APKBUILD => pkgsrc/py3-infinity/APKBUILD
R sr.ht/py3-intervals/APKBUILD => pkgsrc/py3-intervals/APKBUILD
R sr.ht/py3-kombu/APKBUILD => pkgsrc/py3-kombu/APKBUILD
R sr.ht/py3-minio/APKBUILD => pkgsrc/py3-minio/APKBUILD
R sr.ht/py3-mistletoe/APKBUILD => pkgsrc/py3-mistletoe/APKBUILD
R sr.ht/py3-orderedmultidict/APKBUILD => pkgsrc/py3-orderedmultidict/APKBUILD
R sr.ht/py3-pgpy/APKBUILD => pkgsrc/py3-pgpy/APKBUILD
R sr.ht/py3-pygments/0001-lexers-add-Hare.patch => pkgsrc/py3-pygments/0001-lexers-add-Hare.patch
R sr.ht/py3-pygments/APKBUILD => pkgsrc/py3-pygments/APKBUILD
R sr.ht/py3-scmsrht/APKBUILD => pkgsrc/py3-scmsrht/APKBUILD
R sr.ht/py3-sqlalchemy-utils/APKBUILD => pkgsrc/py3-sqlalchemy-utils/APKBUILD
R sr.ht/py3-srht/APKBUILD => pkgsrc/py3-srht/APKBUILD
R sr.ht/py3-sshpubkeys/APKBUILD => pkgsrc/py3-sshpubkeys/APKBUILD
R sr.ht/py3-vine/APKBUILD => pkgsrc/py3-vine/APKBUILD
R sr.ht/py3-wcag-contrast-ratio/APKBUILD => pkgsrc/py3-wcag-contrast-ratio/APKBUILD
R sr.ht/py3-zxcvbn/APKBUILD => pkgsrc/py3-zxcvbn/APKBUILD
R sr.ht/todo.sr.ht/APKBUILD => pkgsrc/todo.sr.ht/APKBUILD
R sr.ht/todo.sr.ht/todo.sr.ht-api.confd => pkgsrc/todo.sr.ht/todo.sr.ht-api.confd
R sr.ht/todo.sr.ht/todo.sr.ht-api.initd => pkgsrc/todo.sr.ht/todo.sr.ht-api.initd
R sr.ht/todo.sr.ht/todo.sr.ht-lmtp.confd => pkgsrc/todo.sr.ht/todo.sr.ht-lmtp.confd
R sr.ht/todo.sr.ht/todo.sr.ht-lmtp.initd => pkgsrc/todo.sr.ht/todo.sr.ht-lmtp.initd
R sr.ht/todo.sr.ht/todo.sr.ht-webhooks.confd => pkgsrc/todo.sr.ht/todo.sr.ht-webhooks.confd
R sr.ht/todo.sr.ht/todo.sr.ht-webhooks.initd => pkgsrc/todo.sr.ht/todo.sr.ht-webhooks.initd
R sr.ht/todo.sr.ht/todo.sr.ht.confd => pkgsrc/todo.sr.ht/todo.sr.ht.confd
R sr.ht/hub.sr.ht/hub.sr.ht.gunicorn.conf.py => pkgsrc/todo.sr.ht/todo.sr.ht.gunicorn.conf.py
R sr.ht/todo.sr.ht/todo.sr.ht.initd => pkgsrc/todo.sr.ht/todo.sr.ht.initd
R sr.ht/todo.sr.ht/todo.sr.ht.post-install => pkgsrc/todo.sr.ht/todo.sr.ht.post-install
R sr.ht/todo.sr.ht/todo.sr.ht.post-upgrade => pkgsrc/todo.sr.ht/todo.sr.ht.post-upgrade
D sr.ht/alertmanager-irc-relay/APKBUILD
D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.confd
D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.initd
D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.pre-install
D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.yml
D sr.ht/chartsrv/APKBUILD
D sr.ht/chartsrv/chartsrv.confd
D sr.ht/chartsrv/chartsrv.initd
D sr.ht/chartsrv/chartsrv.pre-install
D sr.ht/dispatch.sr.ht/APKBUILD
D sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd
D sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd
D sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-install
D sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-upgrade
D sr.ht/drawterm-sourcehut/APKBUILD
D sr.ht/drawterm-sourcehut/respect-env.patch
D sr.ht/gamja/0001-Add-custom-chat.sr.ht-noscript-page.patch
D sr.ht/gamja/0001-Add-sourcehut-branding-to-chat.sr.ht.patch
D sr.ht/gamja/APKBUILD
D sr.ht/git-send-email.io/APKBUILD
D sr.ht/git-send-email.io/git-send-email.io.init
D sr.ht/git-send-email.io/git-send-email.io.post-install
D sr.ht/go-msgauth/APKBUILD
D sr.ht/go-msgauth/dkim-milter.confd
D sr.ht/go-msgauth/dkim-milter.initd
D sr.ht/go-msgauth/go-msgauth.pre-install
D sr.ht/hg-evolve/APKBUILD
D sr.ht/hg.sr.ht/APKBUILD
D sr.ht/hg.sr.ht/hg.sr.ht-api.confd
D sr.ht/hg.sr.ht/hg.sr.ht-api.initd
D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd
D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd
D sr.ht/hg.sr.ht/hg.sr.ht.confd
D sr.ht/hg.sr.ht/hg.sr.ht.initd
D sr.ht/hg.sr.ht/hg.sr.ht.post-install
D sr.ht/hg.sr.ht/hg.sr.ht.post-upgrade
D sr.ht/hub.sr.ht/APKBUILD
D sr.ht/hub.sr.ht/hub.sr.ht.confd
D sr.ht/hub.sr.ht/hub.sr.ht.initd
D sr.ht/hub.sr.ht/hub.sr.ht.post-install
D sr.ht/hub.sr.ht/hub.sr.ht.post-upgrade
D sr.ht/legacy.sr.ht-shim/APKBUILD
D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.confd
D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.initd
D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.post-install
D sr.ht/lists.sr.ht/lists.sr.ht.gunicorn.conf.py
D sr.ht/man.sr.ht/APKBUILD
D sr.ht/man.sr.ht/man.sr.ht.confd
D sr.ht/man.sr.ht/man.sr.ht.gunicorn.conf.py
D sr.ht/man.sr.ht/man.sr.ht.initd
D sr.ht/man.sr.ht/man.sr.ht.post-install
D sr.ht/man.sr.ht/man.sr.ht.post-upgrade
D sr.ht/meta.sr.ht/meta.sr.ht.gunicorn.conf.py
D sr.ht/metrics.sr.ht/APKBUILD
D sr.ht/metrics.sr.ht/metrics.sr.ht.post-upgrade
D sr.ht/pages.sr.ht/APKBUILD
D sr.ht/pages.sr.ht/pages.sr.ht.confd
D sr.ht/pages.sr.ht/pages.sr.ht.initd
D sr.ht/pages.sr.ht/pages.sr.ht.post-install
D sr.ht/paste.sr.ht/APKBUILD
D sr.ht/paste.sr.ht/paste.sr.ht-api.confd
D sr.ht/paste.sr.ht/paste.sr.ht-api.initd
D sr.ht/paste.sr.ht/paste.sr.ht.confd
D sr.ht/paste.sr.ht/paste.sr.ht.gunicorn.conf.py
D sr.ht/paste.sr.ht/paste.sr.ht.initd
D sr.ht/paste.sr.ht/paste.sr.ht.post-install
D sr.ht/paste.sr.ht/paste.sr.ht.post-upgrade
D sr.ht/prom-aggregation-gateway/APKBUILD
D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd
D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd
D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install
D sr.ht/pushgateway/APKBUILD
D sr.ht/pushgateway/pushgateway.confd
D sr.ht/pushgateway/pushgateway.initd
D sr.ht/pushgateway/pushgateway.pre-install
D sr.ht/py3-aiosmtpd/APKBUILD
D sr.ht/py3-atpublic/APKBUILD
D sr.ht/py3-gitlab/APKBUILD
D sr.ht/py3-iso3166/APKBUILD
D sr.ht/py3-mwparserfromhell/APKBUILD
D sr.ht/py3-pydyf/APKBUILD
D sr.ht/py3-stripe/APKBUILD
D sr.ht/py3-unidiff/APKBUILD
D sr.ht/py3-weasyprint/APKBUILD
D sr.ht/rum/APKBUILD
D sr.ht/sachet/APKBUILD
D sr.ht/sachet/sachet.confd
D sr.ht/sachet/sachet.initd
D sr.ht/sachet/sachet.pre-install
D sr.ht/sachet/sachet.yml
D sr.ht/searchhut/APKBUILD
D sr.ht/searchhut/searchhut.pre-install
D sr.ht/searchhut/sh-api.confd
D sr.ht/searchhut/sh-api.initd
D sr.ht/searchhut/sh-web.confd
D sr.ht/searchhut/sh-web.initd
D sr.ht/soju/APKBUILD
D sr.ht/soju/soju.confd
D sr.ht/soju/soju.initd
D sr.ht/soju/soju.pre-install
D sr.ht/sr.ht-nginx/APKBUILD
D sr.ht/sr.ht-uacme/APKBUILD
D sr.ht/sr.ht-uacme/acme-update-certs
D sr.ht/sr.ht-uacme/crontab
D sr.ht/sr.ht-uacme/doas.conf
D sr.ht/sr.ht-uacme/sr.ht-uacme.pre-install
D sr.ht/sr.ht-uacme/uacme.conf
D sr.ht/tlstunnel/APKBUILD
D sr.ht/tlstunnel/tlstunnel.confd
D sr.ht/tlstunnel/tlstunnel.initd
D sr.ht/tlstunnel/tlstunnel.post-install
D sr.ht/tlstunnel/tlstunnel.post-upgrade
D sr.ht/todo.sr.ht/todo.sr.ht.gunicorn.conf.py
D submit-builds
D README.md => README.md +0 -28
@@ 1,28 0,0 @@
These are [Alpine Linux](https://alpinelinux.org) packages for sr.ht and any
dependencies which are not packaged in upstream Alpine Linux. The results are
published in our Alpine repository:

https://mirror.sr.ht/alpine/

Note that some sr.ht packages (meta.sr.ht, python-srht, etc) are automatically
built and published by builds.sr.ht. This process automatically updates the
pkgver and pkgrel, but does not commit it to the repository. If using these
APKBUILDs yourself, be aware that the version numbers here may be outdated.

## Alpine upgrade procedure

When a new Alpine version is released:

1. Update the Alpine version in build.yml
1. Update non-sr.ht packages to latest upstream version, reset pkgrel to 0
1. `./submit-build` everything _except_ for *.sr.ht
1. Update pkgver in *.sr.ht packages, commit & push & run `./submit-build`
1. Update build manifests upstream for *.sr.ht
1. Run updates on non-critical boxen
1. Run updates on all boxen

**Tips**

- Upgrade systems with apk upgrade -a
- Update the python version in the Makefiles
- Update the python version with nginx

D build-edge.yml => build-edge.yml +0 -30
@@ 1,30 0,0 @@
image: alpine/edge
repositories:
  sr.ht: >
    https://mirror.sr.ht/alpine/edge/sr.ht/
    https://mirror.sr.ht/alpine/alpine%40sr.ht.rsa.pub
    alpine@sr.ht.rsa.pub
packages:
  - openssl
  - rsync
environment:
  REPOSITORY: edge
  remote: deploy@mirror.sr.ht
  remote_path: /var/www/mirror.sr.ht/alpine
  packages: []
sources:
  - https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds
secrets:
  - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key
  - d0adc1d4-af78-4852-920f-1134392f5d10 # package signing key
tasks:
  - setup: |
      cd sr.ht-apkbuilds
      ./pkgkit add-repo -s sr.ht ~/.abuild/alpine@sr.ht.rsa
  - build: |
      cd sr.ht-apkbuilds
      ./pkgkit build -cu "${packages[@]}"
  - deploy: |
      cd sr.ht-apkbuilds
      echo "StrictHostKeyChecking=no" >> ~/.ssh/config
      ./pkgkit upload "$remote" "$remote_path" "${packages[@]}"

D build.yml => build.yml +0 -29
@@ 1,29 0,0 @@
image: alpine/3.15
repositories:
  sr.ht: >
    https://mirror.sr.ht/alpine/v3.15/sr.ht/
    https://mirror.sr.ht/alpine/alpine%40sr.ht.rsa.pub
    alpine@sr.ht.rsa.pub
packages:
  - openssl
  - rsync
environment:
  remote: deploy@mirror.sr.ht
  remote_path: /var/www/mirror.sr.ht/alpine
  packages: []
sources:
  - https://git.sr.ht/~sircmpwn/sr.ht-apkbuilds
secrets:
  - fa00a8d3-7b63-42d5-8060-3bb31c3e3018 # ssh deploy key
  - d0adc1d4-af78-4852-920f-1134392f5d10 # package signing key
tasks:
  - setup: |
      cd sr.ht-apkbuilds
      ./pkgkit add-repo -s sr.ht ~/.abuild/alpine@sr.ht.rsa
  - build: |
      cd sr.ht-apkbuilds
      ./pkgkit build -cu "${packages[@]}"
  - deploy: |
      cd sr.ht-apkbuilds
      echo "StrictHostKeyChecking=no" >> ~/.ssh/config
      ./pkgkit upload "$remote" "$remote_path" "${packages[@]}"

D pkgkit => pkgkit +0 -336
@@ 1,336 0,0 @@
#!/bin/sh -eu
usage() {
	printf "%s\n\n" "Usage: $0 [command...] [flags...] [args...]"
	printf "%s\n" "$0 add-repo [-s] <name> <key>"
	printf "\t%s\n" "Trusts <key> and adds the local repo to /etc/apk/repositories"
	printf "\t%s\n\n" "-s: set this key as default in abuild.conf"
	printf "%s\n" "$0 build [-cu] [-v <pkgver>] <packages...>"
	printf "\t%s\n" "Builds packages"
	printf "\t%s\n" "-c: update checksums"
	printf "\t%s\n" "-u: update pkgrel"
	printf "\t%s\n\n" "-v <pkgver>: update pkgver"
	printf "%s\n" "$0 pkgver"
	printf "\t%s\n\n" "Prints the suggested package ver for this directory"
	printf "%s\n" "$0 upload <ssh server> <remote path> <packages...>"
	printf "\t%s\n" "Uploads packages via rsync and updates remote APKINDEX"
}

get_pkgvar() (
	var="$1"
	set +u
	. APKBUILD
	eval 'printf "%s\n" "$'"$var"'"'
)

find_repos() (
	find . -maxdepth 1 -type d -not -name . -not -name .git
)

find_pkg_repo() (
	pkg=$1
	for repo in $(find_repos)
	do
		if [ -d "$repo"/"$pkg" ]
		then
			echo "$repo"
			return 0
		fi
	done
	return 1
)

update_pkgrel() (
	pkg="$1"
	pkgver="$(get_pkgvar pkgver)"
	prev_ver=$(apk search -x "$pkg" | cut -c$((${#pkg}+2))-)
	prev_pkgver=$(printf "%s" "$prev_ver" | cut -d'-' -f1)
	prev_pkgrel=$(printf "%s" "$prev_ver" | cut -d'-' -f2 | cut -d'r' -f2-)
	if [ "$prev_pkgver" == "$pkgver" ]
	then
		pkgrel=$((prev_pkgrel + 1))
		sed -e "s/pkgrel=.*/pkgrel=$pkgrel/" -i APKBUILD
	fi
)

update_pkgver() {
	pkgver="$1"
	prev_pkgver=$(apk search -x ${project} | cut -d '-' -f2)
	sed -e "s/pkgver=.*/pkgver=$pkgver/" -i APKBUILD
	if [ "$prev_pkgver" != "$pkgver" ]
	then
		sed -e "s/pkgrel=.*/pkgrel=0/" -i APKBUILD
	fi
}

add_repo() {
	set_default=0
	while getopts s flag
	do
		case $flag in
			s) set_default=1 ;;
			*) usage && exit 1 ;;
		esac
	done
	shift $((OPTIND-1))
	echo "$@"
	if [ $# -ne 2 ]
	then
		usage
		exit 1
	fi
	repo="$1"
	key="$2"
	mkdir -p ~/packages/$repo
	echo ~/packages/$repo | cat - /etc/apk/repositories > /tmp/repositories
	sudo mv /tmp/repositories /etc/apk/repositories
	if ! [ -f "$key" ]
	then
		echo "Warning: generating new abuild key"
		key="$HOME/.abuild/abuild.rsa"
		mkdir -p $HOME/.abuild
		(
			umask 0007
			openssl genrsa -out "$key" 2048
		)
	fi
	sudo openssl rsa -in $key -pubout \
		-out /etc/apk/keys/$(basename "$key").pub
	if [ $set_default -eq 1 ]
	then
		echo "PACKAGER_PRIVKEY="'"'$key'"' >> \
			~/.abuild/abuild.conf
	fi
}

build() (
	builddeps=0
	checksum=0
	updpkgrel=0
	pkgver=""
	# Disable progress on abuild-apk
	cat <<-"EOF" | sudo tee /usr/local/bin/abuild-apk
	#!/bin/sh
	exec /usr/bin/abuild-apk --no-progress $@
	EOF
	sudo chmod +x /usr/local/bin/abuild-apk
	export PATH=/usr/local/bin:$PATH
	while getopts Rcuv: flag
	do
		case $flag in
			R) builddeps=1 ;;
			c) checksum=1 ;;
			u) updpkgrel=1 ;;
			v) pkgver="$OPTARG" ;;
			*) usage && exit 1 ;;
		esac
	done
	shift $((OPTIND-1))
	if [ $# -eq 0 ]
	then
		echo "No packages specified."
		exit 1
	fi
	for pkg in $@
	do
		repo="$(find_pkg_repo "$pkg")"
		(
			cd "$repo"/"$pkg"
			if [ -n "$pkgver" ]
			then
				update_pkgver "$pkgver"
			fi
			if [ $updpkgrel -eq 1 ]
			then
				update_pkgrel "$pkg"
			fi
			if [ $checksum -eq 1 ]
			then
				abuild checksum
			fi
			if [ $builddeps -eq 1 ]
			then
				abuild -R
			else
				abuild -r
			fi
		)
	done
)

print_pkgver() {
	if [ $# -ne 0 ]
	then
		usage
		exit 1
	fi
	if [ -d .git ]
	then
		set +e
		pkgver=$(git describe --abbrev=0 2>/dev/null)
		if [ $? -ne 0 ]
		then
			pkgver=0
		fi
		set -e
		if ! git describe --exact-match HEAD >/dev/null 2>&1
		then
			cdate=$(git show -s -1 --format='%ci' HEAD)
			cdate=$(echo "$cdate" | cut -d' ' -f1 | sed -e 's/-//g')
			pkgver="${pkgver}_git${cdate}"
		fi
	elif [ -d .hg ]
	then
		pkgver=$(hg id -T '{latesttag}')
		if [ "$(hg id -T '{latesttagdistance}')" -ne 0 ]
		then
			pkgver="$(hg id -T '{latesttag}_hg{sub("-", "", date|shortdate)}')"
		fi
	else
		pkgver=unknown_0000
	fi
	echo "$pkgver"
}

mirror_ver() (
	mirror="$1"
	pkg="$2"
	apk policy "$pkg" | while read -r line
	do
		case "$line" in
			*:)
				ver="${line%:}"
				ver="${ver## }"
				;;
			*$mirror*)
				echo "$ver"
				;;
		esac
	done
)

get_aver() {
	aver="${REPOSITORY:-}"
	if [ ${#aver} -eq 0 ]
	then
		. /etc/os-release
		aver="v$(printf "%s" "$VERSION_ID" | cut -d. -f1-2)"
	fi
	echo "$aver"
}

upload_pkg() (
	repo="$1"
	pkg="$2"
	arch="$(uname -m)"
	aver="$(get_aver)"

	set -x
	path="$remote_path/$aver/$repo/$arch"
	ssh "$remote" mkdir -p "$path"

	url=$(echo "$remote" | cut -d@ -f2)
	prev_ver=$(mirror_ver "$url" "$pkg")

	for ver in $prev_ver
	do
		if [ "$prev_ver" != "none" ]
		then
			ssh "$remote" rm -f "$path/$pkg-$ver.apk"
		fi
	done
	pkgver="$(get_pkgvar pkgver)"
	pkgrel="$(get_pkgvar pkgrel)"

	rsync --blocking-io -rsP \
		~/packages/"$repo/$arch/$pkg-$pkgver-r$pkgrel.apk" "$remote":"$path/"
	set +x
)

update_index() (
	repo="$1"
	arch="$(uname -m)"

	. /etc/os-release
	aver="$(get_aver)"

	path="$remote_path/$aver/$repo/$arch"

	set -x
	ssh "$remote" \
		find "$path" -type f -name '*.apk' -print0 |
		ssh "$remote" xargs -0 apk index \
			--rewrite-arch "$(uname -m)" \
			-x "$path"/APKINDEX.tar.gz \
			-o "$path"/APKINDEX.unsigned.tar.gz
	rsync --blocking-io -rP \
		"$remote:$path/APKINDEX.unsigned.tar.gz" \
		/tmp/APKINDEX.tar.gz
	abuild-sign /tmp/APKINDEX.tar.gz
	rsync --blocking-io -rP /tmp/APKINDEX.tar.gz "$remote:$path/"
	set +x
)

upload() (
	if [ $# -lt 2 ]
	then
		usage
		exit 1
	fi
	remote="$1"
	remote_path="$2"
	shift 2
	if [ $# -eq 0 ]
	then
		echo "No packages specified"
		exit 1
	fi
	repos=""
	for pkg in $@
	do
		repo=$(find_pkg_repo "$pkg")
		if ! echo "$repos" | grep "$repo" >/dev/null
		then
			repos="$repo $repos"
		fi
		(
			cd "$repo"/"$pkg"
			arch="$(get_pkgvar arch)"
			subpkgs="$pkg:_:$arch $(get_pkgvar subpackages)"
			for subpkg in $subpkgs
			do
				name="$(echo "$subpkg" | cut -d':' -f1)"
				upload_pkg "$repo" "$name"
			done
		)
	done
	for repo in $repos
	do
		update_index $repo
	done
)

if [ $# -lt 1 ]
then
	usage
	exit 1
fi
cmd="$1"
shift

case "$cmd" in
	add-repo)
		add_repo "$@"
		;;
	build)
		build "$@"
		;;
	pkgver)
		print_pkgver "$@"
		;;
	upload)
		upload "$@"
		;;
	help|-h)
		usage
		;;
esac

R sr.ht/builds.sr.ht/APKBUILD => pkgsrc/builds.sr.ht/APKBUILD +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht-api.confd => pkgsrc/builds.sr.ht/builds.sr.ht-api.confd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht-api.initd => pkgsrc/builds.sr.ht/builds.sr.ht-api.initd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht-worker.confd => pkgsrc/builds.sr.ht/builds.sr.ht-worker.confd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht-worker.initd => pkgsrc/builds.sr.ht/builds.sr.ht-worker.initd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht.confd => pkgsrc/builds.sr.ht/builds.sr.ht.confd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht.gunicorn.conf.py => pkgsrc/builds.sr.ht/builds.sr.ht.gunicorn.conf.py +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht.initd => pkgsrc/builds.sr.ht/builds.sr.ht.initd +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht.post-upgrade => pkgsrc/builds.sr.ht/builds.sr.ht.post-upgrade +0 -0
R sr.ht/builds.sr.ht/builds.sr.ht.pre-install => pkgsrc/builds.sr.ht/builds.sr.ht.pre-install +0 -0
R sr.ht/git.sr.ht/APKBUILD => pkgsrc/git.sr.ht/APKBUILD +0 -0
R sr.ht/git.sr.ht/git.sr.ht-api.confd => pkgsrc/git.sr.ht/git.sr.ht-api.confd +0 -0
R sr.ht/git.sr.ht/git.sr.ht-api.initd => pkgsrc/git.sr.ht/git.sr.ht-api.initd +0 -0
R sr.ht/git.sr.ht/git.sr.ht-webhooks.confd => pkgsrc/git.sr.ht/git.sr.ht-webhooks.confd +0 -0
R sr.ht/git.sr.ht/git.sr.ht-webhooks.initd => pkgsrc/git.sr.ht/git.sr.ht-webhooks.initd +0 -0
R sr.ht/git.sr.ht/git.sr.ht.confd => pkgsrc/git.sr.ht/git.sr.ht.confd +0 -0
R sr.ht/dispatch.sr.ht/dispatch.sr.ht.gunicorn.conf.py => pkgsrc/git.sr.ht/git.sr.ht.gunicorn.conf.py +0 -0
R sr.ht/git.sr.ht/git.sr.ht.initd => pkgsrc/git.sr.ht/git.sr.ht.initd +0 -0
R sr.ht/git.sr.ht/git.sr.ht.post-install => pkgsrc/git.sr.ht/git.sr.ht.post-install +0 -0
R sr.ht/git.sr.ht/git.sr.ht.post-upgrade => pkgsrc/git.sr.ht/git.sr.ht.post-upgrade +0 -0
R sr.ht/lists.sr.ht/APKBUILD => pkgsrc/lists.sr.ht/APKBUILD +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-api.confd => pkgsrc/lists.sr.ht/lists.sr.ht-api.confd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-api.initd => pkgsrc/lists.sr.ht/lists.sr.ht-api.initd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-lmtp.confd => pkgsrc/lists.sr.ht/lists.sr.ht-lmtp.confd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-lmtp.initd => pkgsrc/lists.sr.ht/lists.sr.ht-lmtp.initd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-process.confd => pkgsrc/lists.sr.ht/lists.sr.ht-process.confd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-process.initd => pkgsrc/lists.sr.ht/lists.sr.ht-process.initd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-webhooks.confd => pkgsrc/lists.sr.ht/lists.sr.ht-webhooks.confd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht-webhooks.initd => pkgsrc/lists.sr.ht/lists.sr.ht-webhooks.initd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht.confd => pkgsrc/lists.sr.ht/lists.sr.ht.confd +0 -0
R sr.ht/git.sr.ht/git.sr.ht.gunicorn.conf.py => pkgsrc/lists.sr.ht/lists.sr.ht.gunicorn.conf.py +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht.initd => pkgsrc/lists.sr.ht/lists.sr.ht.initd +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht.post-install => pkgsrc/lists.sr.ht/lists.sr.ht.post-install +0 -0
R sr.ht/lists.sr.ht/lists.sr.ht.post-upgrade => pkgsrc/lists.sr.ht/lists.sr.ht.post-upgrade +0 -0
R sr.ht/meta.sr.ht/APKBUILD => pkgsrc/meta.sr.ht/APKBUILD +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht-api.confd => pkgsrc/meta.sr.ht/meta.sr.ht-api.confd +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht-api.initd => pkgsrc/meta.sr.ht/meta.sr.ht-api.initd +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht-webhooks.confd => pkgsrc/meta.sr.ht/meta.sr.ht-webhooks.confd +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht-webhooks.initd => pkgsrc/meta.sr.ht/meta.sr.ht-webhooks.initd +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht.confd => pkgsrc/meta.sr.ht/meta.sr.ht.confd +0 -0
R sr.ht/hg.sr.ht/hg.sr.ht.gunicorn.conf.py => pkgsrc/meta.sr.ht/meta.sr.ht.gunicorn.conf.py +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht.initd => pkgsrc/meta.sr.ht/meta.sr.ht.initd +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht.post-install => pkgsrc/meta.sr.ht/meta.sr.ht.post-install +0 -0
R sr.ht/meta.sr.ht/meta.sr.ht.post-upgrade => pkgsrc/meta.sr.ht/meta.sr.ht.post-upgrade +0 -0
R sr.ht/py3-amqp/APKBUILD => pkgsrc/py3-amqp/APKBUILD +0 -0
R sr.ht/py3-ansi2html/APKBUILD => pkgsrc/py3-ansi2html/APKBUILD +0 -0
R sr.ht/py3-anyjson/APKBUILD => pkgsrc/py3-anyjson/APKBUILD +0 -0
R sr.ht/py3-asyncpg/APKBUILD => pkgsrc/py3-asyncpg/APKBUILD +0 -0
R sr.ht/py3-billiard/APKBUILD => pkgsrc/py3-billiard/APKBUILD +0 -0
R sr.ht/py3-case/APKBUILD => pkgsrc/py3-case/APKBUILD +0 -0
R sr.ht/py3-celery/7446.patch => pkgsrc/py3-celery/7446.patch +0 -0
R sr.ht/py3-celery/APKBUILD => pkgsrc/py3-celery/APKBUILD +0 -0
R sr.ht/py3-click-didyoumean/APKBUILD => pkgsrc/py3-click-didyoumean/APKBUILD +0 -0
R sr.ht/py3-click-repl/APKBUILD => pkgsrc/py3-click-repl/APKBUILD +0 -0
R sr.ht/py3-colour/APKBUILD => pkgsrc/py3-colour/APKBUILD +0 -0
R sr.ht/py3-colour/setup.cfg => pkgsrc/py3-colour/setup.cfg +0 -0
R sr.ht/py3-colour/setup.py => pkgsrc/py3-colour/setup.py +0 -0
R sr.ht/py3-emailthreads/APKBUILD => pkgsrc/py3-emailthreads/APKBUILD +0 -0
R sr.ht/py3-furl/APKBUILD => pkgsrc/py3-furl/APKBUILD +0 -0
R sr.ht/py3-humanize/APKBUILD => pkgsrc/py3-humanize/APKBUILD +0 -0
R sr.ht/py3-infinity/APKBUILD => pkgsrc/py3-infinity/APKBUILD +0 -0
R sr.ht/py3-intervals/APKBUILD => pkgsrc/py3-intervals/APKBUILD +0 -0
R sr.ht/py3-kombu/APKBUILD => pkgsrc/py3-kombu/APKBUILD +0 -0
R sr.ht/py3-minio/APKBUILD => pkgsrc/py3-minio/APKBUILD +0 -0
R sr.ht/py3-mistletoe/APKBUILD => pkgsrc/py3-mistletoe/APKBUILD +0 -0
R sr.ht/py3-orderedmultidict/APKBUILD => pkgsrc/py3-orderedmultidict/APKBUILD +0 -0
R sr.ht/py3-pgpy/APKBUILD => pkgsrc/py3-pgpy/APKBUILD +0 -0
R sr.ht/py3-pygments/0001-lexers-add-Hare.patch => pkgsrc/py3-pygments/0001-lexers-add-Hare.patch +0 -0
R sr.ht/py3-pygments/APKBUILD => pkgsrc/py3-pygments/APKBUILD +0 -0
R sr.ht/py3-scmsrht/APKBUILD => pkgsrc/py3-scmsrht/APKBUILD +0 -0
R sr.ht/py3-sqlalchemy-utils/APKBUILD => pkgsrc/py3-sqlalchemy-utils/APKBUILD +0 -0
R sr.ht/py3-srht/APKBUILD => pkgsrc/py3-srht/APKBUILD +0 -0
R sr.ht/py3-sshpubkeys/APKBUILD => pkgsrc/py3-sshpubkeys/APKBUILD +0 -0
R sr.ht/py3-vine/APKBUILD => pkgsrc/py3-vine/APKBUILD +0 -0
R sr.ht/py3-wcag-contrast-ratio/APKBUILD => pkgsrc/py3-wcag-contrast-ratio/APKBUILD +0 -0
R sr.ht/py3-zxcvbn/APKBUILD => pkgsrc/py3-zxcvbn/APKBUILD +0 -0
R sr.ht/todo.sr.ht/APKBUILD => pkgsrc/todo.sr.ht/APKBUILD +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-api.confd => pkgsrc/todo.sr.ht/todo.sr.ht-api.confd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-api.initd => pkgsrc/todo.sr.ht/todo.sr.ht-api.initd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-lmtp.confd => pkgsrc/todo.sr.ht/todo.sr.ht-lmtp.confd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-lmtp.initd => pkgsrc/todo.sr.ht/todo.sr.ht-lmtp.initd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-webhooks.confd => pkgsrc/todo.sr.ht/todo.sr.ht-webhooks.confd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht-webhooks.initd => pkgsrc/todo.sr.ht/todo.sr.ht-webhooks.initd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht.confd => pkgsrc/todo.sr.ht/todo.sr.ht.confd +0 -0
R sr.ht/hub.sr.ht/hub.sr.ht.gunicorn.conf.py => pkgsrc/todo.sr.ht/todo.sr.ht.gunicorn.conf.py +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht.initd => pkgsrc/todo.sr.ht/todo.sr.ht.initd +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht.post-install => pkgsrc/todo.sr.ht/todo.sr.ht.post-install +0 -0
R sr.ht/todo.sr.ht/todo.sr.ht.post-upgrade => pkgsrc/todo.sr.ht/todo.sr.ht.post-upgrade +0 -0
D sr.ht/alertmanager-irc-relay/APKBUILD => sr.ht/alertmanager-irc-relay/APKBUILD +0 -55
@@ 1,55 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=alertmanager-irc-relay
pkgver=0.4.3
pkgrel=1
pkgdesc="Prometheus Alertmanager IRC relay"
url="https://github.com/google/alertmanager-irc-relay"
arch="all"
license="Apache-2.0"
install="$pkgname.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/google/alertmanager-irc-relay/archive/v$pkgver.tar.gz
	alertmanager-irc-relay.confd
	alertmanager-irc-relay.initd
	alertmanager-irc-relay.yml
"
subpackages="$pkgname-openrc"
options="!check" # requires running IRC server

prepare() {
	default_prepare
	go mod vendor
}

build() {
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS" \
		-tags netgo
}

check() {
	go test ./...
}

package() {
	install -Dm755 alertmanager-irc-relay "$pkgdir"/usr/bin/alertmanager-irc-relay

	install -Dm755 "$srcdir"/alertmanager-irc-relay.initd \
		"$pkgdir"/etc/init.d/alertmanager-irc-relay
	install -Dm644 "$srcdir"/alertmanager-irc-relay.confd \
		"$pkgdir"/etc/conf.d/alertmanager-irc-relay

	mkdir -p "$pkgdir"/etc/alertmanager
	install -Dm644 "$srcdir"/alertmanager-irc-relay.yml \
		"$pkgdir"/etc/alertmanager/alertmanager-irc-relay.yml
}

sha512sums="
21b1b811a3705cc17dc31560254e0dc9876407a2c9294f6ba6cdb42cdc3972d61712f393aae328e4c1135ccfd57582d573dbd215d1210d50c9827e7e87c30ffb  alertmanager-irc-relay-0.4.3.tar.gz
43707b80d9baeab8a50ef2489f3bbc61b154b18e2d4ef8be6c7392a8afa27c1884c5f6f121b41fb5095f8cf9d957f4eda98f4fa197774f86a95d3bd930593b1b  alertmanager-irc-relay.confd
4458cea59f5059921da7d609b562e9a74f20f472c320dbaa5382e733cfb18f2d2bc71655f2c574403f1a5047074b1a62e82969eea348e939fbf485bd9e3877c4  alertmanager-irc-relay.initd
646f9241087dd5c595f198b829109c975fb0c637026d59a6a271ae04fe0285744bc527797b171ad3840c543801ebeaad15925f906247de0cf2c86af96b57d9fa  alertmanager-irc-relay.yml
"

D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.confd => sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.confd +0 -4
@@ 1,4 0,0 @@
alertmanager_irc_relay_config_file=/etc/alertmanager/alertmanager-irc-relay.yml

output_log=/var/log/alertmanager-irc-relay.log
error_log=/var/log/alertmanager-irc-relay.log

D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.initd => sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.initd +0 -15
@@ 1,15 0,0 @@
#!/sbin/openrc-run
name="alertmanager-irc-relay"
description="IRC relay for prometheus alertmanager"
supervisor=supervise-daemon
command=/usr/bin/alertmanager-irc-relay
command_args="--config $alertmanager_irc_relay_config_file"
command_user="prometheus:prometheus"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.pre-install => sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.yml => sr.ht/alertmanager-irc-relay/alertmanager-irc-relay.yml +0 -43
@@ 1,43 0,0 @@
# Start the HTTP server receiving alerts from Prometheus Webhook binding to
# this host/port.
#
http_host: localhost
http_port: 8000

# Connect to this IRC host/port.
#
# Note: SSL is enabled by default, use "irc_use_ssl: no" to disable.
irc_host: irc.example.com
irc_port: 7000

# Use this IRC nickname.
irc_nickname: myalertbot
# Password used to identify with NickServ
irc_nickname_password: mynickserv_key
# Use this IRC real name
irc_realname: myrealname

# Optionally pre-join certain channels.
#
# Note: If an alert is sent to a non # pre-joined channel the bot will join
# that channel anyway before sending the notice. Of course this cannot work
# with password-protected channels.
irc_channels:
  - name: "#mychannel"
  - name: "#myprivatechannel"
    password: myprivatechannel_key

# Define how IRC messages should be sent.
#
# Send only one notice when webhook data is received.
# Note: By default a notice is sent for each alert in the webhook data.
notice_once_per_alert_group: no

# Define how IRC messages should be formatted.
#
# The formatting is based on golang's text/template .
notice_template: "Alert {{ .Labels.alertname }} on {{ .Labels.instance }} is {{ .Status }}"
# Note: When sending only one notice per alert group the default
# notice_template is set to
# "Alert {{ .GroupLabels.alertname }} for {{ .GroupLabels.job }} is {{ .Status }}"


D sr.ht/chartsrv/APKBUILD => sr.ht/chartsrv/APKBUILD +0 -43
@@ 1,43 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=chartsrv
pkgver=1.0.2
pkgrel=0
pkgdesc="A web service for generating charts from prometheus data"
url="https://sr.ht/~sircmpwn/chartsrv"
arch="all"
license="MIT"
install="chartsrv.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	chartsrv.confd
	chartsrv.initd
"
subpackages="$pkgname-openrc"

build() {
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 chartsrv "$pkgdir"/usr/bin/chartsrv

	install -Dm644 "$srcdir"/chartsrv.confd \
		"$pkgdir"/etc/conf.d/chartsrv
	install -Dm755 "$srcdir"/chartsrv.initd \
		"$pkgdir"/etc/init.d/chartsrv
}

sha512sums="
3e47605a44484fa21145c878d974b511915dd5de132be41dc7d0e00cb307e78c96bd98d03923adfc2ab8d4dda939954183b3b4856a962d02db54e5e61c6c4ed9  chartsrv-1.0.2.tar.gz
27459c5acb17fbb6f7d536fc21aff7aac1ef13d5c79441242a6d99f818758b053fdf27b294d80336c699b0dec0fc844d870cd5d46469356f3c90f792953da26a  chartsrv.confd
be2c253987df10975a821c26d028919a59d336bd3679fe7cb9c107ec6c494c24f50b35950fd2d38bebaade999284cf77e54a6342caf6cf0d0bab711735987497  chartsrv.initd
"

D sr.ht/chartsrv/chartsrv.confd => sr.ht/chartsrv/chartsrv.confd +0 -5
@@ 1,5 0,0 @@
# Upstream Prometheus source
chartsrv_upstream='https://metrics.sr.ht'

output_log=/var/log/chartsrv.log
error_log=/var/log/chartsrv.log

D sr.ht/chartsrv/chartsrv.initd => sr.ht/chartsrv/chartsrv.initd +0 -15
@@ 1,15 0,0 @@
#!/sbin/openrc-run
name="chartsrv"
description="Web service for rendering charts from Prometheus data"
supervisor=supervise-daemon
command=/usr/bin/chartsrv
command_args="$chartsrv_upstream"
command_user="prometheus:prometheus"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

D sr.ht/chartsrv/chartsrv.pre-install => sr.ht/chartsrv/chartsrv.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/dispatch.sr.ht/APKBUILD => sr.ht/dispatch.sr.ht/APKBUILD +0 -57
@@ 1,57 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=dispatch.sr.ht
pkgver=0.15.33
pkgrel=0
pkgdesc="sr.ht dispatch service"
url="https://git.sr.ht/~sircmpwn/dispatch.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-gunicorn
	py3-pygithub
	py3-srht
	py3-yaml
"
makedepends="py-setuptools nodejs sassc"
subpackages="$pkgname-openrc $pkgname-nginx:_nginx"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	sr.ht-nginx-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/master.tar.gz
	dispatch.sr.ht.confd
	dispatch.sr.ht.initd
	dispatch.sr.ht.gunicorn.conf.py
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/dispatch.sr.ht.initd \
		"$pkgdir"/etc/init.d/dispatch.sr.ht
	install -Dm644 "$srcdir"/dispatch.sr.ht.confd \
		"$pkgdir"/etc/conf.d/dispatch.sr.ht
	install -Dm644 "$srcdir"/dispatch.sr.ht.gunicorn.conf.py \
		"$pkgdir"/etc/sr.ht/dispatch.sr.ht.gunicorn.conf.py

}

_nginx() {
	depends="sr.ht-nginx"
	pkgdesc="nginx configuration for $pkgname"
	install -Dm644 "$srcdir/sr.ht-nginx-master/dispatch.sr.ht.conf" \
		"$subpkgdir"/etc/nginx/http.d/dispatch.sr.ht.conf
}

sha512sums="
b581922de780139a313aa0fe2250aaa8710b33660f58195e8238b88c98437703bc622638563e8142b726dc16e920c9396959a94a6166d723726ed357b116ab6c  dispatch.sr.ht-0.15.33.tar.gz
917bbc9a493f6aa756af3f3597f9edf2e25227efe30f6ab635f99a7d9f4ecd6e9f36a7f2b9b40cc95b6e584dd62e1a0badb46e4ff9d3c3d5ce959455b15a95b6  sr.ht-nginx-0.15.33.tar.gz
ea2cea43b8d48fedd50117eec8166635e927fe13a1b7cd4ff27e79c0b428b9a276dbe9ebcde5ce2c08ec8a6da75bf1d0d1b820456ac7003ecc8afafd4fcb2faf  dispatch.sr.ht.confd
94df16f5ba6d1017fd9f890548773d931a556c18432b98f4bd7f40ffc198ffccee72372b760720ba2edb0fea926d2d700fd0c8f23ff860fe47c1b9e6793cd047  dispatch.sr.ht.initd
21f39ea0981d7773eb512e5ba234022364d0f7ee9b6ca897ce4c51e3b127eb2d9a7a5fbcaa06d14f20b2df2439421d7261f200e3f4f13b45a91e78ba77bc363c  dispatch.sr.ht.gunicorn.conf.py
"

D sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd => sr.ht/dispatch.sr.ht/dispatch.sr.ht.confd +0 -11
@@ 1,11 0,0 @@
# Run the daemon as this user:
# DISPATCH_USER=meta

# Bind the web service to this address:
# DISPATCH_BIND=127.0.0.1:5005

# Gunicorn configuration file
# DISPATCH_GUNICORN_CONF=/etc/sr.ht/dispatch.sr.ht.gunicorn.conf.py

# Extra arguments to pass to Gunicorn
# DISPATCH_ARGS=

D sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd => sr.ht/dispatch.sr.ht/dispatch.sr.ht.initd +0 -32
@@ 1,32 0,0 @@
#!/sbin/openrc-run
name="dispatch.sr.ht"
description="dispatch.sr.ht service"
supervisor=supervise-daemon
DISPATCH_USER=${DISPATCH_USER:-dispatch}
DISPATCH_BIND=${DISPATCH_BIND:-127.0.0.1:5005}
DISPATCH_GUNICORN_CONF=${DISPATCH_GUNICORN_CONF:-/etc/sr.ht/dispatch.sr.ht.gunicorn.conf.py}
DISPATCH_ARGS=${DISPATCH_ARGS:-}
LOGS=/var/log/dispatch.sr.ht.log
prometheus_multiproc_dir=/run/dispatch.sr.ht
supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
command_args="dispatchsrht.app:app -b $DISPATCH_BIND -c $DISPATCH_GUNICORN_CONF $DISPATCH_ARGS"
command_user="$DISPATCH_USER:$DISPATCH_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$DISPATCH_USER:$DISPATCH_USER"
	# Workaround for https://github.com/OpenRC/openrc/issues/335
	if [ -n "$prometheus_multiproc_dir" ]
	then
		checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$DISPATCH_USER:$DISPATCH_USER"
		rm -rf "$prometheus_multiproc_dir"/*
	fi
}

D sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-install => sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S dispatch || true
adduser -SDH -s /sbin/nologin -G dispatch -g dispatch dispatch || true

D sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-upgrade => sr.ht/dispatch.sr.ht/dispatch.sr.ht.post-upgrade +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
srht-migrate dispatch.sr.ht -a upgrade head
dispatchsrht-migrate -a upgrade head

D sr.ht/drawterm-sourcehut/APKBUILD => sr.ht/drawterm-sourcehut/APKBUILD +0 -30
@@ 1,30 0,0 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=drawterm-sourcehut
pkgver=0_hg20200708
_hgver=afc2a40c47ee
pkgrel=1
pkgdesc="Connect to Plan 9 CPU servers from other operating systems"
url="http://drawterm.9front.org/"
arch="all"
license="LPL-1.02"
options="!check" # upstream does not have a test suite
makedepends="linux-headers libx11-dev libxt-dev"
subpackages="$pkgname-dbg"
source="https://hg.sr.ht/~sircmpwn/drawterm/archive/$_hgver.tar.gz"
builddir="$srcdir/drawterm-$_hgver"

build() {
	CONF=unix make
}

package() {
	install -Dm755 drawterm \
		"$pkgdir"/usr/bin/drawterm
	install -Dm644 LICENSE \
		"$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
26d8321da3ea6f37715561d6fbd2b2cadb1f3c6069d3f87ad8986031845dd09df02f1a476d5ea8be853d4b3736c0bec032bbdb3b1342a973737ddf02d08adcb7  afc2a40c47ee.tar.gz
"

D sr.ht/drawterm-sourcehut/respect-env.patch => sr.ht/drawterm-sourcehut/respect-env.patch +0 -22
@@ 1,22 0,0 @@
diff -upr drawterm-20170119.orig/Make.unix drawterm-20170119/Make.unix
--- drawterm-20170119.orig/Make.unix	2017-01-23 22:41:27.402630694 +0100
+++ drawterm-20170119/Make.unix	2017-01-23 22:41:43.879309573 +0100
@@ -5,12 +5,15 @@ AR=ar
 AS=as
 RANLIB=ranlib
 X11=/usr/X11R6
-CC=gcc
-CFLAGS=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11)/include -D_THREAD_SAFE $(PTHREAD) -O2
+X11INC=$(X11)/include
+X11LIB=$(X11)/lib
+CC?=gcc
+CFLAGS?=-O2
+CFLAGS+=-Wall -Wno-missing-braces -ggdb -I$(ROOT) -I$(ROOT)/include -I$(ROOT)/kern -c -I$(X11INC) -D_THREAD_SAFE $(PTHREAD)
 O=o
 OS=posix
 GUI=x11
-LDADD=-L$(X11)/lib64 -L$(X11)/lib -lX11 -ggdb
+LDADD=-L$(X11LIB) -lX11 -ggdb
 LDFLAGS=$(PTHREAD)
 TARG=drawterm
 # AUDIO=none

D sr.ht/gamja/0001-Add-custom-chat.sr.ht-noscript-page.patch => sr.ht/gamja/0001-Add-custom-chat.sr.ht-noscript-page.patch +0 -31
@@ 1,31 0,0 @@
From 45bfa01d738bf8cc9821153b643711b11db3b507 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Mon, 29 Nov 2021 12:52:42 +0100
Subject: [PATCH gamja] Add custom chat.sr.ht noscript page

---
 index.html | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/index.html b/index.html
index ec656db..455a6f2 100644
--- a/index.html
+++ b/index.html
@@ -11,7 +11,13 @@
 	</head>
 	<body>
 		<noscript>
-			<p>This application requires JavaScript. Please enable it!</p>
+			<p>
+				chat.sr.ht provides a web chat client, but it requires
+				JavaScript to use. If you do not wish to enable JavaScript, you
+				may also use chat.sr.ht by
+				<a href="https://man.sr.ht/chat.sr.ht/quickstart.md">connecting to the IRC bouncer</a>
+				directly with your own IRC client.
+			</p>
 		</noscript>
 	</body>
 </html>
-- 
2.34.1


D sr.ht/gamja/0001-Add-sourcehut-branding-to-chat.sr.ht.patch => sr.ht/gamja/0001-Add-sourcehut-branding-to-chat.sr.ht.patch +0 -65
@@ 1,65 0,0 @@
From 9ee590d59f68d5ab4f9c8c8a928aea21d8eaffa5 Mon Sep 17 00:00:00 2001
From: Tmpod <tmpod@pm.me>
Date: Mon, 29 Nov 2021 21:27:29 +0000
Subject: [PATCH gamja] Add sourcehut branding to chat.sr.ht

Add "chat.sr.ht" title, to be improved with a gamja patch (for smarter
titles).
Add SVG favicon of sourcehut's white logo.
---
 favicon.svg   |  1 +
 index.html    |  3 ++-
 manifest.json | 12 ++++++++++--
 3 files changed, 13 insertions(+), 3 deletions(-)
 create mode 100644 favicon.svg

diff --git a/favicon.svg b/favicon.svg
new file mode 100644
index 0000000..e94113c
--- /dev/null
+++ b/favicon.svg
@@ -0,0 +1 @@
+<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"><path fill="#fff" d="M256 26C128.944 26 26 128.944 26 256s102.944 230 230 230 230-102.944 230-230S383.056 26 256 26Zm0 415.484C153.52 441.484 70.516 358.48 70.516 256S153.52 70.516 256 70.516 441.484 153.52 441.484 256 358.48 441.484 256 441.484z"/></svg>
diff --git a/index.html b/index.html
index 455a6f2..e957e78 100644
--- a/index.html
+++ b/index.html
@@ -3,11 +3,12 @@
 	<head>
 		<meta charset="utf-8">
 		<meta http-equiv="Content-Security-Policy" content="default-src 'self'; frame-src 'none'; object-src 'none'; connect-src *;">
-		<title>gamja IRC client</title>
+		<title>chat.sr.ht</title>
 		<link rel="stylesheet" href="./style.css">
 		<script type="module" src="./main.js"></script>
 		<meta name="viewport" content="width=device-width, initial-scale=1">
 		<link rel="manifest" href="manifest.json">
+		<link rel="icon" type="image/svg+xml" href="favicon.svg">
 	</head>
 	<body>
 		<noscript>
diff --git a/manifest.json b/manifest.json
index 37ea9bc..abda399 100644
--- a/manifest.json
+++ b/manifest.json
@@ -1,7 +1,15 @@
 {
-	"name": "gamja IRC client",
+	"name": "chat.sr.ht",
 	"short_name": "gamja",
 	"start_url": ".",
 	"display": "standalone",
-	"scope": "."
+	"scope": ".",
+	"icons": [
+		{
+			"src": "favicon.svg",
+			"sizes": "512x512",
+			"type": "image/svg+xml",
+			"purpose": "any"
+		}
+	]
 }
-- 
2.34.1


D sr.ht/gamja/APKBUILD => sr.ht/gamja/APKBUILD +0 -43
@@ 1,43 0,0 @@
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=gamja
pkgver=1.0.0_beta6
pkgrel=1
pkgdesc="Simple IRC web client"
url="https://sr.ht/~emersion/gamja/"
license="AGPL-3.0"
arch="all"
makedepends="npm"
subpackages="$pkgname-doc"
githash=1bcd9d3607767bcc4edefbe1fc39de0676a5afc1
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/gamja/archive/$githash.tar.gz
	0001-Add-custom-chat.sr.ht-noscript-page.patch
	0001-Add-sourcehut-branding-to-chat.sr.ht.patch
"
builddir="$srcdir/$pkgname-$githash"
options="!check" # no test suite

build() {
	npm install --include=dev
	npm run build
}

package() {
	local webroot="$pkgdir"/usr/share/webapps/gamja

	install -d "$webroot" "$pkgdir"/usr/share/doc/gamja
	cp -r "$builddir"/dist/* "$webroot"
	install -Dm644 "$builddir"/README.md "$pkgdir"/usr/share/doc/gamja

	# default empty config
	echo "{}" >config.json
	install -Dm644 config.json "$pkgdir"/etc/gamja/config.json
	ln -s /etc/gamja/config.json "$pkgdir"/usr/share/webapps/gamja/config.json
}

sha512sums="
097e6cb0e98644bbecce22e4dcdd52414269ece8ff88dc1c6fd37ae28a7ac81a4dbfbd4d134454988f2ae72ca1c9992db3e146a17d0550badc1dac4bc88b6e11  gamja-1.0.0_beta6.tar.gz
7ebb5050f197881169ded60f16af23e9adc454b8f607192948ca8a4d36452daaec55aa85b938c61b58bc70fcbbe9f10a99c0f8d436374562edd448df9c63c34a  0001-Add-custom-chat.sr.ht-noscript-page.patch
d76b6f974e5c454621c5b161580ecfa87d366c816d490c2e455ba075823b7002fbea283614ade92c9ac12810945292b1abf0d5daa9fec6ac508ee35d94326d53  0001-Add-sourcehut-branding-to-chat.sr.ht.patch
"

D sr.ht/git-send-email.io/APKBUILD => sr.ht/git-send-email.io/APKBUILD +0 -37
@@ 1,37 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=git-send-email.io
pkgver=0.1.13
pkgrel=0
pkgdesc="Interactive tutorial for git send-email"
url="https://git.sr.ht/~sircmpwn/git-send-email.io"
arch="noarch"
license="MIT"
depends="
	py3-srht
	py3-pygit2
"
makedepends="py3-setuptools nodejs sassc"
subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	git-send-email.io.init
"
builddir="$srcdir/$pkgname-$pkgver"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/git-send-email.io.init "$pkgdir"/etc/init.d/git-send-email.io
}

sha512sums="
c5999241a152281b3d4f4e59b4d1b259a9c96f52ddd3d8b89068ce6e7e6f3415bbd8e432cefea981daec5c62a04aa414d86dc89d9bd192b063dca7366aaf529a  git-send-email.io-0.1.9.tar.gz
b5c929644f6f4a36ff11bb34d5332e6091a7fd856dcd9aae770609c3fadd92cca0631e8c9edf27c55114da3547af99e5ca28d5c851fecd788b52b2925dd0ebf8  git-send-email.io.init
"

D sr.ht/git-send-email.io/git-send-email.io.init => sr.ht/git-send-email.io/git-send-email.io.init +0 -35
@@ 1,35 0,0 @@
#!/sbin/openrc-run
name="git-send-email.io"
description="git-send-email.io webhook service"

# Override these with /etc/conf.d/git-send-emaio.io
GITSENDEMAIL_USER=${GITSENDEMAIL_USER:-gitsendemail}
GITSENDEMAIL_BIND=${GITSENDEMAIL_BIND:-127.0.0.1:5001}
GITSENDEMAIL_ARGS=${GITSENDEMAIL_ARGS:-}
LOGS=/var/log/git-send-emaio.io.log

depend() {
	need net
}

start() {
	ebegin "Starting $name"
	touch "$LOGS"
	chown ${GITSENDEMAIL_USER} "$LOGS"
	start-stop-daemon \
		-u ${GITSENDEMAIL_USER} \
		-1 "$LOGS" \
		-2 "$LOGS" \
		--background \
		--make-pidfile \
		--pidfile /run/$name.pid \
		--exec /usr/bin/gunicorn -- \
			email_tutorial.app:app -b ${GITSENDEMAIL_BIND} ${GITSENDEMAIL_ARGS}
	eend $?
}

stop() {
	ebegin "Stopping $name"
	start-stop-daemon --stop --exec /usr/bin/gunicorn --pidfile /run/$name.pid
	eend $?
}

D sr.ht/git-send-email.io/git-send-email.io.post-install => sr.ht/git-send-email.io/git-send-email.io.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S gitsendemail || true
adduser -SDH -s /sbin/nologin -g gitsendemail gitsendemail || true

D sr.ht/go-msgauth/APKBUILD => sr.ht/go-msgauth/APKBUILD +0 -50
@@ 1,50 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=go-msgauth
pkgver=0.6.6
pkgrel=0
pkgdesc="Go utilities for DKIM, DMARC, and Authentication-Results"
url="https://github.com/emersion/go-msgauth"
arch="all"
license="MIT"
install="$pkgname.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/emersion/go-msgauth/archive/v$pkgver.tar.gz
	dkim-milter.confd
	dkim-milter.initd
"
subpackages="$pkgname-openrc"

build() {
	go mod vendor
	for bin in dkim-milter dkim-verify dkim-keygen dmarc-lookup
	do
		go build \
			-trimpath \
			-mod=vendor \
			-ldflags "-extldflags $LDFLAGS" \
			./cmd/$bin
	done
}

check() {
	go test ./...
}

package() {
	for bin in dkim-milter dkim-verify dkim-keygen dmarc-lookup
	do
		install -Dm755 $bin "$pkgdir"/usr/bin/$bin
	done

	install -Dm755 "$srcdir"/dkim-milter.initd \
		"$pkgdir"/etc/init.d/dkim-milter
	install -Dm644 "$srcdir"/dkim-milter.confd \
		"$pkgdir"/etc/conf.d/dkim-milter
}

sha512sums="
b6bbe954daa246dd393f38cc6cbc45e5b1c90b0eb913ced98166e0d5e92939d59b62780c2a3eb2cf94696af86b62d2a201a257e87c8c23072fdcedbe0810ac46  go-msgauth-0.6.6.tar.gz
5a213a85bab469b4ee6a144eac69ab452a791886d7faaa46da1f12a9f03248eea1bf1118f637cf282e6c49c9b432c57de2651fb3f33bc3e4ad9f40dde6490aa5  dkim-milter.confd
8483e40792067db6e9e43563cc02d1c28f4fe74d10d43722a4dbce2e4ec6a4daa391f6aa1b428e76ddddbd2a2fa07bd5080a94d8264d1fd5a30c1659726f9de2  dkim-milter.initd
"

D sr.ht/go-msgauth/dkim-milter.confd => sr.ht/go-msgauth/dkim-milter.confd +0 -27
@@ 1,27 0,0 @@
# Address to listen for milter connections on
#
# tcp://[ip]:[port]
# or
# unix://path/to/socket
dkim_listen_address=tcp://127.0.0.1:8891

# Space separated list of domains to sign for outgoing mails
dkim_sign_domains=

# Selector for DNS DKIM key (i.e. $dkim_selector._domainkey TXT)
dkim_selector=

# Path to DKIM key
#
# Generate key:
# $ dkim-keygen -f /var/lib/dkim/example.key
#
# Then configure:
# dkim_key=/var/lib/dkim/example.key
dkim_key=

# Name of this mail server, defaults to hostname
dkim_host=

output_log=/var/log/dkim-milter.log
error_log=/var/log/dkim-milter.log

D sr.ht/go-msgauth/dkim-milter.initd => sr.ht/go-msgauth/dkim-milter.initd +0 -29
@@ 1,29 0,0 @@
#!/sbin/openrc-run
name="dkim-milter"
description="Milter for DKIM signatures and verification"
supervisor=supervise-daemon
command=/usr/bin/dkim-milter
_domains=
for d in $dkim_sign_domains
do
	_domains="$_domains -d $d"
done
command_args="-l $dkim_listen_address -s $dkim_selector -k $dkim_key $_domains"
if [ -n "$dkim_host" ]
then
	command_args="$command_args -i $dkim_host"
fi
command_user="dkim:dkim"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o dkim:dkim
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o dkim:dkim
	if [ -z "$dkim_sign_domains" ] || [ -z "$dkim_key" ] || [ -z "$dkim_selector" ]
	then
		eerror "$RC_SVCNAME is not configured to sign any domains"
		eerror "Edit /etc/conf.d/$RC_SVCNAME before continuing"
		eend 1
	fi
}

D sr.ht/go-msgauth/go-msgauth.pre-install => sr.ht/go-msgauth/go-msgauth.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^dkim' /etc/group >/dev/null || addgroup -S dkim 2>/dev/null
grep '^dkim' /etc/passwd >/dev/null || adduser -SDh/var/lib/dkim \
	-s/sbin/nologin -Gdkim -gdkim dkim dkim 2>/dev/null

D sr.ht/hg-evolve/APKBUILD => sr.ht/hg-evolve/APKBUILD +0 -33
@@ 1,33 0,0 @@
# Contributor: Ludovic Chabant <ludovic@chabant.com>
# Maintainer: Ludovic Chabant <ludovic@chabant.com>
pkgname=hg-evolve
_pyname=$pkgname
pkgver=10.2.0
_pypyver=$pkgver.post1
pkgrel=1
pkgdesc="Flexible evolution of Mercurial history."
url="https://www.mercurial-scm.org/repo/evolve"
arch="noarch"
license="GPLv2+"
depends="mercurial"
makedepends="python3-dev py-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$_pypyver.tar.gz"
builddir="$srcdir/$pkgname-$_pypyver"

prepare() {
	# Conflicts with mercurial:
	rm hgext3rd/__init__.py
}

build() {
	PYTHONPATH="$(pwd)"
	HGPYTHON3=1 python3 setup.py build
}

package() {
	PYTHONPATH="$(pwd)"
	HGPYTHON3=1 python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="474f3cc8812b0dda368118c1f3b86be55191ddd876e7b457fa8c8b62c06496a903e551c2692daebef8374d7edfb8c298657a62d52a43e684e22a45b1ccc3307b  hg-evolve-10.2.0.post1.tar.gz"

D sr.ht/hg.sr.ht/APKBUILD => sr.ht/hg.sr.ht/APKBUILD +0 -78
@@ 1,78 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=hg.sr.ht
pkgver=0.29.1
pkgrel=0
pkgdesc="sr.ht mercurial service"
url="https://hg.sr.ht/~sircmpwn/hg.sr.ht"
arch="all"
license="AGPLv3"
depends="
	py3-hglib
	py3-redis
	py3-scmsrht
	py3-unidiff
	hg-evolve
"
makedepends="py-setuptools nodejs sassc go"
subpackages="$pkgname-openrc $pkgname-nginx:_nginx:noarch"
source="
	$pkgname-$pkgver.tar.gz::https://hg.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	sr.ht-nginx-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/master.tar.gz
	hg.sr.ht.initd
	hg.sr.ht.confd
	hg.sr.ht-api.initd
	hg.sr.ht-api.confd
	hg.sr.ht-webhooks.initd
	hg.sr.ht-webhooks.confd
	hg.sr.ht.gunicorn.conf.py
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

build() {
	python3 setup.py build
	make
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/hg.sr.ht.initd \
		"$pkgdir"/etc/init.d/hg.sr.ht
	install -Dm644 "$srcdir"/hg.sr.ht.confd \
		"$pkgdir"/etc/conf.d/hg.sr.ht
	install -Dm755 "$srcdir"/hg.sr.ht-api.initd \
		"$pkgdir"/etc/init.d/hg.sr.ht-api
	install -Dm644 "$srcdir"/hg.sr.ht-api.confd \
		"$pkgdir"/etc/conf.d/hg.sr.ht-api
	install -Dm755 "$srcdir"/hg.sr.ht-webhooks.initd \
		"$pkgdir"/etc/init.d/hg.sr.ht-webhooks
	install -Dm644 "$srcdir"/hg.sr.ht-webhooks.confd \
		"$pkgdir"/etc/conf.d/hg.sr.ht-webhooks
	install -Dm644 "$srcdir"/hg.sr.ht.gunicorn.conf.py \
		"$pkgdir"/etc/sr.ht/hg.sr.ht.gunicorn.conf.py
	install -Dm755 hgsrht-keys/hgsrht-keys "$pkgdir"/usr/bin/hgsrht-keys
	install -Dm755 api/api "$pkgdir"/usr/bin/hgsrht-api
	install -Dm644 hgsrht/hgrcs/global.cfg "$pkgdir"/etc/sr.ht/hgrcs/global.cfg
	install -Dm644 hgsrht/hgrcs/nonpublishing.cfg "$pkgdir"/etc/sr.ht/hgrcs/nonpublishing.cfg
}

_nginx() {
	depends="sr.ht-nginx"
	pkgdesc="nginx configuration for $pkgname"
	install -Dm644 "$srcdir/sr.ht-nginx-master/hg.sr.ht.conf" \
		"$subpkgdir"/etc/nginx/http.d/hg.sr.ht.conf
}

sha512sums="
7eb9113ee4abc636e73d4d9fdf6730b5fe930c552e43fb35f6ba5a9050674916fee8f4793d3bb171885bd4dcfd21ac2cd33287cb175843463c7c5035ad3b2069  hg.sr.ht-0.29.1.tar.gz
917bbc9a493f6aa756af3f3597f9edf2e25227efe30f6ab635f99a7d9f4ecd6e9f36a7f2b9b40cc95b6e584dd62e1a0badb46e4ff9d3c3d5ce959455b15a95b6  sr.ht-nginx-0.29.1.tar.gz
f2055a52508d85b069facae34a102a8d7597b69d4905f1c73350677d0653e53569fe689e823fbe556f686f373df6e86608a78194f4d00daf7678b3e82a80a092  hg.sr.ht.initd
867dc537ea53099a2ab4dbc8c400012ca24053d9226281322c103944faa3b66a7986c325c860718882a4b28b986a2208f9a9b40f37a2d54c19be46ebe3902a82  hg.sr.ht.confd
379d3eca6754aa2fc7526f8ea937061b53f322ebac71635455d6ff056baaf5d61709c43cfdce182e774f8fd0c0b09f02d1ccbebeac6cbfdc07652fcf734d0c42  hg.sr.ht-api.initd
eaed280fc25b88294c5d02893e72b8751afc1db0db3e5f20123239ca28ae6f3e53b22c11992e44a4f8b4943f6326da0ed03ad0bd0a900d10efcb507d35b1b64f  hg.sr.ht-api.confd
93f25762da77462c8167ae53ba37ab4f9982c7f3c2d03dde445f0578758b808987c4781912a0fa5b4a4e25ba50c9d27477dfea8e319908ddc124dc836aefd2d6  hg.sr.ht-webhooks.initd
af5bb605d8ba2e848de5755c9c7f1607591068f6ac79ddc1d312873e92218c6b535eb4cbcf10590656239459b7808ba5469d52d32f80e8e2448fc18c22f7a70c  hg.sr.ht-webhooks.confd
21f39ea0981d7773eb512e5ba234022364d0f7ee9b6ca897ce4c51e3b127eb2d9a7a5fbcaa06d14f20b2df2439421d7261f200e3f4f13b45a91e78ba77bc363c  hg.sr.ht.gunicorn.conf.py
"

D sr.ht/hg.sr.ht/hg.sr.ht-api.confd => sr.ht/hg.sr.ht/hg.sr.ht-api.confd +0 -8
@@ 1,8 0,0 @@
# Run the daemon as this user:
# HG_USER=hg

# Bind the API service to this address:
# HG_BIND=:5110

# Extra arguments to pass to Gunicorn
# HG_ARGS=

D sr.ht/hg.sr.ht/hg.sr.ht-api.initd => sr.ht/hg.sr.ht/hg.sr.ht-api.initd +0 -24
@@ 1,24 0,0 @@
#!/sbin/openrc-run
name="hg.sr.ht-api"
description="hg.sr.ht API service"
supervisor=supervise-daemon
HG_USER=${HG_USER:-hg}
HG_BIND=${HG_BIND:-:5110}
HG_ARGS=${HG_ARGS:-}
LOGS=/var/log/hg.sr.ht-api.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/hgsrht-api"
command_args="-b $HG_BIND"
command_user="$HG_USER:$HG_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$HG_USER:$HG_USER"
}

D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.confd +0 -5
@@ 1,5 0,0 @@
# Run the daemon as this user:
# HG_USER=hgsrht

# Extra arguments to pass to celery
# HG_ARGS=

D sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd => sr.ht/hg.sr.ht/hg.sr.ht-webhooks.initd +0 -23
@@ 1,23 0,0 @@
#!/sbin/openrc-run
name="hg.sr.ht-webhooks"
description="meta.sr.ht webhook delivery service"
supervisor=supervise-daemon
HG_USER=${HG_USER:-hg}
HG_ARGS=${HG_ARGS:-}
LOGS=/var/log/hg.sr.ht-webhooks.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/celery"
command_args="-A hgsrht.webhooks worker --loglevel=info $HG_ARGS"
command_user="$HG_USER:$HG_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$HG_USER:$HG_USER"
}

D sr.ht/hg.sr.ht/hg.sr.ht.confd => sr.ht/hg.sr.ht/hg.sr.ht.confd +0 -11
@@ 1,11 0,0 @@
# Run the daemon as this user:
# HG_USER=hg

# Bind the web service to this address:
# HG_BIND=127.0.0.1:5010

# Gunicorn configuration file
# HG_GUNICORN_CONF=/etc/sr.ht/hg.sr.ht.gunicorn.conf.py

# Extra arguments to pass to Gunicorn
# HG_ARGS=

D sr.ht/hg.sr.ht/hg.sr.ht.initd => sr.ht/hg.sr.ht/hg.sr.ht.initd +0 -32
@@ 1,32 0,0 @@
#!/sbin/openrc-run
name="hg.sr.ht"
description="hg.sr.ht service"
supervisor=supervise-daemon
HG_USER=${HG_USER:-hg}
HG_BIND=${HG_BIND:-127.0.0.1:5010}
HG_GUNICORN_CONF=${HG_GUNICORN_CONF:-/etc/sr.ht/hg.sr.ht.gunicorn.conf.py}
HG_ARGS=${HG_ARGS:-}
LOGS=/var/log/hg.sr.ht.log
prometheus_multiproc_dir=/run/hg.sr.ht
supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
command_args="hgsrht.app:app -b $HG_BIND -c $HG_GUNICORN_CONF $HG_ARGS"
command_user="$HG_USER:$HG_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$HG_USER:$HG_USER"
	# Workaround for https://github.com/OpenRC/openrc/issues/335
	if [ -n "$prometheus_multiproc_dir" ]
	then
		checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$HG_USER:$HG_USER"
		rm -rf "$prometheus_multiproc_dir"/*
	fi
}

D sr.ht/hg.sr.ht/hg.sr.ht.post-install => sr.ht/hg.sr.ht/hg.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S hg || true
adduser -SD -h /var/lib/mercurial -s /sbin/nologin -G hg -g hg hg || true

D sr.ht/hg.sr.ht/hg.sr.ht.post-upgrade => sr.ht/hg.sr.ht/hg.sr.ht.post-upgrade +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
srht-migrate hg.sr.ht -a upgrade head
hgsrht-migrate -a upgrade head

D sr.ht/hub.sr.ht/APKBUILD => sr.ht/hub.sr.ht/APKBUILD +0 -54
@@ 1,54 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=hub.sr.ht
pkgver=0.14.2
pkgrel=0
pkgdesc="sr.ht hub service"
url="https://git.sr.ht/~sircmpwn/hub.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-srht
	py3-gunicorn
"
makedepends="py-setuptools nodejs sassc go"
subpackages="$pkgname-openrc $pkgname-nginx:_nginx:noarch"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	sr.ht-nginx-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/master.tar.gz
	hub.sr.ht.initd
	hub.sr.ht.confd
	hub.sr.ht.gunicorn.conf.py
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/hub.sr.ht.initd \
		"$pkgdir"/etc/init.d/hub.sr.ht
	install -Dm644 "$srcdir"/hub.sr.ht.confd \
		"$pkgdir"/etc/conf.d/hub.sr.ht
	install -Dm644 "$srcdir"/hub.sr.ht.gunicorn.conf.py \
		"$pkgdir"/etc/sr.ht/hub.sr.ht.gunicorn.conf.py
}

_nginx() {
	depends="sr.ht-nginx"
	pkgdesc="nginx configuration for $pkgname"
	install -Dm644 "$srcdir/sr.ht-nginx-master/hub.sr.ht.conf" \
		"$subpkgdir"/etc/nginx/http.d/hub.sr.ht.conf
}

sha512sums="
7c8b949e7ff9e2678b18a3017e780ecbf25939d7d02452e24c1db3fb6939fc7d1cc2abf2562cf6695ba24929250f24ab70f0387617e83720292fe5b9ef66dab5  hub.sr.ht-0.14.2.tar.gz
917bbc9a493f6aa756af3f3597f9edf2e25227efe30f6ab635f99a7d9f4ecd6e9f36a7f2b9b40cc95b6e584dd62e1a0badb46e4ff9d3c3d5ce959455b15a95b6  sr.ht-nginx-0.14.2.tar.gz
e82162ed183905bdbc55676624983dbccb5f0a542024f3d88c670c69cf3f19447890ef8e4b3fbfd859ccb58caaa4196bdfad056d99a493fe2c23fddc3d99137d  hub.sr.ht.initd
657499dc280ca355704f704f183ad6097753fef02e5742014370e3f09d0d7c56966d3015022c54dcaad680ebc940c53c9f670b8488fb76e964ba5a89e60fa1aa  hub.sr.ht.confd
21f39ea0981d7773eb512e5ba234022364d0f7ee9b6ca897ce4c51e3b127eb2d9a7a5fbcaa06d14f20b2df2439421d7261f200e3f4f13b45a91e78ba77bc363c  hub.sr.ht.gunicorn.conf.py
"

D sr.ht/hub.sr.ht/hub.sr.ht.confd => sr.ht/hub.sr.ht/hub.sr.ht.confd +0 -11
@@ 1,11 0,0 @@
# Run the daemon as this user:
# HUB_USER=hub

# Bind the web service to this address:
# HUB_BIND=127.0.0.1:5014

# Gunicorn configuration file
# HUB_GUNICORN_CONF=/etc/sr.ht/hub.sr.ht.gunicorn.conf.py

# Extra arguments to pass to Gunicorn
# HUB_ARGS=

D sr.ht/hub.sr.ht/hub.sr.ht.initd => sr.ht/hub.sr.ht/hub.sr.ht.initd +0 -32
@@ 1,32 0,0 @@
#!/sbin/openrc-run
name="hub.sr.ht"
description="hub.sr.ht service"
supervisor=supervise-daemon
HUB_USER=${HUB_USER:-hub}
HUB_BIND=${HUB_BIND:-127.0.0.1:5014}
HUB_GUNICORN_CONF=${HUB_GUNICORN_CONF:-/etc/sr.ht/hub.sr.ht.gunicorn.conf.py}
HUB_ARGS=${HUB_ARGS:-}
LOGS=/var/log/hub.sr.ht.log
prometheus_multiproc_dir=/run/hub.sr.ht
supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
command_args="hubsrht.app:app -b $HUB_BIND -c $HUB_GUNICORN_CONF $HUB_ARGS"
command_user="$HUB_USER:$HUB_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$HUB_USER:$HUB_USER"
	# Workaround for https://github.com/OpenRC/openrc/issues/335
	if [ -n "$prometheus_multiproc_dir" ]
	then
		checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$HUB_USER:$HUB_USER"
		rm -rf "$prometheus_multiproc_dir"/*
	fi
}

D sr.ht/hub.sr.ht/hub.sr.ht.post-install => sr.ht/hub.sr.ht/hub.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S hub || true
adduser -HSD -h / -s /sbin/nologin -G hub -g hub hub || true

D sr.ht/hub.sr.ht/hub.sr.ht.post-upgrade => sr.ht/hub.sr.ht/hub.sr.ht.post-upgrade +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
srht-migrate hub.sr.ht -a upgrade head
hubsrht-migrate -a upgrade head

D sr.ht/legacy.sr.ht-shim/APKBUILD => sr.ht/legacy.sr.ht-shim/APKBUILD +0 -36
@@ 1,36 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=legacy.sr.ht-shim
pkgver=1.0.0
pkgrel=7
pkgdesc="legacy.sr.ht API shim service (you don't want to use this)"
url="https://git.sr.ht/~sircmpwn/legacy.sr.ht-shim"
arch="noarch"
license="AGPLv3"
depends="py3-srht"
makedepends="py3-setuptools"
subpackages="${pkgname}-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	legacy.sr.ht-shim.initd
	legacy.sr.ht-shim.confd
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/etc/init.d
	install -Dm755 "$srcdir"/legacy.sr.ht-shim.initd \
		"$pkgdir"/etc/init.d/legacy.sr.ht-shim
	install -Dm644 "$srcdir"/legacy.sr.ht-shim.confd \
		"$pkgdir"/etc/conf.d/legacy.sr.ht-shim
}

sha512sums="4ffaaf522ef18f1fb82b0e3d2a54a6f594edbf6a2e55e9f58c41a36d858a431b617d7252792092ad1669b5df8aafd15c11129db3db84dda61f5d10158aa82f47  legacy.sr.ht-shim-1.0.0.tar.gz
56cdfc1d23f41b10aa4eebbf5e1b3b22cf1d2005f44753ac0225d51189fb7eb68a57dbafb7426e8fe587b6e5137605c9916b7ee0b35793dcc6f8952e4b5b3723  legacy.sr.ht-shim.initd
3d9c5dc7bb33d938d77f30a7bd5df9098e2fc382c701de08101cd1066152065ba03ecf0c6ce47985a2ea078be13171a88e79d90ec742384e4bbe1a5c1d81c640  legacy.sr.ht-shim.confd"

D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.confd => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.confd +0 -8
@@ 1,8 0,0 @@
# Run the daemon as this user:
# LEGACYSHIM_USER=legacyshim

# Bind the web service to this address:
# LEGACYSHIM_BIND=127.0.0.1:5001

# Extra arguments to pass to Gunicorn
# LEGACYSHIM_ARGS=

D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.initd => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.initd +0 -23
@@ 1,23 0,0 @@
#!/sbin/openrc-run
name="legacy.sr.ht-shim"
description="legacy.sr.ht shim API service"
supervisor=supervise-daemon
LEGACYSHIM_USER=${LEGACYSHIM_USER:-legacyshim}
LEGACYSHIM_BIND=${LEGACYSHIM_BIND:-127.0.0.1:5013}
LEGACYSHIM_ARGS=${LEGACYSHIM_ARGS:-}
LOGS=/var/log/legacy.sr.ht-shim.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/gunicorn"
command_args="legacyshim.app:app -b $LEGACYSHIM_BIND $LEGACYSHIM_ARGS"
command_user="$LEGACYSHIM_USER:$LEGACYSHIM_USER"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$LEGACYSHIM_USER:$LEGACYSHIM_USER"
}

D sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.post-install => sr.ht/legacy.sr.ht-shim/legacy.sr.ht-shim.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S legacyshim || true
adduser -SDH -s /sbin/nologin -g legacyshim legacyshim || true

D sr.ht/lists.sr.ht/lists.sr.ht.gunicorn.conf.py => sr.ht/lists.sr.ht/lists.sr.ht.gunicorn.conf.py +0 -5
@@ 1,5 0,0 @@
from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

D sr.ht/man.sr.ht/APKBUILD => sr.ht/man.sr.ht/APKBUILD +0 -57
@@ 1,57 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=man.sr.ht
pkgver=0.15.22
pkgrel=0
pkgdesc="sr.ht wiki service"
url="https://git.sr.ht/~sircmpwn/man.sr.ht"
arch="noarch"
license="AGPLv3"
depends="
	py3-gunicorn
	py3-pygit2
	py3-srht
	py3-scmsrht
	py3-yaml
	redis
"
makedepends="py-setuptools nodejs sassc"
subpackages="$pkgname-openrc $pkgname-nginx:_nginx"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	sr.ht-nginx-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/master.tar.gz
	man.sr.ht.initd
	man.sr.ht.confd
	man.sr.ht.gunicorn.conf.py
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

build() {
	python3 setup.py build
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/man.sr.ht.initd \
		"$pkgdir"/etc/init.d/man.sr.ht
	install -Dm644 "$srcdir"/man.sr.ht.confd \
		"$pkgdir"/etc/conf.d/man.sr.ht
	install -Dm644 "$srcdir"/man.sr.ht.gunicorn.conf.py \
		"$pkgdir"/etc/sr.ht/man.sr.ht.gunicorn.conf.py
}

_nginx() {
	depends="sr.ht-nginx"
	pkgdesc="nginx configuration for $pkgname"
	install -Dm644 "$srcdir/sr.ht-nginx-master/man.sr.ht.conf" \
		"$subpkgdir"/etc/nginx/http.d/man.sr.ht.conf
}

sha512sums="
2cfb16afba6ccccd22eba20142d25cfabde56bdf73b7eae40505b89e33c8096e11c5a8bed012f99bf30d2199a68498b753466b5929924afbc9a435be4f594ce6  man.sr.ht-0.15.22.tar.gz
917bbc9a493f6aa756af3f3597f9edf2e25227efe30f6ab635f99a7d9f4ecd6e9f36a7f2b9b40cc95b6e584dd62e1a0badb46e4ff9d3c3d5ce959455b15a95b6  sr.ht-nginx-0.15.22.tar.gz
626300024baaf62c21152de76ab4256ed38a699d2a2c30b4758a115dc8e14ab2986dc9ef5d3ba77e64261ef5cd121342212c3621cfe47b7a20e80dca2247480d  man.sr.ht.initd
2a271c656ab5e4314142200f8c9d4d95fd6a9080d561a64fcfa9530e258168f56a863e759400120f7b0ed98f2212a19e3e8afe4e2d4fab53071e88146a5fac08  man.sr.ht.confd
21f39ea0981d7773eb512e5ba234022364d0f7ee9b6ca897ce4c51e3b127eb2d9a7a5fbcaa06d14f20b2df2439421d7261f200e3f4f13b45a91e78ba77bc363c  man.sr.ht.gunicorn.conf.py
"

D sr.ht/man.sr.ht/man.sr.ht.confd => sr.ht/man.sr.ht/man.sr.ht.confd +0 -11
@@ 1,11 0,0 @@
# Run the daemon as this user:
# MAN_USER=man

# Bind the web service to this address:
# MAN_BIND=127.0.0.1:5004

# Gunicorn configuration file
# MAN_GUNICORN_CONF=/etc/sr.ht/man.sr.ht.gunicorn.conf.py

# Extra arguments to pass to Gunicorn
# MAN_ARGS=

D sr.ht/man.sr.ht/man.sr.ht.gunicorn.conf.py => sr.ht/man.sr.ht/man.sr.ht.gunicorn.conf.py +0 -5
@@ 1,5 0,0 @@
from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

D sr.ht/man.sr.ht/man.sr.ht.initd => sr.ht/man.sr.ht/man.sr.ht.initd +0 -32
@@ 1,32 0,0 @@
#!/sbin/openrc-run
name="man.sr.ht"
description="man.sr.ht service"
supervisor=supervise-daemon
MAN_USER=${MAN_USER:-man}
MAN_BIND=${MAN_BIND:-127.0.0.1:5004}
MAN_GUNICORN_CONF=${MAN_GUNICORN_CONF:-/etc/sr.ht/man.sr.ht.gunicorn.conf.py}
MAN_ARGS=${MAN_ARGS:-}
LOGS=/var/log/man.sr.ht.log
prometheus_multiproc_dir=/run/man.sr.ht
supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
command_args="mansrht.app:app -b $MAN_BIND -c $MAN_GUNICORN_CONF $MAN_ARGS"
command_user="$MAN_USER:$MAN_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$MAN_USER:$MAN_USER"
	# Workaround for https://github.com/OpenRC/openrc/issues/335
	if [ -n "$prometheus_multiproc_dir" ]
	then
		checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$MAN_USER:$MAN_USER"
		rm -rf "$prometheus_multiproc_dir"/*
	fi
}

D sr.ht/man.sr.ht/man.sr.ht.post-install => sr.ht/man.sr.ht/man.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S man || true
adduser -SDH -s /sbin/nologin -G man -g man man || true

D sr.ht/man.sr.ht/man.sr.ht.post-upgrade => sr.ht/man.sr.ht/man.sr.ht.post-upgrade +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
srht-migrate man.sr.ht -a upgrade head
mansrht-migrate -a upgrade head

D sr.ht/meta.sr.ht/meta.sr.ht.gunicorn.conf.py => sr.ht/meta.sr.ht/meta.sr.ht.gunicorn.conf.py +0 -5
@@ 1,5 0,0 @@
from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

D sr.ht/metrics.sr.ht/APKBUILD => sr.ht/metrics.sr.ht/APKBUILD +0 -30
@@ 1,30 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=metrics.sr.ht
_commit=60e2d4b9808c4dc8baaefe41fc85674e5432dca5
pkgver=0_git20200105
pkgrel=0
pkgdesc="SourceHut Prometheus rules"
url="https://git.sr.ht/~sircmpwn/metrics.sr.ht"
arch="noarch"
license="MIT"
checkdepends="prometheus"
install="$pkgname.post-upgrade"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$_commit.tar.gz
"
builddir="$srcdir/$pkgname-$_commit"

check() {
	promtool check rules *.yml
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/etc/prometheus
	for f in *.yml
	do
		install -Dm644 -t "$pkgdir"/etc/prometheus/ "$f"
	done
}

sha512sums="34e365f22cbf787d6313776bb03997cfd74b46c94596743d6dda4b451b86cf2f11c20eef87b551cc7ac5a92c3879a84b80542e923cce765a4bef62f62b030e3d  metrics.sr.ht-rules-0_git20200105.tar.gz"

D sr.ht/metrics.sr.ht/metrics.sr.ht.post-upgrade => sr.ht/metrics.sr.ht/metrics.sr.ht.post-upgrade +0 -2
@@ 1,2 0,0 @@
#!/bin/sh
service prometheus reload

D sr.ht/pages.sr.ht/APKBUILD => sr.ht/pages.sr.ht/APKBUILD +0 -37
@@ 1,37 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=pages.sr.ht
pkgver=0.4.8
pkgrel=0
pkgdesc="sr.ht web hosting service"
url="https://git.sr.ht/~sircmpwn/pages.sr.ht"
arch="all"
license="AGPLv3"
depends="mailcap"
makedepends="go"
subpackages="$pkgname-openrc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	pages.sr.ht.initd
	pages.sr.ht.confd
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install"

build() {
	make all
}

package() {
	install -Dm755 pages.sr.ht "$pkgdir"/usr/bin/pages.sr.ht
	install -Dm755 "$srcdir"/pages.sr.ht.initd \
		"$pkgdir"/etc/init.d/pages.sr.ht
	install -Dm644 "$srcdir"/pages.sr.ht.confd \
		"$pkgdir"/etc/conf.d/pages.sr.ht
}

sha512sums="
c6d30f7b3455ebe1c3535e6fdf65597b8957669c8eab7fca62cf5150f011f57a51a8ecf13c66ac035112e3db599fe210f2ea9b136ab2ac3e61ea2c19f830930a  pages.sr.ht-0.4.8.tar.gz
8f9b081409ac62996efea682da585a07fdc9390f6dc94cc567d80499a151793f46c7772cd8949eb5f7de30b4edda3a8e1f5e32bd9d64b29b972b92c37d397096  pages.sr.ht.initd
fe18b2df0f90104f2978b037992214746352ff97f680bc32b2c2c5dc5e0b63ad61b94f221d33fbb28a5fb6a76f3280436bfd6df0beb1792f98cec2406a878050  pages.sr.ht.confd
"

D sr.ht/pages.sr.ht/pages.sr.ht.confd => sr.ht/pages.sr.ht/pages.sr.ht.confd +0 -5
@@ 1,5 0,0 @@
# Run the daemon as this user:
# PAGES_USER=pages

# Bind the API service to this address:
# PAGES_BIND=:5112

D sr.ht/pages.sr.ht/pages.sr.ht.initd => sr.ht/pages.sr.ht/pages.sr.ht.initd +0 -23
@@ 1,23 0,0 @@
#!/sbin/openrc-run
name="pages.sr.ht"
description="pages.sr.ht API service"
supervisor=supervise-daemon
PAGES_USER=${PAGES_USER:-pages}
PAGES_BIND=${PAGES_BIND:-:5112}
LOGS=/var/log/pages.sr.ht.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/pages.sr.ht"
command_args="-b $PAGES_BIND"
command_user="$PAGES_USER:$PAGES_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$PAGES_USER:$PAGES_USER"
}

D sr.ht/pages.sr.ht/pages.sr.ht.post-install => sr.ht/pages.sr.ht/pages.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S pages || true
adduser -SDH -s /sbin/nologin -G pages -g pages pages || true

D sr.ht/paste.sr.ht/APKBUILD => sr.ht/paste.sr.ht/APKBUILD +0 -64
@@ 1,64 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=paste.sr.ht
pkgver=0.13.6
pkgrel=0
pkgdesc="sr.ht paste service"
url="https://git.sr.ht/~sircmpwn/paste.sr.ht"
arch="all"
license="AGPLv3"
depends="
	py3-gunicorn
	py3-srht
	py3-yaml
"
makedepends="py-setuptools nodejs sassc go"
subpackages="$pkgname-openrc $pkgname-nginx:_nginx"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/$pkgname/archive/$pkgver.tar.gz
	sr.ht-nginx-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/master.tar.gz
	paste.sr.ht.initd
	paste.sr.ht.confd
	paste.sr.ht-api.initd
	paste.sr.ht-api.confd
	paste.sr.ht.gunicorn.conf.py
"
export PKGVER=$pkgver
options="$options !check"
install="$pkgname.post-install $pkgname.post-upgrade"

build() {
	python3 setup.py build
	make
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	install -Dm755 "$srcdir"/paste.sr.ht.initd \
		"$pkgdir"/etc/init.d/paste.sr.ht
	install -Dm644 "$srcdir"/paste.sr.ht.confd \
		"$pkgdir"/etc/conf.d/paste.sr.ht
	install -Dm755 "$srcdir"/paste.sr.ht-api.initd \
		"$pkgdir"/etc/init.d/paste.sr.ht-api
	install -Dm644 "$srcdir"/paste.sr.ht-api.confd \
		"$pkgdir"/etc/conf.d/paste.sr.ht-api
	install -Dm644 "$srcdir"/paste.sr.ht.gunicorn.conf.py \
		"$pkgdir"/etc/sr.ht/paste.sr.ht.gunicorn.conf.py
	install -Dm755 api/api "$pkgdir"/usr/bin/pastesrht-api
}

_nginx() {
	depends="sr.ht-nginx"
	pkgdesc="nginx configuration for $pkgname"
	install -Dm644 "$srcdir/sr.ht-nginx-master/paste.sr.ht.conf" \
		"$subpkgdir"/etc/nginx/http.d/paste.sr.ht.conf
}

sha512sums="
f52d1b53795920f922052b18614b4ca53288fc72041bc32818da0d9353fa45b164e59da85b9ee6159a3196521f8ced5bc3794d2f77d4e9d2c80b4325178b5a46  paste.sr.ht-0.13.6.tar.gz
1b447f5c7f3aabd61afac0f41352d18a65fa9e27d7c3ddbb84730819da533ef815023a15f0ffb80fba13434ed10fd0171b06c7cf7388b353fb5cee17a2431158  sr.ht-nginx-0.13.6.tar.gz
c6cf45c795f82493a2779c12d67af3ae934d171c4ec81e1a4d36c411b8ff7234bc6ba396a411781e9dfc861557a9223066b5342b5fa9908d1b1bf08f1a12466f  paste.sr.ht.initd
dea54d754186f6bc67c8ca3ef6cc5236355cdc9962aa502d4138245bdcba7edb804b627fcfbf4909fc54bed08ef44ce635947982ff3cb69f3dac0bb6bd55abb3  paste.sr.ht.confd
263f268ba32fef424d8b44af76fa9c94a309c75d2d8c40f46b6556c713c590744edb6e78810b3d9c7a1d037d314c12e034d5e2cee4b46c92851a5e65dfb4f3a3  paste.sr.ht-api.initd
e226a1a3913749c5a72e57c2e6f75f94199f47c72d47ccbac5abba3bc30b827d8619c2f1a60ef2b67f28074007a051981f47d4d2c749da4c5e5e9d1823f54dbf  paste.sr.ht-api.confd
21f39ea0981d7773eb512e5ba234022364d0f7ee9b6ca897ce4c51e3b127eb2d9a7a5fbcaa06d14f20b2df2439421d7261f200e3f4f13b45a91e78ba77bc363c  paste.sr.ht.gunicorn.conf.py
"

D sr.ht/paste.sr.ht/paste.sr.ht-api.confd => sr.ht/paste.sr.ht/paste.sr.ht-api.confd +0 -8
@@ 1,8 0,0 @@
# Run the daemon as this user:
# PASTE_USER=paste

# Bind the API service to this address:
# PASTE_BIND=:5111

# Extra arguments to pass to Gunicorn
# PASTE_ARGS=

D sr.ht/paste.sr.ht/paste.sr.ht-api.initd => sr.ht/paste.sr.ht/paste.sr.ht-api.initd +0 -23
@@ 1,23 0,0 @@
#!/sbin/openrc-run
name="paste.sr.ht-api"
description="paste.sr.ht API service"
supervisor=supervise-daemon
PASTE_USER=${PASTE_USER:-paste}
PASTE_BIND=${PASTE_BIND:-:5111}
PASTE_ARGS=${PASTE_ARGS:-}
LOGS=/var/log/paste.sr.ht-api.log
supervise_daemon_args="-1 $LOGS -2 $LOGS"
command="/usr/bin/pastesrht-api"
command_args="-b $PASTE_BIND"
command_user="$PASTE_USER:$PASTE_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$PASTE_USER:$PASTE_USER"
}

D sr.ht/paste.sr.ht/paste.sr.ht.confd => sr.ht/paste.sr.ht/paste.sr.ht.confd +0 -11
@@ 1,11 0,0 @@
# Run the daemon as this user:
# PASTE_USER=paste

# Bind the web service to this address:
# PASTE_BIND=127.0.0.1:5011

# Gunicorn configuration file
# PASTE_GUNICORN_CONF=/etc/sr.ht/paste.sr.ht.gunicorn.conf.py

# Extra arguments to pass to Gunicorn
# PASTE_ARGS=

D sr.ht/paste.sr.ht/paste.sr.ht.gunicorn.conf.py => sr.ht/paste.sr.ht/paste.sr.ht.gunicorn.conf.py +0 -5
@@ 1,5 0,0 @@
from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

D sr.ht/paste.sr.ht/paste.sr.ht.initd => sr.ht/paste.sr.ht/paste.sr.ht.initd +0 -32
@@ 1,32 0,0 @@
#!/sbin/openrc-run
name="paste.sr.ht"
description="paste.sr.ht service"
supervisor=supervise-daemon
PASTE_USER=${PASTE_USER:-paste}
PASTE_BIND=${PASTE_BIND:-127.0.0.1:5011}
PASTE_GUNICORN_CONF=${PASTE_GUNICORN_CONF:-/etc/sr.ht/paste.sr.ht.gunicorn.conf.py}
PASTE_ARGS=${PASTE_ARGS:-}
LOGS=/var/log/paste.sr.ht.log
prometheus_multiproc_dir=/run/paste.sr.ht
supervise_daemon_args="-1 $LOGS -2 $LOGS -e prometheus_multiproc_dir=$prometheus_multiproc_dir"
command="/usr/bin/gunicorn"
command_args="pastesrht.app:app -b $PASTE_BIND  -c $PASTE_GUNICORN_CONF $PASTE_ARGS"
command_user="$PASTE_USER:$PASTE_USER"
pidfile="/run/${RC_SVCNAME}.pid"

depend() {
	need net
	use redis
	use postgresql
	use pgbouncer
}

start_pre() {
	checkpath -f "$LOGS" -m 644 -o "$PASTE_USER:$PASTE_USER"
	# Workaround for https://github.com/OpenRC/openrc/issues/335
	if [ -n "$prometheus_multiproc_dir" ]
	then
		checkpath -d "$prometheus_multiproc_dir" -m 775 -o "$PASTE_USER:$PASTE_USER"
		rm -rf "$prometheus_multiproc_dir"/*
	fi
}

D sr.ht/paste.sr.ht/paste.sr.ht.post-install => sr.ht/paste.sr.ht/paste.sr.ht.post-install +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
addgroup -S paste || true
adduser -SDH -s /sbin/nologin -G paste -g paste paste || true

D sr.ht/paste.sr.ht/paste.sr.ht.post-upgrade => sr.ht/paste.sr.ht/paste.sr.ht.post-upgrade +0 -3
@@ 1,3 0,0 @@
#!/bin/sh
srht-migrate paste.sr.ht -a upgrade head
pastesrht-migrate -a upgrade head

D sr.ht/prom-aggregation-gateway/APKBUILD => sr.ht/prom-aggregation-gateway/APKBUILD +0 -47
@@ 1,47 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=prom-aggregation-gateway
_commit=c4415bbe1411d77eb4132f3df51c87cf7fcca840
pkgver=0_git20210208
pkgrel=0
pkgdesc="An aggregating push gateway for Prometheus"
url="https://github.com/weaveworks/prom-aggregation-gateway"
arch="all"
license="LGPL-3.0-only"
install="prom-aggregation-gateway.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/weaveworks/prom-aggregation-gateway/archive/$_commit.tar.gz
	prom-aggregation-gateway.confd
	prom-aggregation-gateway.initd
"
subpackages="$pkgname-openrc"
builddir="$srcdir/$pkgname-$_commit"

build() {
	go mod init github.com/weaveworks/prom-aggregation-gateway
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS" \
		./cmd/prom-aggregation-gateway
}

check() {
	go test ./...
}

package() {
	install -Dm755 prom-aggregation-gateway "$pkgdir"/usr/bin/prom-aggregation-gateway

	install -Dm644 "$srcdir"/prom-aggregation-gateway.confd \
		"$pkgdir"/etc/conf.d/prom-aggregation-gateway
	install -Dm755 "$srcdir"/prom-aggregation-gateway.initd \
		"$pkgdir"/etc/init.d/prom-aggregation-gateway
}

sha512sums="
50c916a7378c537fe9eb9b70ca8aac64ca5b929323859ab075232ca2c6ef033192bfb5d056fc128c51d9e7959ecc4a3f0f3788265cad610a4d8ddf36e8e42583  prom-aggregation-gateway-0_git20210208.tar.gz
51986d7caf241a52e81b2a43bb136fbe7110667ba8b75047feaeb3b0e02f82ee3be0e7b91bd795bd49d77bba5a7ac36aeec5a0f35b29c368e83527e77a94fe3c  prom-aggregation-gateway.confd
5fcfad70369189b5628fe80f08ab3e9cea029fc291b18606769ad14818330ea8157d9a7d68893a73b891118ea7dcea7c9980698c7a578f5f1ca1637e3699ac7d  prom-aggregation-gateway.initd
"

D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd => sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.confd +0 -4
@@ 1,4 0,0 @@
prom_aggregation_gateway_bind_address=':9092'

output_log=/var/log/prom-aggregation-gateway.log
error_log=/var/log/prom-aggregation-gateway.log

D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd => sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.initd +0 -15
@@ 1,15 0,0 @@
#!/sbin/openrc-run
name="prom-aggregation-gateway"
description="An aggregating push gateway for Prometheus"
supervisor=supervise-daemon
command=/usr/bin/prom-aggregation-gateway
command_args="-listen=$prom_aggregation_gateway_bind_address"
command_user="prometheus:prometheus"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

D sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install => sr.ht/prom-aggregation-gateway/prom-aggregation-gateway.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/pushgateway/APKBUILD => sr.ht/pushgateway/APKBUILD +0 -44
@@ 1,44 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=pushgateway
pkgver=1.4.2
pkgrel=0
pkgdesc="Prometheus push acceptor for ephemeral and batch jobs"
url="https://github.com/prometheus/pushgateway"
arch="all"
license="Apache-2.0"
install="pushgateway.pre-install"
makedepends="go yarn bash"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/prometheus/pushgateway/archive/v$pkgver.tar.gz
	pushgateway.confd
	pushgateway.initd
"
subpackages="$pkgname-openrc"
options="!check" # Broken by integrations we don't care about

build() {
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS"
}

check() {
	go test ./...
}

package() {
	install -Dm755 pushgateway "$pkgdir"/usr/bin/pushgateway

	install -Dm644 "$srcdir"/pushgateway.confd \
		"$pkgdir"/etc/conf.d/pushgateway
	install -Dm755 "$srcdir"/pushgateway.initd \
		"$pkgdir"/etc/init.d/pushgateway
}

sha512sums="
7b1da7eecf03c4f7b493d025920e93c52333becf7da6a2d7bdd0eb6f9a2a4a5d08b00786d0796682a465d84750e2c8092cdb1c4ca59a08f15b8b586d6eaa5f1a  pushgateway-1.4.2.tar.gz
39b797f6a38b02f84f94cfdbc5c860af060b044eaf98d7ec99909c4abcb9bf6112755bbd21460bfda9825b31715e403fedb6c88158072cd79d985429bcb5cf01  pushgateway.confd
903fd13fda99fd3095e362efa91deed3c88461384a4ed1d3edfaab8bb7a2f070f5004cefa7a1598ebfa0d20df074d0c70938680b94d672751b9326d35960d6b1  pushgateway.initd
"

D sr.ht/pushgateway/pushgateway.confd => sr.ht/pushgateway/pushgateway.confd +0 -4
@@ 1,4 0,0 @@
pushgateway_bind_address=':9091'

output_log=/var/log/pushgateway.log
error_log=/var/log/pushgateway.log

D sr.ht/pushgateway/pushgateway.initd => sr.ht/pushgateway/pushgateway.initd +0 -14
@@ 1,14 0,0 @@
#!/sbin/openrc-run
name="pushgateway"
description="Prometheus push acceptor for ephemeral and batch jobs"
supervisor=supervise-daemon
command=/usr/bin/pushgateway
command_args="--web.listen-address=$pushgateway_bind_address"
command_user="prometheus:prometheus"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

D sr.ht/pushgateway/pushgateway.pre-install => sr.ht/pushgateway/pushgateway.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus:' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus:' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/py3-aiosmtpd/APKBUILD => sr.ht/py3-aiosmtpd/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-aiosmtpd
_pyname=aiosmtpd
pkgver=1.4.2
pkgrel=1
pkgdesc="A reimplementation of the Python stdlib smtpd.py based on asyncio"
url="https://github.com/aio-libs/aiosmtpd"
arch="noarch"
license="Apache-2.0"
depends="py3-atpublic"
makedepends="python3-dev py3-setuptools"
checkdepends="py3-pytest py3-pytest-mock py3-pluggy"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-aiosmtpd"
builddir="$srcdir"/$_pyname-$pkgver
options="!check" # https://gitlab.alpinelinux.org/alpine/aports/-/issues/12503

build() {
	python3 setup.py build
}

check() {
	pytest-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="b910ae4c00b52f59b9f2199b296a1b76caa7567cbcd2e27c73d4ec894e9b48cd8190090083ce33b87dc924c4394a6425506355951208af65b89a6c1abe371114  aiosmtpd-1.4.2.tar.gz"

D sr.ht/py3-atpublic/APKBUILD => sr.ht/py3-atpublic/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-atpublic
_pyname=atpublic
pkgver=2.3
pkgrel=2
pkgdesc="@public for populating __all__"
url="https://gitlab.com/warsaw/public"
arch="noarch"
license="Apache-2.0"
makedepends="python3-dev py3-setuptools py3-pytest"
checkdepends="py3-sybil py3-pytest-cov"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-atpublic"
builddir="$srcdir"/$_pyname-$pkgver

build() {
	python3 setup.py build
}

check() {
	pytest-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
88c140c7ca0cfe3db791fd43a97f9fc63de979191a026df4d9f7a34a347b657d7d7b6fb7e31a231ac3adbc5e5d014b8e3c3606b93515a6ad42ea3d101b480329  atpublic-2.3.tar.gz
"

D sr.ht/py3-gitlab/APKBUILD => sr.ht/py3-gitlab/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=py3-gitlab
_pkgname=python-gitlab
pkgver=3.5.0
pkgrel=0
pkgdesc="v4 GitLab API compliant library and cmdline tool"
options="!check" # Requires unpackaged 'httmock'
url="https://github.com/python-gitlab/python-gitlab"
arch="noarch"
license="LGPL-3.0-or-later"
depends="python3 py3-requests py3-requests-toolbelt py3-six"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-mock"
source="https://files.pythonhosted.org/packages/source/p/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	py.test-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
fdc719f0cb0bf588390f0f6f0ffc4814bb5135156ecbe96cb4b381a7f93606a49773d1e8a34397a0f3b4522c8867704429070bae7bec6cf34b9e713f0a9c9189  python-gitlab-3.5.0.tar.gz
"

D sr.ht/py3-iso3166/APKBUILD => sr.ht/py3-iso3166/APKBUILD +0 -31
@@ 1,31 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-iso3166
_pyname=iso3166
pkgver=2.0.2
pkgrel=0
pkgdesc="Self-contained ISO 3166-1 country definitions for Python"
url="https://github.com/deactivated/python-iso3166"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	PYTHONPATH=. pytest-3
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
}

sha512sums="
eb5c27c69e29c4312f3a5146206032aae49ee489d9a5987fce1fb66bae9d93ec252bf7fd1119403a278f66adaa5ce1c77fe8d3a1622c46ae4a291d73e5c9fb21  iso3166-2.0.2.tar.gz
"

D sr.ht/py3-mwparserfromhell/APKBUILD => sr.ht/py3-mwparserfromhell/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-mwparserfromhell
_pyname=mwparserfromhell
pkgver=0.6.4
pkgrel=0
pkgdesc="A parser for MediaWiki wikicode"
url="https://pypi.org/project/mwparserfromhell/"
arch="all"
license="MIT"
depends="python3"
makedepends="py3-setuptools"
_pypiprefix="${_pyname%${_pyname#?}}"
source="
	https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz
"
builddir="$srcdir/$_pyname-$pkgver"

build() {
	python3 setup.py build
}

check() {
	python3 setup.py check
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
}

sha512sums="
6ea9996b22d0069a39cd4381ebec5dfb6831d0c3948ac31239ec760e8c53837ddff6c9888cb10219550854d9b4606ac9c2b8cc0a0a239fd0db5de7dd2311f1d1  mwparserfromhell-0.6.4.tar.gz
"

D sr.ht/py3-pydyf/APKBUILD => sr.ht/py3-pydyf/APKBUILD +0 -39
@@ 1,39 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-pydyf
_pyname=pydyf
pkgver=0.1.2
pkgrel=0
pkgdesc="A low-level PDF generator"
url="https://pypi.org/project/pydyf/"
arch="noarch"
license="BSD"
depends="python3"
checkdepends="
	py3-pytest py3-pytest-flake8 py3-pytest-isort py3-pytest-cov py3-coverage
	py3-pillow ghostscript
"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir/$_pyname-$pkgver"

prepare() {
	# If you're going to make your test suite fail on flake8 errors you should
	# at least run it before you ship a release
	sed -i pyproject.toml -e 's/ --flake8//'
}

build() {
	python3 setup.py build
}

check() {
	pytest
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
}

sha512sums="
0054791c92c86c188c6a70cfe83831319cd1a587f48ba4b8bd212af178bae24611815b5436699ea6d17fe1b39115a666b30a7982ac35e54ce1d52f34612c9729  pydyf-0.1.2.tar.gz
"

D sr.ht/py3-stripe/APKBUILD => sr.ht/py3-stripe/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-stripe
_pyname=stripe
pkgver=3.5.0
pkgrel=0
pkgdesc="Python library for the Stripe API"
url="https://github.com/stripe/stripe-python"
arch="noarch"
license="MIT"
depends="python3"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
makedepends="py3-setuptools py3-build py3-installer py3-wheel py3-requests"
checkdepends="py3-pytest"
builddir="$srcdir/$_pyname-$pkgver"
options="!check" # requires network access

build() {
	python3 -m build --no-isolation --wheel
}

check() {
	python3 -m pytest
}

package() {
	python3 -m installer -d"$pkgdir" dist/$_pyname-$pkgver-py2.py3-none-any.whl
}

sha512sums="
67e63f95b489e049d81d9b3929342a8cc2bc3638060d9f278752459d32408bfe8d5f09c4c047a1ed0deedce875b0a84873a3b120f6bb5f30c0668eda5129e4ee  stripe-3.5.0.tar.gz
"

D sr.ht/py3-unidiff/APKBUILD => sr.ht/py3-unidiff/APKBUILD +0 -32
@@ 1,32 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-unidiff
_pyname=unidiff
pkgver=0.7.4
pkgrel=0
pkgdesc="Unified diff python parsing/metadata extraction library"
url="https://pypi.org/project/unidiff/"
arch="noarch"
license="MIT"
makedepends="py3-setuptools py3-pytest"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
replaces="py-unidiff py2-unidiff"
builddir="$srcdir"/$_pyname-$pkgver
options="!check" # no upstream tests

build() {
	python3 setup.py build
}

check() {
	pytest-3
}

package() {
	python3 setup.py install --prefix=/usr --root="$pkgdir"
}

sha512sums="
cfbc7808d96c0aac2ce315b13a69253247f1ae011dede9ac67deed3ad1a66cbfb49e271a393613f952072f4b3b774906d2ea056c2b1b8aad23ae161a90552320  unidiff-0.7.4.tar.gz
"

D sr.ht/py3-weasyprint/APKBUILD => sr.ht/py3-weasyprint/APKBUILD +0 -54
@@ 1,54 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=py3-weasyprint
_pyname=weasyprint
pkgver=54.3
pkgrel=0
pkgdesc="cairo-based HTML renderer for python"
url="https://weasyprint.org"
arch="noarch"
license="BSD-3-Clause"
depends="
	pango cairo py3-cairocffi py3-cairosvg py3-cssselect2 py3-tinycss2
	py3-pyphen py3-lxml py3-pdfrw py3-fonttools py3-pydyf py3-html5lib
	py3-pillow
"
makedepends="py3-setuptools pyproject2setuppy"
checkdepends="
	py3-pytest
	py3-pytest-cov
	py3-pytest-isort
	py3-pytest-flake8
	py3-pytest-runner
	ghostscript
"
_pypiprefix="${_pyname%${_pyname#?}}"
source="https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz"
builddir="$srcdir"/$_pyname-$pkgver
options="!check" # shit's broke

prepare() {
	# Here's a cool idea: let's add a style linter to our test suite, then ship
	# releases with style errors so that our release tarballs have failing
	# tests! Brilliant!
	sed -i pyproject.toml -e 's/--isort//'
	for mod in formatting_structure text
	do
		touch weasyprint/$mod/__init__.py
	done
}

build() {
	python3 -m pyproject2setuppy.main build
}

check() {
	python3 -m pytest
}

package() {
	python3 -m pyproject2setuppy.main install --prefix=/usr --root="$pkgdir"
}

sha512sums="
4b11a2fedb2ae41b0752093a9af26c23122337ade0289e36045c2e666677f2234c43f27f12d22d571365294705458c7b34f8b2656ab3d9337f145d5b0292e92b  weasyprint-54.3.tar.gz
"

D sr.ht/rum/APKBUILD => sr.ht/rum/APKBUILD +0 -27
@@ 1,27 0,0 @@
# Contributor: Drew DeVault <sir@cmpwn.com>
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=rum
pkgver=1.3.11
pkgrel=0
pkgdesc="Inverted index with additional information in posting lists for Postgres"
url="https://postgis.net/"
arch="all"
license="PostgreSQL"
makedepends="postgresql-dev"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/postgrespro/rum/archive/refs/tags/$pkgver.tar.gz
"
options="!check" # must be run after install

build() {
	make USE_PGXS=1
}

package() {
	depends="$depends postgresql$(pg_config --major-version)"
	make USE_PGXS=1 DESTDIR="$pkgdir" install
}

sha512sums="
4720255a1d1534a294eb10a3e46993b6e5bb8a690b58a505319013ad7210627e26835ed8d417dd45dcb3f276a13d8e88f68405496a9ac39a361c19e1168a1b27  rum-1.3.11.tar.gz
"

D sr.ht/sachet/APKBUILD => sr.ht/sachet/APKBUILD +0 -52
@@ 1,52 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=sachet
pkgver=0.3.0
pkgrel=0
pkgdesc="Prometheus Alertmanager"
url="https://github.com/messagebird/sachet"
arch="all"
license="Apache-2.0"
install="$pkgname.pre-install"
makedepends="go"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/messagebird/sachet/archive/$pkgver.tar.gz
	sachet.confd
	sachet.initd
	sachet.yml
"
subpackages="$pkgname-openrc"

build() {
	go mod vendor
	go build \
		-trimpath \
		-mod=vendor \
		-ldflags "-extldflags $LDFLAGS" \
		./cmd/sachet
}

check() {
	go test ./...
}

package() {
	install -Dm755 sachet "$pkgdir"/usr/bin/sachet

	install -Dm755 "$srcdir"/sachet.initd \
		"$pkgdir"/etc/init.d/sachet
	install -Dm644 "$srcdir"/sachet.confd \
		"$pkgdir"/etc/conf.d/sachet

	mkdir -p "$pkgdir"/etc/alertmanager/templates
	install -Dm644 "$srcdir"/sachet.yml \
		"$pkgdir"/etc/alertmanager/sachet.yml
	install -Dm644 examples/telegram.tmpl \
		"$pkgdir"/etc/alertmanager/templates/telegram.tmpl
}

sha512sums="
82197fe8ad36bfc5ba4891f4f16a442180d057ada906166d401dd6ce1e7b43cf19ffa34f209a9b34640ae7fcf26c740fa1bddc7f9e79fc6d7b851c7b08ac4b62  sachet-0.3.0.tar.gz
efe429b994b3c139a3804055ea20fe4a8deaf17f58385b800487b4b8d363d1de817bcac751ae5c4cf16b228f896ff17eab19c5d49c7309174d8f0a07386fb772  sachet.confd
7db8607e588897b508f9515131391e4a650fdc9260f865cdb7e97ad978cfa73a779530826f712232ba1944611b5250aa241a8ce27f73cac32f8bcf68fa6b7c67  sachet.initd
579dd96a930ea02d33e5d084421f873d72b125f4314d7bd7170fe6705adce742abaa626297191779e7edb25a50c03e87b25fd4250f4c08cc175e0674724f2b1e  sachet.yml
"

D sr.ht/sachet/sachet.confd => sr.ht/sachet/sachet.confd +0 -5
@@ 1,5 0,0 @@
sachet_config_file=/etc/alertmanager/sachet.yml
sachet_listen_address=:9876

output_log=/var/log/sachet.log
error_log=/var/log/sachet.log

D sr.ht/sachet/sachet.initd => sr.ht/sachet/sachet.initd +0 -15
@@ 1,15 0,0 @@
#!/sbin/openrc-run
name="sachet"
description="SMS alerts for Prometheus' Alertmanager"
supervisor=supervise-daemon
command=/usr/bin/sachet
command_args="-config $sachet_config_file -listen-address $sachet_listen_address"
command_user="prometheus:prometheus"
pidfile="/run/${RC_SVCNAME}.pid"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o prometheus:prometheus
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o prometheus:prometheus
}

D sr.ht/sachet/sachet.pre-install => sr.ht/sachet/sachet.pre-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^prometheus' /etc/group >/dev/null || addgroup -S prometheus 2>/dev/null
grep '^prometheus' /etc/passwd >/dev/null || adduser -SDh/var/lib/prometheus \
	-s/sbin/nologin -Gprometheus -gprometheus prometheus prometheus 2>/dev/null

D sr.ht/sachet/sachet.yml => sr.ht/sachet/sachet.yml +0 -78
@@ 1,78 0,0 @@
providers:
  messagebird:
    access_key: 'live_qKwVZ02ULV70GqabBYxLU8d5r'
    debug: true
  nexmo:
    api_key: '18e0a6e9'
    api_secret: 'ea44c2d9'
  infobip:
    token: "sasasa"
    secret: "sasasa"
  kannel:
    # url: "http://localhost:13013/cgi-bin/sendsms"
    url: "http://httpbin.org/get"
    user: "tester"
    password: "foobar"
  exotel:
    account_sid: 'sachet'
    auth_token: 'bbba3f4afc0b4ee76c93e43b7c1b2d4350d1a0e8'
  twilio:
    account_sid: 'aCb3bbaacc554b'
    auth_token: '4736473aaabbcc66'
  turbosms:
    login: 'visla'
    password: '44444'
  cm:
    producttoken: '00000000-0000-0000-0000-000000000000'
  telegram:
    token: "724679217:aa26V5mK3e2qkGsSlTT-iHreaa5FUyy3Z_0"
  otc:
    identity_endpoint: https://iam.eu-de.otc.t-systems.com:443/v3/auth/tokens
    domain_name: domain_name
    project_name: project_name
    username: username
    password: password
    project_id: project_id
  mediaburst:
    api_key: 'aa66sdfasfsda7887fdsf7sdf87fsdf7sdf7dsfd'
  freemobile:
    username: 'my-user-name'
    password: 'secret'
    url: "https://smsapi.free-mobile.fr/sendmsg"
  aspsms:
    username: 'username'
    password: 'password'
  sipgate:
    username: 'username'
    password: 'password'
  pushbullet:
    access_token: 'o.AbCdEfGhIjKlMnOpQrStUvWxYz012345'
  nowsms:
    username: 'username'
    password: 'password'

templates:
  - /etc/sachet/telegram.tmpl

receivers:
  - name: 'team-sms'
    provider: 'messagebird'
    to:
      - '+919742033616'
    from: '08039591643'
  - name: 'team-chat'
    provider: 'telegram'
    to:
      - '164451814' # the chat id of a user. Get yours at https://telegram.me/userinfobot
    text: '{{ .GroupLabels.alertname }} @ {{ .Labels.instance }}: {{ .Status | toUpper }}'
  - name: 'pushbullet'
    provider: 'pushbullet'
    to:
      - device:My Nickname
      - channel:mytag
  - name: 'nowsms'
    provider: 'nowsms'
    to:
      - '332432432'
      - '4242334534'


D sr.ht/searchhut/APKBUILD => sr.ht/searchhut/APKBUILD +0 -58
@@ 1,58 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=searchhut
pkgver=0_git20220715
_commit=24e6800e3607263e3f7751957af18a8ebdb7af48
pkgrel=1
pkgdesc="Search engine"
url="https://searchhut.org"
license="AGPL-3.0"
arch="all"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
makedepends="go"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~sircmpwn/searchhut/archive/$_commit.tar.gz
	sh-api.initd
	sh-api.confd
	sh-web.initd
	sh-web.confd
	"
builddir="$srcdir/$pkgname-$_commit"
options="!check" # no upstream tests

export GOPATH="$srcdir"
export GOFLAGS="$GOFLAGS -trimpath -modcacherw"

build() {
	make
}

package() {
	mkdir -p "$pkgdir"/usr/bin
	for bin in sh-admin sh-api sh-index sh-search sh-web
	do
		cp $bin "$pkgdir"/usr/bin/
	done

	install -Dm755 "$srcdir"/sh-api.initd "$pkgdir"/etc/init.d/sh-api
	install -Dm644 "$srcdir"/sh-api.confd "$pkgdir"/etc/conf.d/sh-api
	install -Dm755 "$srcdir"/sh-web.initd "$pkgdir"/etc/init.d/sh-web
	install -Dm644 "$srcdir"/sh-web.confd "$pkgdir"/etc/conf.d/sh-web

	mkdir -p "$pkgdir"/etc/searchhut
	install -Dm644 config.example.ini "$pkgdir"/etc/searchhut/config.ini

	mkdir -p "$pkgdir"/usr/share/searchhut/templates
	mkdir -p "$pkgdir"/usr/share/searchhut/static
	install -Dm644 templates/* "$pkgdir"/usr/share/searchhut/templates
	install -Dm644 static/* "$pkgdir"/usr/share/searchhut/static
}

sha512sums="
9d67ae640b4b42df0a621e37c8baf6724d8579d53621febaf4159479e8a96353f92a72e484716592804f0e57427e53007ccb5e73765865f5fce62584088aba28  searchhut-0_git20220715.tar.gz
682a3eccdc59603392bb29ecdfaef07353dcf03d73be4e4a34f4658fada4849163abac2049d9fc988710e47c03b95db4806c7c6f8e4946c177d998f1a838f11d  sh-api.initd
37704c27c178c1e1f7d7475769ec62c5a76cf3acd8e2ab5d981b665d77c21b6135ea73f27b2b79a158fbff814bcdadbc11f31f09c9212064967c712b3bc7907c  sh-api.confd
fc7998ef7de051b4288387b5a172293a0fb6402dc6f6facdfa02f8aa628d4d307e0d2e94f40dfbd4a6bab066961d1af6a8c88bb61fe7b589748a6be0a7b0ef37  sh-web.initd
798824b3100e41de019ccd86f565094826b7a33369f97b07ce33da323817f95b401e07fc73c3d9e3302955a1284b086d18e5355182294f07d301dbbc30ffd278  sh-web.confd
"

D sr.ht/searchhut/searchhut.pre-install => sr.ht/searchhut/searchhut.pre-install +0 -6
@@ 1,6 0,0 @@
#!/bin/sh
user=searchhut
group=searchhut

addgroup -S $group 2>/dev/null || true
adduser -S -D -h /var/lib/$user -s /sbin/nologin -G $group -g $user $user 2>/dev/null || true

D sr.ht/searchhut/sh-api.confd => sr.ht/searchhut/sh-api.confd +0 -4
@@ 1,4 0,0 @@
# Configuration for /etc/init.d/sh-api

# log destination
error_log=/var/log/sh-api.log

D sr.ht/searchhut/sh-api.initd => sr.ht/searchhut/sh-api.initd +0 -10
@@ 1,10 0,0 @@
#!/sbin/openrc-run
name="sh-api"
description="Search engine API"
supervisor=supervise-daemon
command=/usr/bin/sh-api
command_user=searchhut:searchhut

start_pre() {
	[ -n "$error_log" ] && checkpath -f -o $command_user "$error_log"
}

D sr.ht/searchhut/sh-web.confd => sr.ht/searchhut/sh-web.confd +0 -4
@@ 1,4 0,0 @@
# Configuration for /etc/init.d/sh-web

# log destination
error_log=/var/log/sh-web.log

D sr.ht/searchhut/sh-web.initd => sr.ht/searchhut/sh-web.initd +0 -11
@@ 1,11 0,0 @@
#!/sbin/openrc-run
name="sh-web"
description="Search engine web frontend"
supervisor=supervise-daemon
command=/usr/bin/sh-web
command_user=searchhut:searchhut
directory="/usr/share/searchhut"

start_pre() {
	[ -n "$error_log" ] && checkpath -f -o $command_user "$error_log"
}

D sr.ht/soju/APKBUILD => sr.ht/soju/APKBUILD +0 -50
@@ 1,50 0,0 @@
# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=soju
pkgver=0.5.0
pkgrel=2
pkgdesc="User-friendly IRC bouncer"
url="https://soju.im/"
license="AGPL-3.0"
arch="all"
options="chmod-clean !check"
pkgusers="$pkgname"
pkggroups="$pkgname"
install="$pkgname.pre-install"
depends="ca-certificates"
makedepends="go scdoc libcap"
subpackages="$pkgname-openrc $pkgname-doc"
githash=4f97edf7986f2b590f56cdb5788a8f3980cb2059 # branch srht
source="$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/soju/archive/$githash.tar.gz
	$pkgname.initd
	$pkgname.confd
	"
builddir="$srcdir/$pkgname-$githash"

export GOPATH="$srcdir"
export GOFLAGS="$GOFLAGS -trimpath"

build() {
	make
}

check() {
	go test ./...
}

package() {
	make DESTDIR="$pkgdir" PREFIX=/usr install
	setcap 'cap_net_bind_service=+ep' "$pkgdir"/usr/bin/soju

	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname

	# add additional docs
	install -Dm644 -t "$pkgdir"/usr/share/doc/$pkgname doc/architecture.md
}

sha512sums="
4d9cebc937c7deeaa1107ac39e9926249f50c78dda02730f52e05e50fea746fe2c6f5df73d9e60cfbdea4f7f711835e5f4238dad8b5a6a9085af7aeda241d947  soju-0.5.0.tar.gz
6072c070b7bdaea08406d60816c74752e5a037c56f823b35333311f1ae3328d7e9dcab22c5a82c8628cbdc92b505e4c2ea989a5118491feb82a44efe84216d06  soju.initd
daca27e5deb5135b406e4160504efa011219147465c2f2b484b92db0aa9174173e37c62d32109937df3d2e8c430625e0ec25956775dd92f7fa1f55b19e0e8a18  soju.confd
"

D sr.ht/soju/soju.confd => sr.ht/soju/soju.confd +0 -7
@@ 1,7 0,0 @@
# Configuration for /etc/init.d/soju

# additional arguments to pass to the daemon
command_args="-config /etc/soju/config"

# log destination
error_log=/var/log/soju.log

D sr.ht/soju/soju.initd => sr.ht/soju/soju.initd +0 -28
@@ 1,28 0,0 @@
#!/sbin/openrc-run
supervisor=supervise-daemon

name="soju"
description="User-friendly IRC bouncer"

command=/usr/bin/soju
command_user=soju:soju
directory="/var/lib/$RC_SVCNAME"

extra_started_commands="reload"
description_reload="Reload TLS certificate"

depend() {
	need net localmount
	after firewall
}

start_pre() {
	checkpath --directory --owner $command_user --mode 0775 "$directory"
	[ -n "$error_log" ] && checkpath -f -o $command_user "$error_log"
}

reload() {
	ebegin "Reloading TLS certificate"
	$supervisor $RC_SVCNAME --signal HUP
	eend $?
}

D sr.ht/soju/soju.pre-install => sr.ht/soju/soju.pre-install +0 -9
@@ 1,9 0,0 @@
#!/bin/sh

user=soju
group=soju

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

D sr.ht/sr.ht-nginx/APKBUILD => sr.ht/sr.ht-nginx/APKBUILD +0 -38
@@ 1,38 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=sr.ht-nginx
pkgver=0_git20220409
_commit=31237ce40dc802ea5526addfa1449ddc80d212fd
pkgrel=0
pkgdesc="sr.ht common nginx files"
url="https://git.sr.ht/~sircmpwn/sr.ht-nginx"
arch="noarch"
license="AGPLv3"
depends="nginx"
replaces="nginx" # To overwrite nginx.conf
source="
	https://git.sr.ht/~sircmpwn/sr.ht-nginx/archive/$_commit.tar.gz
"
builddir="$srcdir/$pkgname-$_commit"
options="$options !check"

build() {
	true # no-op
}

package() {
	mkdir -p "$pkgdir"/etc/nginx
	install -Dm644 graphql.conf "$pkgdir"/etc/nginx/graphql.conf
	install -Dm644 headers.conf "$pkgdir"/etc/nginx/headers.conf
	install -Dm644 nginx.conf "$pkgdir"/etc/nginx/nginx.conf
	install -Dm644 port443.conf "$pkgdir"/etc/nginx/port443.conf
	install -Dm644 port80.conf "$pkgdir"/etc/nginx/port80.conf
	install -Dm644 sourcehut.conf "$pkgdir"/etc/nginx/sourcehut.conf
	install -Dm644 web.conf "$pkgdir"/etc/nginx/web.conf

	mkdir -p "$pkgdir"/var/www
	install -Dm644 robots.txt "$pkgdir"/var/www/robots.txt
}

sha512sums="
7f19929c0967b995a79d8e84b67439f4bde591ec0e44942f03b66037871d5c076bbfe531056a5ad403420614892a978fb494808b6d503bdc484ebdb8673a3983  31237ce40dc802ea5526addfa1449ddc80d212fd.tar.gz
"

D sr.ht/sr.ht-uacme/APKBUILD => sr.ht/sr.ht-uacme/APKBUILD +0 -53
@@ 1,53 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=sr.ht-uacme
pkgver=1.0
pkgrel=6
pkgdesc="sr.ht acme configuration & utilities"
url="https://sr.ht/~sircmpwn/sr.ht"
arch="noarch"
license="MIT"
depends="uacme openssl moreutils doas"
pkgusers="acme"
pkggroups="acme"
install="$pkgname.pre-install"
source="
	acme-update-certs
	crontab
	uacme.conf
	doas.conf
"
options="$options !check"

build() {
	true # no-op
}

package() {
	mkdir -p "$pkgdir"/usr/bin
	install -Dm755 acme-update-certs "$pkgdir"/usr/bin/acme-update-certs

	mkdir -p "$pkgdir"/etc
	install -Dm644 uacme.conf "$pkgdir"/etc/uacme.conf

	mkdir -p "$pkgdir"/etc/doas.d
	install -Dm644 doas.conf "$pkgdir"/etc/doas.d/10-uacme.conf

	mkdir -p "$pkgdir"/etc/crontabs
	install -Dm600 -oacme -gacme crontab "$pkgdir"/etc/crontabs/acme

	mkdir -p "$pkgdir"/var/log
	install -Dm644 -oacme -gacme /dev/null "$pkgdir"/var/log/acme.log

	install -dm775 -oacme -gacme "$pkgdir"/etc/ssl/uacme
	install -dm770 -oacme -gacme "$pkgdir"/etc/ssl/uacme/private
	# XXX: This user/group does not seem to stick when the package is installed:
	# https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10048
	install -dm755 -oacme -gacme "$pkgdir"/var/www/.well-known/acme-challenge
}

sha512sums="
032482a8f76164aa00a71ec31a34d679c5b3403b9b1b150f954ba5808cb6bb524f77a9d11d673d07e1aa3d9108b0af21247888429533cd580d90df80bc465ea7  acme-update-certs
ebd161435985ffbd36de6f16a6daa82702ef32e23841eb8257c2cda5a546462a213da913f8bc7979b84a22667b5def4973e899ac7236d63737c2a9d969bf832d  crontab
51e397f4a6ce4b66135560d9f82baa31097285ebf71e045c3c89ac9dee895fc0c05ad130c45ea85634b7a49b29bcbecc5d2cd6912f44a88196694686dc1d6220  uacme.conf
bba47979d11da452a31c21312a688d4648fa8773fbde02a1af00c17a484e81736066b76247720cba6f6e686dbc83c0c35ca9885f4f67fb16822817dfc07694f8  doas.conf
"

D sr.ht/sr.ht-uacme/acme-update-certs => sr.ht/sr.ht-uacme/acme-update-certs +0 -27
@@ 1,27 0,0 @@
#!/bin/sh -eu
exec >>/var/log/acme.log 2>&1
date

stats() {
	cert="/etc/ssl/uacme/$1/cert.pem"
	if ! [ -e "$cert" ]
	then
		return
	fi
	expiration=$(date -d"$(openssl x509 -enddate -noout -in "$cert" \
		| cut -d= -f2)" -D'%b %d %H:%M:%S %Y GMT' +'%s')
	printf '# TYPE certificate_expiration gauge\n'
	printf '# HELP certificate_expiration Timestamp when SSL certificate will expire\n'
	printf 'certificate_expiration{instance="%s"} %s\n' "$1" "$expiration"
}

acme() {
	site=$1
	shift
	/usr/bin/uacme -v -h /usr/share/uacme/uacme.sh issue $site $* || true
	stats $site | curl --data-binary @- https://push.metrics.sr.ht/metrics/job/$site
}

source /etc/uacme.conf
chmod -R g+rX /etc/ssl/uacme /etc/ssl/uacme/private
doas nginx -s reload

D sr.ht/sr.ht-uacme/crontab => sr.ht/sr.ht-uacme/crontab +0 -2
@@ 1,2 0,0 @@
MAILTO=root
0 0 * * * chronic /usr/bin/acme-update-certs

D sr.ht/sr.ht-uacme/doas.conf => sr.ht/sr.ht-uacme/doas.conf +0 -1
@@ 1,1 0,0 @@
permit nopass acme cmd nginx args -s reload

D sr.ht/sr.ht-uacme/sr.ht-uacme.pre-install => sr.ht/sr.ht-uacme/sr.ht-uacme.pre-install +0 -5
@@ 1,5 0,0 @@
#!/bin/sh
addgroup -S acme || true
adduser -SD -h /var/empty -s /sbin/nologin -G acme -g acme acme || true
echo "Run the following command to finish configuring uacme:"
echo "doas -u acme uacme new <email address>"

D sr.ht/sr.ht-uacme/uacme.conf => sr.ht/sr.ht-uacme/uacme.conf +0 -4
@@ 1,4 0,0 @@
# Add domains here in the following format:
#	acme <domain> <subdomains...>
# e.g.
#	acme example.org foo.example.org bar.example.org

D sr.ht/tlstunnel/APKBUILD => sr.ht/tlstunnel/APKBUILD +0 -40
@@ 1,40 0,0 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=tlstunnel
pkgver=0.1.3
pkgrel=1
pkgdesc="A TLS reverse proxy"
url="https://git.sr.ht/~emersion/tlstunnel"
arch="all"
license="MIT"
install="$pkgname.post-install $pkgname.post-upgrade"
depends="libcap"
makedepends="go scdoc"
source="
	$pkgname-$pkgver.tar.gz::https://git.sr.ht/~emersion/tlstunnel/refs/download/v$pkgver/tlstunnel-$pkgver.tar.gz
	tlstunnel.confd
	tlstunnel.initd
"
subpackages="$pkgname-openrc $pkgname-doc"

build() {
	make PREFIX="/usr"
}

check() {
	go test ./...
}

package() {
	make install DESTDIR="$pkgdir" PREFIX="/usr"

	install -Dm755 "$srcdir"/tlstunnel.initd \
		"$pkgdir"/etc/init.d/tlstunnel
	install -Dm644 "$srcdir"/tlstunnel.confd \
		"$pkgdir"/etc/conf.d/tlstunnel
}

sha512sums="
551d7ddf09bae5b244fd75c869089d2fa8c63e3c36aa3488adb7bf54bddf2e1af312e53f58aacbb32ac9d0c0cefbc24a8cbb1585da363828043c1980e311bd11  tlstunnel-0.1.3.tar.gz
a13dd2d351b3290f7b80fbd9197b39e41959219321f4f105f9deaad0ab5c1f0f4a893f336d1dc645e613e319be5fe79663058038aa7a35136a4882ef3c68bc97  tlstunnel.confd
3cd75935df15a9d65081747d6be2bed5593957631a831dea19d8854c74773703624a045a52c7bd65d7e77907abd1355f4f131c782ecdc42e03d9b6f6ac41abd5  tlstunnel.initd
"

D sr.ht/tlstunnel/tlstunnel.confd => sr.ht/tlstunnel/tlstunnel.confd +0 -2
@@ 1,2 0,0 @@
output_log=/var/log/tlstunnel.log
error_log=/var/log/tlstunnel.log

D sr.ht/tlstunnel/tlstunnel.initd => sr.ht/tlstunnel/tlstunnel.initd +0 -15
@@ 1,15 0,0 @@
#!/sbin/openrc-run
name="tlstunnel"
description="TLS reverse proxy"
supervisor=supervise-daemon
CERTSTORE=/var/lib/tlstunnel
command=/usr/bin/tlstunnel
command_user="tlstunnel:tlstunnel"

start_pre() {
	[ -n "$output_log" ] && checkpath -f "$output_log" \
		-m 644 -o $command_user
	[ -n "$error_log" ] && checkpath -f "$error_log" \
		-m 644 -o $command_user
	checkpath -d "$CERTSTORE" -m 755 -o $command_user
}

D sr.ht/tlstunnel/tlstunnel.post-install => sr.ht/tlstunnel/tlstunnel.post-install +0 -4
@@ 1,4 0,0 @@
#!/bin/sh
grep '^tlstunnel' /etc/group >/dev/null || addgroup -S tlstunnel 2>/dev/null
grep '^tlstunnel' /etc/passwd >/dev/null || adduser -SDh/var/lib/tlstunnel \
	-s/sbin/nologin -Gtlstunnel -gtlstunnel tlstunnel tlstunnel 2>/dev/null

D sr.ht/tlstunnel/tlstunnel.post-upgrade => sr.ht/tlstunnel/tlstunnel.post-upgrade +0 -2
@@ 1,2 0,0 @@
#!/bin/sh
setcap 'cap_net_bind_service=+ep' /usr/bin/tlstunnel

D sr.ht/todo.sr.ht/todo.sr.ht.gunicorn.conf.py => sr.ht/todo.sr.ht/todo.sr.ht.gunicorn.conf.py +0 -5
@@ 1,5 0,0 @@
from prometheus_client import multiprocess


def child_exit(server, worker):
    multiprocess.mark_process_dead(worker.pid)

D submit-builds => submit-builds +0 -66
@@ 1,66 0,0 @@
#!/bin/sh
upstream=https://builds.sr.ht
manifest=build.yml

if [ -e ~/.config/sr.ht ]
then
	. ~/.config/sr.ht
fi

while getopts m:u:t:h flag
do
	case $flag in
		u)
			upstream="$OPTARG"
			;;
		t)
			bearer_token="$OPTARG"
			;;
		m)
			manifest="$OPTARG"
			;;
		h)
			echo "Usage: $0 [-u https://upstream...] [-t oauth token] <packages...>"
			exit 0
			;;
	esac
done
shift $((OPTIND-1))

builds=""
note=""
for target in $*
do
	if [ "$builds" = "" ]
	then
		builds="'${target#sr.ht/}'"
		note="${target#sr.ht/}"
	else
		builds="$builds, '${target#sr.ht/}'"
		if [ "${#note}" -lt 128 ]
		then
			note="$note, ${target#sr.ht/}"
		fi
	fi
done

vars="$(sed "s/packages: \\[\\]/packages: [$builds]/g" < $manifest | jq -sR '{
	"manifest": .,
	"tags": ["sr.ht-apkbuilds"],
	"note": "'"$note"'"
}')"
query="$(jq -sR '.' <<"EOF"
mutation SubmitJob($manifest: String!, $tags: [String!]!, $note: String!) {
	submit(manifest: $manifest, tags: $tags, note: $note) {
		id, tags
	}
}
EOF
)"

curl --oauth2-bearer "$bearer_token" \
	-H Content-Type:application/json \
	-d '{
		"query": '"$query"',
		"variables": '"$vars"'
	}' "$upstream/query" | jq .