diff --git a/.github/workflows/setup.sh b/.github/workflows/setup.sh index 0d3cc807..966b775f 100755 --- a/.github/workflows/setup.sh +++ b/.github/workflows/setup.sh @@ -30,7 +30,7 @@ mv dist/ahriman-*.tar.gz package/archlinux chmod +777 package/archlinux # because fuck you that's why cd package/archlinux sudo -u nobody -- makepkg -cf --skipchecksums --noconfirm -sudo -u nobody -- makepkg --packagelist | grep -v -- -debug- | pacman -U --noconfirm - +sudo -u nobody -- makepkg --packagelist | grep -v -- -debug- | pacman -U --noconfirm --nodeps - # create machine-id which is required by build tools systemd-machine-id-setup diff --git a/Dockerfile b/Dockerfile index 61fdc8ec..312eaddc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -79,7 +79,8 @@ RUN cd "/home/build/ahriman" && \ tox -e archive && \ cp ./dist/*.tar.gz "package/archlinux" && \ cd "package/archlinux" && \ - runuser -u build -- makepkg --noconfirm --install --skipchecksums && \ + runuser -u build -- makepkg --noconfirm --skipchecksums && \ + runuser -u build -- makepkg --packagelist | grep -v -- -debug- | pacman -U --noconfirm --nodeps - && \ cd / && rm -r "/home/build/ahriman" # cleanup unused diff --git a/package/archlinux/PKGBUILD b/package/archlinux/PKGBUILD index 4e093d24..1a9a0331 100644 --- a/package/archlinux/PKGBUILD +++ b/package/archlinux/PKGBUILD @@ -1,51 +1,81 @@ # Maintainer: Evgeniy Alekseev -pkgname='ahriman' +pkgbase='ahriman' +pkgname=('ahriman' 'ahriman-triggers' 'ahriman-web') pkgver=2.15.2 pkgrel=1 pkgdesc="ArcH linux ReposItory MANager" arch=('any') -url="https://github.com/arcan1s/ahriman" -license=('GPL3') +url="https://ahriman.readthedocs.io/" +license=('GPL-3.0-or-later') depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-bcrypt' 'python-inflection' 'python-pyelftools' 'python-requests') makedepends=('python-build' 'python-flit' 'python-installer' 'python-wheel') -optdepends=('python-aioauth-client: web server with OAuth2 authorization' - 'python-aiohttp: web server' - 'python-aiohttp-apispec>=3.0.0: web server' - 'python-aiohttp-cors: web server' - 'python-aiohttp-jinja2: web server' - 'python-aiohttp-security: web server with authorization' - 'python-aiohttp-session: web server with authorization' - 'python-boto3: sync to s3' - 'python-cerberus: configuration validator' - 'python-cryptography: web server with authorization' - 'python-matplotlib: usage statistics chart' - 'python-requests-unixsocket2: client report to web server by unix socket' - 'python-jinja: html report generation' - 'python-systemd: journal support' - 'rsync: sync by using rsync') -source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgname-$pkgver.tar.gz" - 'ahriman.sysusers' - 'ahriman.tmpfiles') -install="$pkgname.install" -backup=('etc/ahriman.ini' - 'etc/ahriman.ini.d/logging.ini') +source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgbase-$pkgver.tar.gz" + "$pkgbase.sysusers" + "$pkgbase.tmpfiles") build() { - cd "$pkgname-$pkgver" + cd "$pkgbase-$pkgver" - python -m build --wheel --no-isolation + python -m build --wheel --no-isolation } -package() { - cd "$pkgname-$pkgver" +package_ahriman() { + pkgname='ahriman' + optdepends=('ahriman-triggers: additional extensions for the application' + 'ahriman-web: web server' + 'python-boto3: sync to s3' + 'python-cerberus: configuration validator' + 'python-matplotlib: usage statistics chart' + 'python-requests-unixsocket2: client report to web server by unix socket' + 'python-jinja: html report generation' + 'python-systemd: journal support' + 'rsync: sync by using rsync') + install="$pkgname.install" + backup=('etc/ahriman.ini' + 'etc/ahriman.ini.d/logging.ini') - python -m installer --destdir="$pkgdir" "dist/$pkgname-$pkgver-py3-none-any.whl" + cd "$pkgbase-$pkgver" - # keep usr/share configs as reference and copy them to /etc - install -Dm644 "$pkgdir/usr/share/$pkgname/settings/ahriman.ini" "$pkgdir/etc/ahriman.ini" - install -Dm644 "$pkgdir/usr/share/$pkgname/settings/ahriman.ini.d/logging.ini" "$pkgdir/etc/ahriman.ini.d/logging.ini" + python -m installer --destdir="$pkgdir" "dist/$pkgbase-$pkgver-py3-none-any.whl" + python subpackages.py "$pkgdir" "$pkgname" - install -Dm644 "$srcdir/$pkgname.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgname.conf" - install -Dm644 "$srcdir/$pkgname.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf" + # keep usr/share configs as reference and copy them to /etc + install -Dm644 "$pkgdir/usr/share/$pkgbase/settings/ahriman.ini" "$pkgdir/etc/ahriman.ini" + install -Dm644 "$pkgdir/usr/share/$pkgbase/settings/ahriman.ini.d/logging.ini" "$pkgdir/etc/ahriman.ini.d/logging.ini" + + install -Dm644 "$srcdir/$pkgbase.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgbase.conf" + install -Dm644 "$srcdir/$pkgbase.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgbase.conf" +} + +package_ahriman-triggers() { + pkgname='ahriman-triggers' + pkgdesc="ArcH linux ReposItory MANager, additional extensions" + depends=("$pkgbase=$pkgver") + backup=('etc/ahriman.ini.d/00-triggers.ini') + + cd "$pkgbase-$pkgver" + + python -m installer --destdir="$pkgdir" "dist/$pkgbase-$pkgver-py3-none-any.whl" + python subpackages.py "$pkgdir" "$pkgname" + + install -Dm644 "$pkgdir/usr/share/$pkgbase/settings/ahriman.ini.d/00-triggers.ini" "$pkgdir/etc/ahriman.ini.d/00-triggers.ini" +} + +package_ahriman-web() { + pkgname='ahriman-web' + pkgdesc="ArcH linux ReposItory MANager, web server" + depends=("$pkgbase=$pkgver" 'python-aiohttp-apispec>=3.0.0' 'python-aiohttp-cors' 'python-aiohttp-jinja2') + optdepends=('python-aioauth-client: OAuth2 authorization support' + 'python-aiohttp-security: authorization support' + 'python-aiohttp-session: authorization support' + 'python-cryptography: authorization support') + backup=('etc/ahriman.ini.d/00-web.ini') + + cd "$pkgbase-$pkgver" + + python -m installer --destdir="$pkgdir" "dist/$pkgbase-$pkgver-py3-none-any.whl" + python subpackages.py "$pkgdir" "$pkgname" + + install -Dm644 "$pkgdir/usr/share/$pkgbase/settings/ahriman.ini.d/00-web.ini" "$pkgdir/etc/ahriman.ini.d/00-web.ini" } diff --git a/package/share/ahriman/settings/ahriman.ini b/package/share/ahriman/settings/ahriman.ini index 0f543866..d7e2f328 100644 --- a/package/share/ahriman/settings/ahriman.ini +++ b/package/share/ahriman/settings/ahriman.ini @@ -23,32 +23,6 @@ sync_files_database = yes ; as additional option for some subcommands). If set to no, databases must be synchronized manually. use_ahriman_cache = yes -[auth] -; Authentication provider, must be one of disabled, configuration, pam, oauth. -target = disabled -; Allow read-only endpoint to be called without authentication. -allow_read_only = yes -; OAuth2 application client ID and secret. Required if oauth is used. -;client_id = -;client_secret = -; Cookie secret key to be used for cookies encryption. Must be valid 32 bytes URL-safe base64-encoded string. -; If not set, it will be generated automatically. -;cookie_secret_key = -; Name of the secondary group to be used as admin group in the service. Required if pam is used. -;full_access_group = wheel -; Authentication cookie expiration in seconds. -;max_age = 604800 -; OAuth2 provider icon for the web interface. -;oauth_icon = google -; OAuth2 provider class name, one of provided by aioauth-client. Required if oauth is used. -;oauth_provider = GoogleClient -; Scopes list for OAuth2 provider. Required if oauth is used. -;oauth_scopes = https://www.googleapis.com/auth/userinfo.email -; Allow login as root user (only applicable if PAM is used). -;permit_root_login = no -; Optional password salt. -;salt = - [build] ; List of additional flags passed to archbuild command. ;archbuild_flags = @@ -70,20 +44,12 @@ triggers[] = ahriman.core.report.ReportTrigger triggers[] = ahriman.core.upload.UploadTrigger triggers[] = ahriman.core.gitremote.RemotePushTrigger ; List of well-known triggers. Used only for configuration purposes. -triggers_known[] = ahriman.core.distributed.WorkerLoaderTrigger -triggers_known[] = ahriman.core.distributed.WorkerTrigger triggers_known[] = ahriman.core.gitremote.RemotePullTrigger triggers_known[] = ahriman.core.gitremote.RemotePushTrigger triggers_known[] = ahriman.core.report.ReportTrigger -triggers_known[] = ahriman.core.support.KeyringTrigger -triggers_known[] = ahriman.core.support.MirrorlistTrigger triggers_known[] = ahriman.core.upload.UploadTrigger ; Maximal age in seconds of the VCS packages before their version will be updated with its remote source. ;vcs_allowed_age = 604800 -; List of worker nodes addresses used for build process, e.g.: -; workers = http://10.0.0.1:8080 http://10.0.0.3:8080 -; Empty list means run on the local instance. -;workers = [repository] ; Application root. @@ -112,79 +78,6 @@ suppress_http_log_errors = yes ; Optional username for authentication (if enabled). ;username = -[web] -; External address of the web service. Will be used for some features like OAuth. If none set will be generated as -; address = http://${web:host}:${web:port} -;address = http://${web:host}:${web:port} -; Enable file upload endpoint used by some triggers. -;enable_archive_upload = no -; Address to bind the server. -host = 127.0.0.1 -; Full URL to the repository index page used by templates. -;index_url = -; Max file size in bytes which can be uploaded to the server. Requires ${web:enable_archive_upload} to be enabled. -;max_body_size = -; Port to listen. Must be set, if the web service is enabled. -;port = -; Disable status (e.g. package status, logs, etc) endpoints. Useful for build only modes. -;service_only = no -; Path to directory with static files. -static_path = ${templates}/static -; List of directories with templates. -templates[] = ${prefix}/share/ahriman/templates -; Path to unix socket. If none set, unix socket will be disabled. -;unix_socket = -; Allow unix socket to be world readable. -;unix_socket_unsafe = yes -; Maximum amount of time in seconds to be waited before lock will be free, used by spawned processes (0 is infinite). -;wait_timeout = - -[keyring] -; List of configuration section names for keyring generator plugin, e.g.: -; target = keyring-trigger -target = - -; Keyring generator trigger sample. -;[keyring-trigger] -; Generator type name. -;type = keyring-generator -; Optional keyring package description. -;description= -; Optional URL to the repository homepage. -;homepage= -; Keyring package licenses list. -;license = Unlicense -; Optional keyring package name. -;package = -; Optional packager PGP keys list. If none set, it will read from database. -;packagers = -; List of revoked PGP keys. -;revoked = -; List of master PGP keys. If none set, the sign.key value will be used. -;trusted = - -[mirrorlist] -; List of configuration section names for mirrorlist generator plugin, e.g.: -; target = mirrorlist-trigger -target = - -; Mirror list generator trigger sample. -;[mirrorlist-trigger] -; Generator type name. -;type = mirrorlist-generator -; Optional mirrorlist package description. -;description= -; Optional URL to the repository homepage. -;homepage= -; Mirrorlist package licenses list. -;license = Unlicense -; Optional mirrorlist package name. -;package = -; Absolute path to generated mirrorlist file, usually path inside /etc/pacman.d directory. -;path = -; List of repository mirrors. -;servers = - [remote-pull] ; List of configuration section names for git remote pull plugin, e.g.: ; target = remote-pull-trigger diff --git a/package/share/ahriman/settings/ahriman.ini.d/00-triggers.ini b/package/share/ahriman/settings/ahriman.ini.d/00-triggers.ini new file mode 100644 index 00000000..ae29f15c --- /dev/null +++ b/package/share/ahriman/settings/ahriman.ini.d/00-triggers.ini @@ -0,0 +1,56 @@ +[build] +; List of well-known triggers. Used only for configuration purposes. +triggers_known[] = ahriman.core.distributed.WorkerLoaderTrigger +triggers_known[] = ahriman.core.distributed.WorkerTrigger +triggers_known[] = ahriman.core.support.KeyringTrigger +triggers_known[] = ahriman.core.support.MirrorlistTrigger +; List of worker nodes addresses used for build process, e.g.: +; workers = http://10.0.0.1:8080 http://10.0.0.3:8080 +; Empty list means run on the local instance. +;workers = + +[keyring] +; List of configuration section names for keyring generator plugin, e.g.: +; target = keyring-trigger +target = + +; Keyring generator trigger sample. +;[keyring-trigger] +; Generator type name. +;type = keyring-generator +; Optional keyring package description. +;description= +; Optional URL to the repository homepage. +;homepage= +; Keyring package licenses list. +;license = Unlicense +; Optional keyring package name. +;package = +; Optional packager PGP keys list. If none set, it will read from database. +;packagers = +; List of revoked PGP keys. +;revoked = +; List of master PGP keys. If none set, the sign.key value will be used. +;trusted = + +[mirrorlist] +; List of configuration section names for mirrorlist generator plugin, e.g.: +; target = mirrorlist-trigger +target = + +; Mirror list generator trigger sample. +;[mirrorlist-trigger] +; Generator type name. +;type = mirrorlist-generator +; Optional mirrorlist package description. +;description= +; Optional URL to the repository homepage. +;homepage= +; Mirrorlist package licenses list. +;license = Unlicense +; Optional mirrorlist package name. +;package = +; Absolute path to generated mirrorlist file, usually path inside /etc/pacman.d directory. +;path = +; List of repository mirrors. +;servers = diff --git a/package/share/ahriman/settings/ahriman.ini.d/00-web.ini b/package/share/ahriman/settings/ahriman.ini.d/00-web.ini new file mode 100644 index 00000000..4279de26 --- /dev/null +++ b/package/share/ahriman/settings/ahriman.ini.d/00-web.ini @@ -0,0 +1,52 @@ +[auth] +; Authentication provider, must be one of disabled, configuration, pam, oauth. +target = disabled +; Allow read-only endpoint to be called without authentication. +allow_read_only = yes +; OAuth2 application client ID and secret. Required if oauth is used. +;client_id = +;client_secret = +; Cookie secret key to be used for cookies encryption. Must be valid 32 bytes URL-safe base64-encoded string. +; If not set, it will be generated automatically. +;cookie_secret_key = +; Name of the secondary group to be used as admin group in the service. Required if pam is used. +;full_access_group = wheel +; Authentication cookie expiration in seconds. +;max_age = 604800 +; OAuth2 provider icon for the web interface. +;oauth_icon = google +; OAuth2 provider class name, one of provided by aioauth-client. Required if oauth is used. +;oauth_provider = GoogleClient +; Scopes list for OAuth2 provider. Required if oauth is used. +;oauth_scopes = https://www.googleapis.com/auth/userinfo.email +; Allow login as root user (only applicable if PAM is used). +;permit_root_login = no +; Optional password salt. +;salt = + +[web] +; External address of the web service. Will be used for some features like OAuth. If none set will be generated as +; address = http://${web:host}:${web:port} +;address = http://${web:host}:${web:port} +; Enable file upload endpoint used by some triggers. +;enable_archive_upload = no +; Address to bind the server. +host = 127.0.0.1 +; Full URL to the repository index page used by templates. +;index_url = +; Max file size in bytes which can be uploaded to the server. Requires ${web:enable_archive_upload} to be enabled. +;max_body_size = +; Port to listen. Must be set, if the web service is enabled. +;port = +; Disable status (e.g. package status, logs, etc) endpoints. Useful for build only modes. +;service_only = no +; Path to directory with static files. +static_path = ${templates}/static +; List of directories with templates. +templates[] = ${prefix}/share/ahriman/templates +; Path to unix socket. If none set, unix socket will be disabled. +;unix_socket = +; Allow unix socket to be world readable. +;unix_socket_unsafe = yes +; Maximum amount of time in seconds to be waited before lock will be free, used by spawned processes (0 is infinite). +;wait_timeout = diff --git a/subpackages.py b/subpackages.py index 56b1f2c7..16decf4f 100644 --- a/subpackages.py +++ b/subpackages.py @@ -29,12 +29,24 @@ prefix = Path(sys.prefix).relative_to("/") site_packages = Path(site.getsitepackages()[0]).relative_to("/") SUBPACKAGES = { "ahriman": [ - Path("etc"), + prefix / "bin", prefix / "lib" / "systemd", prefix / "share", site_packages / "ahriman", ], + "ahriman-triggers": [ + prefix / "share" / "ahriman" / "settings" / "ahriman.ini.d" / "00-triggers.ini", + site_packages / "ahriman" / "core" / "distributed", + site_packages / "ahriman" / "core" / "support", + ], "ahriman-web": [ + prefix / "lib" / "systemd" / "system" / "ahriman-web.service", + prefix / "lib" / "systemd" / "system" / "ahriman-web@.service", + prefix / "share" / "ahriman" / "settings" / "ahriman.ini.d" / "00-web.ini", + prefix / "share" / "ahriman" / "templates" / "api.jinja2", + prefix / "share" / "ahriman" / "templates" / "build-status", + prefix / "share" / "ahriman" / "templates" / "build-status.jinja2", + prefix / "share" / "ahriman" / "templates" / "error.jinja2", site_packages / "ahriman" / "application" / "handlers" / "web.py", site_packages / "ahriman" / "core" / "auth", site_packages / "ahriman" / "web",