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