ayaports/user/tandoor-recipes/APKBUILD

133 lines
4.3 KiB
Text

# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=tandoor-recipes
pkgver=1.5.12
pkgrel=1
pkgdesc="Application for managing recipes, planning meals, building shopping lists, etc."
# FTBFS
# arch="noarch"
url="https://github.com/TandoorRecipes/recipes"
license="AGPL-3.0-only"
depends="
postgresql
postgresql-contrib
procps-ng
pwgen
py3-beautifulsoup4
py3-bleach
py3-boto3
py3-crispy-bootstrap4
py3-cryptography
py3-django
py3-django-allauth
py3-django-annoying
py3-django-auth-ldap
py3-django-autocomplete-light
py3-django-cleanup
py3-django-cors-headers
py3-django-crispy-forms
py3-django-debug-toolbar
py3-django-hcaptcha
py3-django-js-reverse
py3-django-oauth-toolkit
py3-django-prometheus
py3-django-rest-framework
py3-django-scopes
py3-django-storages
py3-django-tables2
py3-django-treebeard
py3-django-webpack-loader
py3-dotenv
py3-drf-writable-nested
py3-gunicorn
py3-icalendar
py3-jinja2
py3-ldap
py3-lxml
py3-markdown
py3-microdata
py3-pillow
py3-psycopg2
py3-pyppeteer
py3-pytest
py3-pytest-django
py3-pytest-factoryboy
py3-pytube
py3-recipe-scrapers
py3-requests
py3-six
py3-uritemplate
py3-validators~0.20
py3-webdavclient3
py3-whitenoise
py3-yaml
nginx
xsel
"
makedepends="nodejs postgresql postgresql-libs py3-virtualenv nginx yarn npm"
source="
$pkgname-$pkgver.tar.gz::https://github.com/TandoorRecipes/recipes/archive/refs/tags/$pkgver.tar.gz
recipes.openrc
recipes.nginx
recipes-manage.sh
"
builddir="$srcdir"/recipes-$pkgver
install="$pkgname.post-install $pkgname.post-upgrade $pkgname.pre-install"
subpackages="$pkgname-openrc"
pkgusers="recipes"
pkggroups="recipes"
build() {
cd ./vue
msg "Building nodejs libraries"
yarn --cache-folder "$srcdir"/yarn-cache --ignore-engines install
yarn --cache-folder "$srcdir"/yarn-cache build
cd ../
msg "Building static files"
./manage.py collectstatic --no-input
./manage.py collectstatic_js_reverse
echo "TANDOOR_VERSION = '$pkgver'" > cookbook/version_info.py
echo "TANDOOR_REF = '$pkgver'" >> cookbook/version_info.py
echo "VERSION_INFO = [{'name': 'Tandoor ', 'version': '$pkgver', 'website': 'https://github.com/TandoorRecipes/recipes', 'commit_link': 'https://github.com/TandoorRecipes/recipes/releases/tag/$pkgver', 'ref': '$pkgver', 'branch': 'master', 'tag': '$pkgver'}]" >> cookbook/version_info.py
}
package() {
# install files
mkdir -p "$pkgdir"/usr/share/webapps/recipes
cp -r manage.py vue recipes staticfiles cookbook "$pkgdir"/usr/share/webapps/recipes
ln -s /etc/tandoor/recipes.conf "$pkgdir"/usr/share/webapps/recipes/.env
rm -rf \
"$pkgdir"/usr/share/webapps/recipes/vue/node_modules/.cache \
"$pkgdir"/usr/share/webapps/recipes/vue/node_modules/clipboardy/fallbacks
# openrc and configs
install -Dm755 "$srcdir"/recipes.openrc \
"$pkgdir"/etc/init.d/recipes
install -Dm755 "$srcdir"/recipes.nginx \
"$pkgdir"/etc/nginx/http.d/recipes.conf
install -Dm755 "$builddir"/nginx/conf.d/errorpages/http502.html \
"$pkgdir"/etc/nginx/http.d/errorpages/http502.html
install -Dm640 "$builddir"/.env.template \
"$pkgdir"/etc/tandoor/recipes.conf
chown root:www-data "$pkgdir"/etc/tandoor/recipes.conf
sed -i 's|SECRET_KEY=|SECRET_KEY=@@SECRET_KEY@@|' "$pkgdir"/etc/tandoor/recipes.conf
sed -i 's|POSTGRES_HOST.*|POSTGRES_HOST=127.0.0.1|' "$pkgdir"/etc/tandoor/recipes.conf
sed -i 's|POSTGRES_USER.*|POSTGRES_USER=recipes|' "$pkgdir"/etc/tandoor/recipes.conf
sed -i 's|POSTGRES_DB.*|POSTGRES_DB=recipes|' "$pkgdir"/etc/tandoor/recipes.conf
# Install wrapper script to /usr/bin.
install -m755 -D "$srcdir"/recipes-manage.sh \
"$pkgdir"/usr/bin/recipes-manage
# ln
ln -s /var/lib/recipes/media "$pkgdir"/usr/share/webapps/recipes/mediafiles
}
sha512sums="
ad1a6fafda996631dc162d16930e55498efea13564ce44e58efef887113bbe3479cb02188ab5aa05fb1dd78f85999fac774231fd34c750a33b00eab6ca4080d9 tandoor-recipes-1.5.12.tar.gz
6d53affec525207a86d8b26c6e5ac7a16586756520e5605f7fe1ea82212a93d051237da45893c8b4002a6663e7538d8e78ab7fc392dc420ba7e31e0cb11d3cae recipes.openrc
1ae29eb9342ad697d0e1e0cc600cd63c4ea6ce3f92b2bdc26602a95015b9ee91f1d40df65e92cad53b980fa3c15989ca9874bd0df62d6c7030ea97d396e37d2c recipes.nginx
521bc8c71bbf900bb37ef2db4d79ab16c3a068d74de57d8cfbe82feffab6041c58f94ddbb57ac1f8feb68535dd32679b79169454abfc4fa04548b025282ca507 recipes-manage.sh
"