Added build setup for archlinux. Let's test!

This commit is contained in:
s3lph 2018-10-19 21:31:11 +02:00
parent a67e21fc9d
commit f79112f84f
4 changed files with 82 additions and 1 deletions

View file

@ -51,6 +51,7 @@ build_wheel:
paths: paths:
- "dist/*.whl" - "dist/*.whl"
only: only:
- deployment
- staging - staging
- master - master
- tags - tags
@ -67,7 +68,7 @@ build_wheel:
# - cd package/debian # - cd package/debian
# - mv matemat/usr/lib/python3.7/{site,dist}-packages # - mv matemat/usr/lib/python3.7/{site,dist}-packages
# - mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat # - mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
# - rm -r matemat/usr/bin # - rm -rf matemat/usr/bin
# - find . -type f -exec sed -re "s#${PYTHON_BIN}#/usr/bin/python3.7#g" -i {} \; # - find . -type f -exec sed -re "s#${PYTHON_BIN}#/usr/bin/python3.7#g" -i {} \;
# - dpkg-deb --build matemat # - dpkg-deb --build matemat
# - mv matemat.deb "matemat_${MATEMAT_VERSION}+${CI_COMMIT_REF_NAME}-1_all.deb" # - mv matemat.deb "matemat_${MATEMAT_VERSION}+${CI_COMMIT_REF_NAME}-1_all.deb"
@ -79,6 +80,29 @@ build_wheel:
# - master # - master
# - tags # - tags
build_archlinux:
stage: build
image: base/devel:latest # Use an archlinux image instead of the customized debian image.
script:
- cp -r static/ package/archlinux/matemat/usr/lib/matemat/static/
- cp -r templates/ package/archlinux/matemat/usr/lib/matemat/templates/
- python3.7 setup.py egg_info -d -b +master install --root=package/archlinux/matemat/ --prefix=/usr --optimize=1
- export PYTHON_BIN=$(which python3)
- cd package/archlinux
- mv matemat/usr/bin/matemat matemat/usr/lib/matemat/matemat
- rm -rf matemat/usr/bin
- find . -type f -exec sed -re "s#${PYTHON_BIN}#/usr/bin/python3.7#g" -i {} \;
- makepkg -s MATEMAT_VERSION=${MATEMAT_VERSION}
- mv matemat-${MATEMAT_VERSION}-1-any.pkg.tar.xz "matemat-${MATEMAT_VERSION}+${CI_COMMIT_REF_NAME}-1-any.pkg.tar.xz"
artifacts:
paths:
- "package/archlinux/*.pkg.tar.xz"
only:
- deployment
- staging
- master
- tags
staging: staging:

View file

@ -0,0 +1,23 @@
# Maintainer: s3lph <account-gitlab-ideynizv@kernelpanic.lol>
pkgname=matemat
pkgver=${MATEMAT_VERSION}
pkgrel=1
arch=('any')
pkgdesc='A soda machine stock-keeping webservice'
url='https://gitlab.com/s3lph/matemat'
licence=('MIT')
depends=(
'python3>=3.7'
'python-jinja'
'python-pillow'
'python-magic'
'file'
)
install=$pkgname.install
pkgdir=matemat/

View file

@ -0,0 +1,24 @@
post_install() {
set -e
if [[ "$1" == "configure" ]]; then
if ! getent group matemat >/dev/null; then
groupadd --system matemat
fi
if ! getent passwd matemat >/dev/null; then
useradd --system --create-home --gid matemat --home-dir /var/lib/matemat --shell /usr/bin/nologin matemat
fi
chown matemat:matemat -R /var/lib/matemat
find /var/lib/matemat -type d -exec chmod 0750 {}
find /var/lib/matemat -type f -exec chmod 0640 {}
setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/matemat
fi
}

View file

@ -0,0 +1,10 @@
[Unit]
Description=matemat
After=networking.target
[Service]
Exec=/usr/lib/matemat/matemat /etc/matemat.conf /usr/lib/matemat/matemat.conf
User=matemat
[Install]
WantedBy=multi-user.target