Compare commits

..
Author SHA1 Message Date
arcanis 6e1567e6db fix tox environments 2026-07-14 16:16:06 +03:00
arcanis 6862d9b9e1 fix docs generation 2026-07-14 15:00:57 +03:00
arcanis 4119a3a36c straight forward conftest 2026-07-14 12:19:04 +03:00
arcanis da0853b6f1 generic fixtures 2026-07-13 13:01:54 +03:00
arcanis 7db38ff9e4 reorder tests 2026-07-13 13:00:13 +03:00
arcanis 92ac036f78 migrate to hatch 2026-07-11 12:24:53 +03:00
141 changed files with 3390 additions and 4000 deletions

No files matched your search

-5
View File
@@ -1,5 +0,0 @@
[tool.bandit]
skips = [
"B404",
"B603",
]
+3
View File
@@ -0,0 +1,3 @@
skips:
- B404
- B603
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Set image date
id: args
run: echo "date=$(date -d yesterday +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"
run: echo "::set-output name=date::$(date -d yesterday +'%Y-%m-%d')"
- name: Login to docker hub
uses: docker/login-action@v3
+5 -7
View File
@@ -18,8 +18,8 @@ jobs:
image: arcan1s/ahriman:edge
env:
AHRIMAN_PORT: 8080
AHRIMAN_UNIX_SOCKET: /var/lib/ahriman/ahriman-web.sock
options: --privileged --user root --entrypoint entrypoint-web
AHRIMAN_UNIX_SOCKET: /var/lib/ahriman/ahriman/ahriman-web.sock
options: --privileged --entrypoint entrypoint-web
ports:
- 8080
volumes:
@@ -31,8 +31,8 @@ jobs:
AHRIMAN_DEBUG: y
AHRIMAN_OUTPUT: console
AHRIMAN_PORT: 8080
AHRIMAN_UNIX_SOCKET: /var/lib/ahriman/ahriman-web.sock
options: --privileged --user root
AHRIMAN_UNIX_SOCKET: /var/lib/ahriman/ahriman/ahriman-web.sock
options: --privileged
volumes:
- repo:/var/lib/ahriman
@@ -40,9 +40,7 @@ jobs:
- run: pacman -Sy
- name: Init repository
run: |
chown ahriman:ahriman /var/lib/ahriman
sudo -E -u ahriman -- entrypoint help
run: entrypoint help
- name: Print configuration
run: |
+2 -2
View File
@@ -26,7 +26,7 @@ jobs:
- name: Extract version
id: version
run: echo "version=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT"
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
- name: Create changelog
id: changelog
@@ -38,7 +38,7 @@ jobs:
- name: Create archive
run: tox -e archive
env:
VERSION: ${{ steps.version.outputs.version }}
VERSION: ${{ steps.version.outputs.VERSION }}
- name: Publish release
uses: softprops/action-gh-release@v2
@@ -26,10 +26,10 @@ cp "docker/systemd-nspawn.sh" "/usr/local/bin/systemd-nspawn"
# create fresh tarball
tox -e archive
# run makepkg
PKGVER=$(PYTHONPATH=ahriman-core/src python -c "from ahriman import __version__; print(__version__)")
mv "dist/ahriman-$PKGVER.tar.gz" archlinux
chmod +777 archlinux # because fuck you that's why
cd archlinux
PKGVER=$(python -c "from src.ahriman import __version__; print(__version__)")
mv "dist/ahriman-$PKGVER.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 "ahriman-core-$PKGVER" | pacman -U --noconfirm --nodeps -
if [[ -z $MINIMAL_INSTALL ]]; then
@@ -44,7 +44,7 @@ pacman -Qdtq | pacman -Rscn --noconfirm -
# initial setup command as root
[[ -z $MINIMAL_INSTALL ]] && WEB_ARGS=("--web-port" "8080")
sudo -u ahriman -- ahriman -a x86_64 -r "github" service-setup --packager "ahriman bot <ahriman@example.com>" "${WEB_ARGS[@]}"
ahriman -a x86_64 -r "github" service-setup --packager "ahriman bot <ahriman@example.com>" "${WEB_ARGS[@]}"
# enable services
systemctl enable ahriman@x86_64-github.timer
if [[ -z $MINIMAL_INSTALL ]]; then
+2 -2
View File
@@ -27,7 +27,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup the minimal service in arch linux container
run: .github/scripts/setup.sh minimal
run: .github/workflows/setup.sh minimal
run-setup:
@@ -43,4 +43,4 @@ jobs:
- uses: actions/checkout@v4
- name: Setup the service in arch linux container
run: .github/scripts/setup.sh
run: .github/workflows/setup.sh
+7
View File
@@ -0,0 +1,7 @@
[pytest]
addopts = --cov=ahriman --cov-report=term-missing:skip-covered --no-cov-on-fail --cov-fail-under=100 --spec
asyncio_default_fixture_loop_scope = function
asyncio_mode = auto
pythonpath = tests
resource-path.directory-name-test-resources = ../../tests/testresources
spec_test_format = {result} {docstring_summary}
-8
View File
@@ -1,8 +0,0 @@
[pytest]
addopts = [
"--spec",
]
asyncio_default_fixture_loop_scope = "function"
asyncio_mode = "auto"
"resource-path.directory-name-test-resources" = "../../tests/testresources"
spec_test_format = "{result} {docstring_summary}"
+1 -4
View File
@@ -3,16 +3,13 @@ version: 2
build:
os: ubuntu-lts-latest
tools:
python: "3.14"
python: "3.13"
apt_packages:
- graphviz
python:
install:
- requirements: docs/requirements.txt
- path: ahriman-core
- path: ahriman-triggers
- path: ahriman-web
formats:
- pdf
+1 -7
View File
@@ -247,19 +247,13 @@ tox -e docs
Must be usually done if there are changes in modules structure.
### Before making a new release
1. Make sure that all pipelines are green.
2. Make sure that documentation is up-to-date.
3. Run [regress job](https://github.com/arcan1s/ahriman/actions/workflows/regress.yml). The successful link must be attached to release.
### Create release
```shell
tox -m release -- major.minor.patch
```
The command above will generate documentation, tags, etc., and will push them to GitHub. Other things will be handled by GitHub workflows automatically. As soon as related github action completes, there will be a new release created. Edit it to add additional information if needed.
The command above will generate documentation, tags, etc., and will push them to GitHub. Other things will be handled by GitHub workflows automatically.
### Hotfixes policy
+1 -1
View File
@@ -31,7 +31,7 @@ For installation details kindly refer to the [documentation](https://ahriman.rea
Every available option is described in the [documentation](https://ahriman.readthedocs.io/en/stable/configuration.html).
The application provides reasonable defaults which allow to use it out-of-box; however additional steps (like configuring build toolchain) are recommended and can be easily achieved by following install instructions.
The application provides reasonable defaults which allow to use it out-of-box; however additional steps (like configuring build toolchain and sudoers) are recommended and can be easily achieved by following install instructions.
## [FAQ](https://ahriman.readthedocs.io/en/stable/faq/index.html)
@@ -1,52 +0,0 @@
#!/bin/bash
set -euo pipefail
usage() {
local cmd="${0##*/}"
echo "Usage: $cmd [options] -- [archbuild args]"
echo " -r <repository> Repository name"
echo " -a <architecture> Repository architecture"
echo " -c <directory> Read devtools pacman configurations from this directory"
}
repository=
architecture=
pacman_config_dir=
while getopts ":r:a:c:" arg; do
case "$arg" in
r) repository="$OPTARG" ;;
a) architecture="$OPTARG" ;;
c) pacman_config_dir="$OPTARG" ;;
*) usage >&2; exit 1 ;;
esac
done
if [[ -z $repository || -z $architecture ]]; then
usage >&2
exit 1
fi
if [[ -n $pacman_config_dir && ! -d $pacman_config_dir ]]; then
echo "devtools configuration directory does not exist: $pacman_config_dir" >&2
exit 1
fi
source "/usr/share/devtools/lib/archroot.sh"
check_root "SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,NPROC,MAKEFLAGS,PACKAGER,GNUPGHOME" "${BASH_SOURCE[0]}" "$@"
# because devtools doesn't allow to read configuration from custom path
# here is a workaround, which uses unshare to bind-mount directory with configuration files
# for specific process
if [[ -n $pacman_config_dir && -z ${AHRIMAN_ARCHBUILD_MOUNTED:-} ]]; then
pacman_config_dir="$(readlink -e -- "$pacman_config_dir")"
export AHRIMAN_ARCHBUILD_MOUNTED=1
exec unshare --mount --propagation private \
bash -c 'mount --bind -- "$0" /usr/share/devtools/pacman.conf.d && exec "$@"' \
"$pacman_config_dir" "${BASH_SOURCE[0]}" "$@"
fi
exec bash -c 'source "/usr/bin/archbuild" "$@"' \
"${repository}-${architecture}-build" "${@:$OPTIND}"
@@ -1,7 +1,6 @@
[settings]
; Relative path to directory with configuration files overrides. Overrides will be applied in alphabetic order.
include[] = ahriman.ini.d
include[] = ${repository:root}/.config/ahriman/ahriman.ini.d
include = ahriman.ini.d
; Relative path to configuration used by logging package.
logging = ahriman.ini.d/logging.ini
; Perform database migrations on the application start. Do not touch this option unless you know what you are doing.
@@ -35,24 +34,16 @@ retry_backoff = 1.0
[build]
; List of additional flags passed to archbuild command.
;archbuild_flags =
; Path to local directory with devtools configuration files, which will be bind-mounted for devtools.
devtools_configs = ${repository:root}/.config/ahriman/pacman.conf.d
; Path to build command.
devtools_wrapper = ahriman-archbuild
;build_command =
; List of packages to be ignored during automatic updates.
;ignore_packages =
; Include debug packages.
;include_debug_packages = yes
; List of additional flags passed to make via environment variable via makepkg command.
;make_flags =
; List of additional flags passed to makechrootpkg command.
;makechrootpkg_flags =
; List of additional flags passed to makepkg command.
makepkg_flags = --nocolor --ignorearch
; Minimal age in seconds since the latest AUR package modification before automatic updates are allowed.
;min_age = 0
; Default packager identifier to be used for package builds
;packager =
; List of paths to be used for implicit dependency scan. Regular expressions are supported.
scan_paths = ^usr/lib(?!/cmake).*$
; List of enabled triggers in the order of calls.
@@ -1,134 +1,134 @@
# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab
# Usage:
# 1) Copy this to somewhere (e.g. ~/.local/share/bash_completion/ahriman).
# 2) Add the following line to your .bashrc:
# source ~/.local/share/bash_completion/ahriman
# See also: https://github.com/scop/bash-completion/blob/main/doc/configuration.md
# AUTOMATICALLY GENERATED by `shtab`
_shtab_ahriman_subparsers=(add aur-search check clean config config-validate copy daemon help help-commands-unsafe help-updates help-version init key-import package-add package-archives package-changes package-changes-remove package-copy package-hold package-pkgbuild package-pkgbuild-remove package-remove package-rollback package-status package-status-remove package-status-update package-unhold package-update patch-add patch-list patch-remove patch-set-add rebuild remove remove-unknown repo-backup repo-check repo-clean repo-config repo-config-validate repo-create-keyring repo-create-mirrorlist repo-daemon repo-init repo-rebuild repo-remove-unknown repo-report repo-restore repo-setup repo-sign repo-statistics repo-status-update repo-sync repo-tree repo-triggers repo-update report run search service-clean service-config service-config-validate service-key-import service-repositories service-run service-setup service-shell service-tree-migrate setup shell sign status status-update sync update user-add user-list user-remove version web web-reload)
_shtab_ahriman_subparsers=('add' 'aur-search' 'check' 'clean' 'config' 'config-validate' 'copy' 'daemon' 'help' 'help-commands-unsafe' 'help-updates' 'help-version' 'init' 'key-import' 'package-add' 'package-changes' 'package-changes-remove' 'package-copy' 'package-remove' 'package-status' 'package-status-remove' 'package-status-update' 'package-update' 'patch-add' 'patch-list' 'patch-remove' 'patch-set-add' 'rebuild' 'remove' 'remove-unknown' 'repo-backup' 'repo-check' 'repo-clean' 'repo-config' 'repo-config-validate' 'repo-create-keyring' 'repo-create-mirrorlist' 'repo-daemon' 'repo-init' 'repo-rebuild' 'repo-remove-unknown' 'repo-report' 'repo-restore' 'repo-setup' 'repo-sign' 'repo-statistics' 'repo-status-update' 'repo-sync' 'repo-tree' 'repo-triggers' 'repo-update' 'report' 'run' 'search' 'service-clean' 'service-config' 'service-config-validate' 'service-key-import' 'service-repositories' 'service-run' 'service-setup' 'service-shell' 'service-tree-migrate' 'setup' 'shell' 'sign' 'status' 'status-update' 'sync' 'update' 'user-add' 'user-list' 'user-remove' 'version' 'web' 'web-reload')
_shtab_ahriman_add_option_strings=(-h --help --changes --no-changes --dependencies --no-dependencies -e --exit-code --increment --no-increment -n --now -s --source -u --username -v --variable -y --refresh)
_shtab_ahriman_aur_search_option_strings=(-h --help -e --exit-code --info --no-info --sort-by)
_shtab_ahriman_check_option_strings=(-h --help --changes --no-changes --check-files --no-check-files -e --exit-code --vcs --no-vcs -y --refresh)
_shtab_ahriman_clean_option_strings=(-h --help --cache --no-cache --chroot --no-chroot --manual --no-manual --packages --no-packages --pacman --no-pacman)
_shtab_ahriman_config_option_strings=(-h --help --info --no-info --secure --no-secure)
_shtab_ahriman_config_validate_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_copy_option_strings=(-h --help -e --exit-code --remove)
_shtab_ahriman_daemon_option_strings=(-h --help -i --interval --aur --no-aur --changes --no-changes --check-files --no-check-files --dependencies --no-dependencies --dry-run --increment --no-increment --local --no-local --manual --no-manual --partitions --no-partitions -u --username --vcs --no-vcs -y --refresh)
_shtab_ahriman_help_option_strings=(-h --help)
_shtab_ahriman_help_commands_unsafe_option_strings=(-h --help)
_shtab_ahriman_help_updates_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_help_version_option_strings=(-h --help)
_shtab_ahriman_init_option_strings=(-h --help --build-as-user --from-configuration --generate-salt --no-generate-salt --makeflags-jobs --no-makeflags-jobs --mirror --multilib --no-multilib --packager --server --sign-key --sign-target --web-port --web-unix-socket)
_shtab_ahriman_key_import_option_strings=(-h --help --key-server)
_shtab_ahriman_package_add_option_strings=(-h --help --changes --no-changes --dependencies --no-dependencies -e --exit-code --increment --no-increment -n --now -s --source -u --username -v --variable -y --refresh)
_shtab_ahriman_package_archives_option_strings=(-h --help -e --exit-code --info --no-info)
_shtab_ahriman_package_changes_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_package_changes_remove_option_strings=(-h --help)
_shtab_ahriman_package_copy_option_strings=(-h --help -e --exit-code --remove)
_shtab_ahriman_package_hold_option_strings=(-h --help)
_shtab_ahriman_package_pkgbuild_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_package_pkgbuild_remove_option_strings=(-h --help)
_shtab_ahriman_package_remove_option_strings=(-h --help)
_shtab_ahriman_package_rollback_option_strings=(-h --help --hold --no-hold -u --username)
_shtab_ahriman_package_status_option_strings=(-h --help --ahriman -e --exit-code --info --no-info -s --status)
_shtab_ahriman_package_status_remove_option_strings=(-h --help)
_shtab_ahriman_package_status_update_option_strings=(-h --help -s --status)
_shtab_ahriman_package_unhold_option_strings=(-h --help)
_shtab_ahriman_package_update_option_strings=(-h --help --changes --no-changes --dependencies --no-dependencies -e --exit-code --increment --no-increment -n --now -s --source -u --username -v --variable -y --refresh)
_shtab_ahriman_patch_add_option_strings=(-h --help)
_shtab_ahriman_patch_list_option_strings=(-h --help -e --exit-code -v --variable)
_shtab_ahriman_patch_remove_option_strings=(-h --help -v --variable)
_shtab_ahriman_patch_set_add_option_strings=(-h --help -t --track)
_shtab_ahriman_rebuild_option_strings=(-h --help --depends-on --dry-run --from-database --increment --no-increment -e --exit-code -s --status -u --username)
_shtab_ahriman_remove_option_strings=(-h --help)
_shtab_ahriman_remove_unknown_option_strings=(-h --help --dry-run)
_shtab_ahriman_repo_backup_option_strings=(-h --help)
_shtab_ahriman_repo_check_option_strings=(-h --help --changes --no-changes --check-files --no-check-files -e --exit-code --vcs --no-vcs -y --refresh)
_shtab_ahriman_repo_clean_option_strings=(-h --help --cache --no-cache --chroot --no-chroot --manual --no-manual --packages --no-packages --pacman --no-pacman)
_shtab_ahriman_repo_config_option_strings=(-h --help --info --no-info --secure --no-secure)
_shtab_ahriman_repo_config_validate_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_repo_create_keyring_option_strings=(-h --help)
_shtab_ahriman_repo_create_mirrorlist_option_strings=(-h --help)
_shtab_ahriman_repo_daemon_option_strings=(-h --help -i --interval --aur --no-aur --changes --no-changes --check-files --no-check-files --dependencies --no-dependencies --dry-run --increment --no-increment --local --no-local --manual --no-manual --partitions --no-partitions -u --username --vcs --no-vcs -y --refresh)
_shtab_ahriman_repo_init_option_strings=(-h --help --build-as-user --from-configuration --generate-salt --no-generate-salt --makeflags-jobs --no-makeflags-jobs --mirror --multilib --no-multilib --packager --server --sign-key --sign-target --web-port --web-unix-socket)
_shtab_ahriman_repo_rebuild_option_strings=(-h --help --depends-on --dry-run --from-database --increment --no-increment -e --exit-code -s --status -u --username)
_shtab_ahriman_repo_remove_unknown_option_strings=(-h --help --dry-run)
_shtab_ahriman_repo_report_option_strings=(-h --help)
_shtab_ahriman_repo_restore_option_strings=(-h --help -o --output)
_shtab_ahriman_repo_setup_option_strings=(-h --help --build-as-user --from-configuration --generate-salt --no-generate-salt --makeflags-jobs --no-makeflags-jobs --mirror --multilib --no-multilib --packager --server --sign-key --sign-target --web-port --web-unix-socket)
_shtab_ahriman_repo_sign_option_strings=(-h --help)
_shtab_ahriman_repo_statistics_option_strings=(-h --help --chart -e --event --from-date --limit --offset --to-date)
_shtab_ahriman_repo_status_update_option_strings=(-h --help -s --status)
_shtab_ahriman_repo_sync_option_strings=(-h --help)
_shtab_ahriman_repo_tree_option_strings=(-h --help -p --partitions)
_shtab_ahriman_repo_triggers_option_strings=(-h --help)
_shtab_ahriman_repo_update_option_strings=(-h --help --aur --no-aur --changes --no-changes --check-files --no-check-files --dependencies --no-dependencies --dry-run -e --exit-code --increment --no-increment --local --no-local --manual --no-manual -u --username --vcs --no-vcs -y --refresh)
_shtab_ahriman_report_option_strings=(-h --help)
_shtab_ahriman_run_option_strings=(-h --help)
_shtab_ahriman_search_option_strings=(-h --help -e --exit-code --info --no-info --sort-by)
_shtab_ahriman_service_clean_option_strings=(-h --help --cache --no-cache --chroot --no-chroot --manual --no-manual --packages --no-packages --pacman --no-pacman)
_shtab_ahriman_service_config_option_strings=(-h --help --info --no-info --secure --no-secure)
_shtab_ahriman_service_config_validate_option_strings=(-h --help -e --exit-code)
_shtab_ahriman_service_key_import_option_strings=(-h --help --key-server)
_shtab_ahriman_service_repositories_option_strings=(-h --help --id-only --no-id-only)
_shtab_ahriman_service_run_option_strings=(-h --help)
_shtab_ahriman_service_setup_option_strings=(-h --help --build-as-user --from-configuration --generate-salt --no-generate-salt --makeflags-jobs --no-makeflags-jobs --mirror --multilib --no-multilib --packager --server --sign-key --sign-target --web-port --web-unix-socket)
_shtab_ahriman_service_shell_option_strings=(-h --help -o --output)
_shtab_ahriman_service_tree_migrate_option_strings=(-h --help)
_shtab_ahriman_setup_option_strings=(-h --help --build-as-user --from-configuration --generate-salt --no-generate-salt --makeflags-jobs --no-makeflags-jobs --mirror --multilib --no-multilib --packager --server --sign-key --sign-target --web-port --web-unix-socket)
_shtab_ahriman_shell_option_strings=(-h --help -o --output)
_shtab_ahriman_sign_option_strings=(-h --help)
_shtab_ahriman_status_option_strings=(-h --help --ahriman -e --exit-code --info --no-info -s --status)
_shtab_ahriman_status_update_option_strings=(-h --help -s --status)
_shtab_ahriman_sync_option_strings=(-h --help)
_shtab_ahriman_update_option_strings=(-h --help --aur --no-aur --changes --no-changes --check-files --no-check-files --dependencies --no-dependencies --dry-run -e --exit-code --increment --no-increment --local --no-local --manual --no-manual -u --username --vcs --no-vcs -y --refresh)
_shtab_ahriman_user_add_option_strings=(-h --help --key --packager -p --password -R --role)
_shtab_ahriman_user_list_option_strings=(-h --help -e --exit-code -R --role)
_shtab_ahriman_user_remove_option_strings=(-h --help)
_shtab_ahriman_version_option_strings=(-h --help)
_shtab_ahriman_web_option_strings=(-h --help)
_shtab_ahriman_web_reload_option_strings=(-h --help)
_shtab_ahriman_option_strings=(-h --help -a --architecture -c --configuration --force -l --lock --log-handler -q --quiet --report --no-report -r --repository --unsafe -V --version --wait-timeout)
_shtab_ahriman_option_strings=('-h' '--help' '-a' '--architecture' '-c' '--configuration' '--force' '-l' '--lock' '--log-handler' '-q' '--quiet' '--report' '--no-report' '-r' '--repository' '--unsafe' '-V' '--version' '--wait-timeout')
_shtab_ahriman_add_option_strings=('-h' '--help' '--changes' '--no-changes' '--dependencies' '--no-dependencies' '-e' '--exit-code' '--increment' '--no-increment' '-n' '--now' '-y' '--refresh' '-s' '--source' '-u' '--username' '-v' '--variable')
_shtab_ahriman_aur_search_option_strings=('-h' '--help' '-e' '--exit-code' '--info' '--no-info' '--sort-by')
_shtab_ahriman_check_option_strings=('-h' '--help' '--changes' '--no-changes' '--check-files' '--no-check-files' '-e' '--exit-code' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_clean_option_strings=('-h' '--help' '--cache' '--no-cache' '--chroot' '--no-chroot' '--manual' '--no-manual' '--packages' '--no-packages' '--pacman' '--no-pacman')
_shtab_ahriman_config_option_strings=('-h' '--help' '--info' '--no-info' '--secure' '--no-secure')
_shtab_ahriman_config_validate_option_strings=('-h' '--help' '-e' '--exit-code')
_shtab_ahriman_copy_option_strings=('-h' '--help' '-e' '--exit-code' '--remove')
_shtab_ahriman_daemon_option_strings=('-h' '--help' '-i' '--interval' '--aur' '--no-aur' '--changes' '--no-changes' '--check-files' '--no-check-files' '--dependencies' '--no-dependencies' '--dry-run' '--increment' '--no-increment' '--local' '--no-local' '--manual' '--no-manual' '--partitions' '--no-partitions' '-u' '--username' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_help_option_strings=('-h' '--help')
_shtab_ahriman_help_commands_unsafe_option_strings=('-h' '--help')
_shtab_ahriman_help_updates_option_strings=('-h' '--help' '-e' '--exit-code')
_shtab_ahriman_help_version_option_strings=('-h' '--help')
_shtab_ahriman_init_option_strings=('-h' '--help' '--build-as-user' '--from-configuration' '--generate-salt' '--no-generate-salt' '--makeflags-jobs' '--no-makeflags-jobs' '--mirror' '--multilib' '--no-multilib' '--packager' '--server' '--sign-key' '--sign-target' '--web-port' '--web-unix-socket')
_shtab_ahriman_key_import_option_strings=('-h' '--help' '--key-server')
_shtab_ahriman_package_add_option_strings=('-h' '--help' '--changes' '--no-changes' '--dependencies' '--no-dependencies' '-e' '--exit-code' '--increment' '--no-increment' '-n' '--now' '-y' '--refresh' '-s' '--source' '-u' '--username' '-v' '--variable')
_shtab_ahriman_package_changes_option_strings=('-h' '--help' '-e' '--exit-code')
_shtab_ahriman_package_changes_remove_option_strings=('-h' '--help')
_shtab_ahriman_package_copy_option_strings=('-h' '--help' '-e' '--exit-code' '--remove')
_shtab_ahriman_package_remove_option_strings=('-h' '--help')
_shtab_ahriman_package_status_option_strings=('-h' '--help' '--ahriman' '-e' '--exit-code' '--info' '--no-info' '-s' '--status')
_shtab_ahriman_package_status_remove_option_strings=('-h' '--help')
_shtab_ahriman_package_status_update_option_strings=('-h' '--help' '-s' '--status')
_shtab_ahriman_package_update_option_strings=('-h' '--help' '--changes' '--no-changes' '--dependencies' '--no-dependencies' '-e' '--exit-code' '--increment' '--no-increment' '-n' '--now' '-y' '--refresh' '-s' '--source' '-u' '--username' '-v' '--variable')
_shtab_ahriman_patch_add_option_strings=('-h' '--help')
_shtab_ahriman_patch_list_option_strings=('-h' '--help' '-e' '--exit-code' '-v' '--variable')
_shtab_ahriman_patch_remove_option_strings=('-h' '--help' '-v' '--variable')
_shtab_ahriman_patch_set_add_option_strings=('-h' '--help' '-t' '--track')
_shtab_ahriman_rebuild_option_strings=('-h' '--help' '--depends-on' '--dry-run' '--from-database' '--increment' '--no-increment' '-e' '--exit-code' '-s' '--status' '-u' '--username')
_shtab_ahriman_remove_option_strings=('-h' '--help')
_shtab_ahriman_remove_unknown_option_strings=('-h' '--help' '--dry-run')
_shtab_ahriman_repo_backup_option_strings=('-h' '--help')
_shtab_ahriman_repo_check_option_strings=('-h' '--help' '--changes' '--no-changes' '--check-files' '--no-check-files' '-e' '--exit-code' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_repo_clean_option_strings=('-h' '--help' '--cache' '--no-cache' '--chroot' '--no-chroot' '--manual' '--no-manual' '--packages' '--no-packages' '--pacman' '--no-pacman')
_shtab_ahriman_repo_config_option_strings=('-h' '--help' '--info' '--no-info' '--secure' '--no-secure')
_shtab_ahriman_repo_config_validate_option_strings=('-h' '--help' '-e' '--exit-code')
_shtab_ahriman_repo_create_keyring_option_strings=('-h' '--help')
_shtab_ahriman_repo_create_mirrorlist_option_strings=('-h' '--help')
_shtab_ahriman_repo_daemon_option_strings=('-h' '--help' '-i' '--interval' '--aur' '--no-aur' '--changes' '--no-changes' '--check-files' '--no-check-files' '--dependencies' '--no-dependencies' '--dry-run' '--increment' '--no-increment' '--local' '--no-local' '--manual' '--no-manual' '--partitions' '--no-partitions' '-u' '--username' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_repo_init_option_strings=('-h' '--help' '--build-as-user' '--from-configuration' '--generate-salt' '--no-generate-salt' '--makeflags-jobs' '--no-makeflags-jobs' '--mirror' '--multilib' '--no-multilib' '--packager' '--server' '--sign-key' '--sign-target' '--web-port' '--web-unix-socket')
_shtab_ahriman_repo_rebuild_option_strings=('-h' '--help' '--depends-on' '--dry-run' '--from-database' '--increment' '--no-increment' '-e' '--exit-code' '-s' '--status' '-u' '--username')
_shtab_ahriman_repo_remove_unknown_option_strings=('-h' '--help' '--dry-run')
_shtab_ahriman_repo_report_option_strings=('-h' '--help')
_shtab_ahriman_repo_restore_option_strings=('-h' '--help' '-o' '--output')
_shtab_ahriman_repo_setup_option_strings=('-h' '--help' '--build-as-user' '--from-configuration' '--generate-salt' '--no-generate-salt' '--makeflags-jobs' '--no-makeflags-jobs' '--mirror' '--multilib' '--no-multilib' '--packager' '--server' '--sign-key' '--sign-target' '--web-port' '--web-unix-socket')
_shtab_ahriman_repo_sign_option_strings=('-h' '--help')
_shtab_ahriman_repo_statistics_option_strings=('-h' '--help' '--chart' '-e' '--event' '--from-date' '--limit' '--offset' '--to-date')
_shtab_ahriman_repo_status_update_option_strings=('-h' '--help' '-s' '--status')
_shtab_ahriman_repo_sync_option_strings=('-h' '--help')
_shtab_ahriman_repo_tree_option_strings=('-h' '--help' '-p' '--partitions')
_shtab_ahriman_repo_triggers_option_strings=('-h' '--help')
_shtab_ahriman_repo_update_option_strings=('-h' '--help' '--aur' '--no-aur' '--changes' '--no-changes' '--check-files' '--no-check-files' '--dependencies' '--no-dependencies' '--dry-run' '-e' '--exit-code' '--increment' '--no-increment' '--local' '--no-local' '--manual' '--no-manual' '-u' '--username' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_report_option_strings=('-h' '--help')
_shtab_ahriman_run_option_strings=('-h' '--help')
_shtab_ahriman_search_option_strings=('-h' '--help' '-e' '--exit-code' '--info' '--no-info' '--sort-by')
_shtab_ahriman_service_clean_option_strings=('-h' '--help' '--cache' '--no-cache' '--chroot' '--no-chroot' '--manual' '--no-manual' '--packages' '--no-packages' '--pacman' '--no-pacman')
_shtab_ahriman_service_config_option_strings=('-h' '--help' '--info' '--no-info' '--secure' '--no-secure')
_shtab_ahriman_service_config_validate_option_strings=('-h' '--help' '-e' '--exit-code')
_shtab_ahriman_service_key_import_option_strings=('-h' '--help' '--key-server')
_shtab_ahriman_service_repositories_option_strings=('-h' '--help' '--id-only' '--no-id-only')
_shtab_ahriman_service_run_option_strings=('-h' '--help')
_shtab_ahriman_service_setup_option_strings=('-h' '--help' '--build-as-user' '--from-configuration' '--generate-salt' '--no-generate-salt' '--makeflags-jobs' '--no-makeflags-jobs' '--mirror' '--multilib' '--no-multilib' '--packager' '--server' '--sign-key' '--sign-target' '--web-port' '--web-unix-socket')
_shtab_ahriman_service_shell_option_strings=('-h' '--help' '-o' '--output')
_shtab_ahriman_service_tree_migrate_option_strings=('-h' '--help')
_shtab_ahriman_setup_option_strings=('-h' '--help' '--build-as-user' '--from-configuration' '--generate-salt' '--no-generate-salt' '--makeflags-jobs' '--no-makeflags-jobs' '--mirror' '--multilib' '--no-multilib' '--packager' '--server' '--sign-key' '--sign-target' '--web-port' '--web-unix-socket')
_shtab_ahriman_shell_option_strings=('-h' '--help' '-o' '--output')
_shtab_ahriman_sign_option_strings=('-h' '--help')
_shtab_ahriman_status_option_strings=('-h' '--help' '--ahriman' '-e' '--exit-code' '--info' '--no-info' '-s' '--status')
_shtab_ahriman_status_update_option_strings=('-h' '--help' '-s' '--status')
_shtab_ahriman_sync_option_strings=('-h' '--help')
_shtab_ahriman_update_option_strings=('-h' '--help' '--aur' '--no-aur' '--changes' '--no-changes' '--check-files' '--no-check-files' '--dependencies' '--no-dependencies' '--dry-run' '-e' '--exit-code' '--increment' '--no-increment' '--local' '--no-local' '--manual' '--no-manual' '-u' '--username' '--vcs' '--no-vcs' '-y' '--refresh')
_shtab_ahriman_user_add_option_strings=('-h' '--help' '--key' '--packager' '-p' '--password' '-R' '--role')
_shtab_ahriman_user_list_option_strings=('-h' '--help' '-e' '--exit-code' '-R' '--role')
_shtab_ahriman_user_remove_option_strings=('-h' '--help')
_shtab_ahriman_version_option_strings=('-h' '--help')
_shtab_ahriman_web_option_strings=('-h' '--help')
_shtab_ahriman_web_reload_option_strings=('-h' '--help')
_shtab_ahriman_add__s_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_add___source_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_aur_search___sort_by_choices=(description first_submitted id last_modified maintainer name num_votes out_of_date package_base package_base_id popularity repository submitter url url_path version)
_shtab_ahriman_init___sign_target_choices=(disabled packages repository)
_shtab_ahriman_package_add__s_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_package_add___source_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_package_status__s_choices=(unknown pending building failed success)
_shtab_ahriman_package_status___status_choices=(unknown pending building failed success)
_shtab_ahriman_package_status_update__s_choices=(unknown pending building failed success)
_shtab_ahriman_package_status_update___status_choices=(unknown pending building failed success)
_shtab_ahriman_package_update__s_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_package_update___source_choices=(auto archive aur directory local remote repository)
_shtab_ahriman_rebuild__s_choices=(unknown pending building failed success)
_shtab_ahriman_rebuild___status_choices=(unknown pending building failed success)
_shtab_ahriman_repo_init___sign_target_choices=(disabled packages repository)
_shtab_ahriman_repo_rebuild__s_choices=(unknown pending building failed success)
_shtab_ahriman_repo_rebuild___status_choices=(unknown pending building failed success)
_shtab_ahriman_repo_setup___sign_target_choices=(disabled packages repository)
_shtab_ahriman_repo_statistics__e_choices=(build-log package-held package-outdated package-removed package-status-changed package-update-failed package-updated service-status-changed)
_shtab_ahriman_repo_statistics___event_choices=(build-log package-held package-outdated package-removed package-status-changed package-update-failed package-updated service-status-changed)
_shtab_ahriman_repo_status_update__s_choices=(unknown pending building failed success)
_shtab_ahriman_repo_status_update___status_choices=(unknown pending building failed success)
_shtab_ahriman_search___sort_by_choices=(description first_submitted id last_modified maintainer name num_votes out_of_date package_base package_base_id popularity repository submitter url url_path version)
_shtab_ahriman_service_setup___sign_target_choices=(disabled packages repository)
_shtab_ahriman_setup___sign_target_choices=(disabled packages repository)
_shtab_ahriman_status__s_choices=(unknown pending building failed success)
_shtab_ahriman_status___status_choices=(unknown pending building failed success)
_shtab_ahriman_status_update__s_choices=(unknown pending building failed success)
_shtab_ahriman_status_update___status_choices=(unknown pending building failed success)
_shtab_ahriman_user_add__R_choices=(unauthorized read reporter full)
_shtab_ahriman_user_add___role_choices=(unauthorized read reporter full)
_shtab_ahriman_user_list__R_choices=(unauthorized read reporter full)
_shtab_ahriman_user_list___role_choices=(unauthorized read reporter full)
_shtab_ahriman_pos_0_choices=(add aur-search check clean config config-validate copy daemon help help-commands-unsafe help-updates help-version init key-import package-add package-archives package-changes package-changes-remove package-copy package-hold package-pkgbuild package-pkgbuild-remove package-remove package-rollback package-status package-status-remove package-status-update package-unhold package-update patch-add patch-list patch-remove patch-set-add rebuild remove remove-unknown repo-backup repo-check repo-clean repo-config repo-config-validate repo-create-keyring repo-create-mirrorlist repo-daemon repo-init repo-rebuild repo-remove-unknown repo-report repo-restore repo-setup repo-sign repo-statistics repo-status-update repo-sync repo-tree repo-triggers repo-update report run search service-clean service-config service-config-validate service-key-import service-repositories service-run service-setup service-shell service-tree-migrate setup shell sign status status-update sync update user-add user-list user-remove version web web-reload)
_shtab_ahriman___log_handler_choices=(console syslog journald)
_shtab_ahriman_pos_0_choices=('add' 'aur-search' 'check' 'clean' 'config' 'config-validate' 'copy' 'daemon' 'help' 'help-commands-unsafe' 'help-updates' 'help-version' 'init' 'key-import' 'package-add' 'package-changes' 'package-changes-remove' 'package-copy' 'package-remove' 'package-status' 'package-status-remove' 'package-status-update' 'package-update' 'patch-add' 'patch-list' 'patch-remove' 'patch-set-add' 'rebuild' 'remove' 'remove-unknown' 'repo-backup' 'repo-check' 'repo-clean' 'repo-config' 'repo-config-validate' 'repo-create-keyring' 'repo-create-mirrorlist' 'repo-daemon' 'repo-init' 'repo-rebuild' 'repo-remove-unknown' 'repo-report' 'repo-restore' 'repo-setup' 'repo-sign' 'repo-statistics' 'repo-status-update' 'repo-sync' 'repo-tree' 'repo-triggers' 'repo-update' 'report' 'run' 'search' 'service-clean' 'service-config' 'service-config-validate' 'service-key-import' 'service-repositories' 'service-run' 'service-setup' 'service-shell' 'service-tree-migrate' 'setup' 'shell' 'sign' 'status' 'status-update' 'sync' 'update' 'user-add' 'user-list' 'user-remove' 'version' 'web' 'web-reload')
_shtab_ahriman___log_handler_choices=('console' 'syslog' 'journald')
_shtab_ahriman_add__s_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_add___source_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_aur_search___sort_by_choices=('description' 'first_submitted' 'id' 'last_modified' 'maintainer' 'name' 'num_votes' 'out_of_date' 'package_base' 'package_base_id' 'popularity' 'repository' 'submitter' 'url' 'url_path' 'version')
_shtab_ahriman_init___sign_target_choices=('disabled' 'packages' 'repository')
_shtab_ahriman_package_add__s_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_package_add___source_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_package_status__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_package_status___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_package_status_update__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_package_status_update___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_package_update__s_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_package_update___source_choices=('auto' 'archive' 'aur' 'directory' 'local' 'remote' 'repository')
_shtab_ahriman_rebuild__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_rebuild___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_repo_init___sign_target_choices=('disabled' 'packages' 'repository')
_shtab_ahriman_repo_rebuild__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_repo_rebuild___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_repo_setup___sign_target_choices=('disabled' 'packages' 'repository')
_shtab_ahriman_repo_statistics__e_choices=('package-outdated' 'package-removed' 'package-update-failed' 'package-updated')
_shtab_ahriman_repo_statistics___event_choices=('package-outdated' 'package-removed' 'package-update-failed' 'package-updated')
_shtab_ahriman_repo_status_update__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_repo_status_update___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_search___sort_by_choices=('description' 'first_submitted' 'id' 'last_modified' 'maintainer' 'name' 'num_votes' 'out_of_date' 'package_base' 'package_base_id' 'popularity' 'repository' 'submitter' 'url' 'url_path' 'version')
_shtab_ahriman_service_setup___sign_target_choices=('disabled' 'packages' 'repository')
_shtab_ahriman_setup___sign_target_choices=('disabled' 'packages' 'repository')
_shtab_ahriman_status__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_status___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_status_update__s_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_status_update___status_choices=('unknown' 'pending' 'building' 'failed' 'success')
_shtab_ahriman_user_add__R_choices=('unauthorized' 'read' 'reporter' 'full')
_shtab_ahriman_user_add___role_choices=('unauthorized' 'read' 'reporter' 'full')
_shtab_ahriman_user_list__R_choices=('unauthorized' 'read' 'reporter' 'full')
_shtab_ahriman_user_list___role_choices=('unauthorized' 'read' 'reporter' 'full')
_shtab_ahriman_pos_0_nargs=A...
_shtab_ahriman__h_nargs=0
_shtab_ahriman___help_nargs=0
_shtab_ahriman___force_nargs=0
_shtab_ahriman__q_nargs=0
_shtab_ahriman___quiet_nargs=0
_shtab_ahriman___report_nargs=0
_shtab_ahriman___no_report_nargs=0
_shtab_ahriman___unsafe_nargs=0
_shtab_ahriman__V_nargs=0
_shtab_ahriman___version_nargs=0
_shtab_ahriman_add_pos_0_nargs=+
_shtab_ahriman_add__h_nargs=0
_shtab_ahriman_add___help_nargs=0
@@ -151,7 +151,7 @@ _shtab_ahriman_aur_search__e_nargs=0
_shtab_ahriman_aur_search___exit_code_nargs=0
_shtab_ahriman_aur_search___info_nargs=0
_shtab_ahriman_aur_search___no_info_nargs=0
_shtab_ahriman_check_pos_0_nargs='*'
_shtab_ahriman_check_pos_0_nargs=*
_shtab_ahriman_check__h_nargs=0
_shtab_ahriman_check___help_nargs=0
_shtab_ahriman_check___changes_nargs=0
@@ -217,7 +217,7 @@ _shtab_ahriman_daemon__y_nargs=0
_shtab_ahriman_daemon___refresh_nargs=0
_shtab_ahriman_help__h_nargs=0
_shtab_ahriman_help___help_nargs=0
_shtab_ahriman_help_commands_unsafe_pos_0_nargs='*'
_shtab_ahriman_help_commands_unsafe_pos_0_nargs=*
_shtab_ahriman_help_commands_unsafe__h_nargs=0
_shtab_ahriman_help_commands_unsafe___help_nargs=0
_shtab_ahriman_help_updates__h_nargs=0
@@ -251,12 +251,6 @@ _shtab_ahriman_package_add__n_nargs=0
_shtab_ahriman_package_add___now_nargs=0
_shtab_ahriman_package_add__y_nargs=0
_shtab_ahriman_package_add___refresh_nargs=0
_shtab_ahriman_package_archives__h_nargs=0
_shtab_ahriman_package_archives___help_nargs=0
_shtab_ahriman_package_archives__e_nargs=0
_shtab_ahriman_package_archives___exit_code_nargs=0
_shtab_ahriman_package_archives___info_nargs=0
_shtab_ahriman_package_archives___no_info_nargs=0
_shtab_ahriman_package_changes__h_nargs=0
_shtab_ahriman_package_changes___help_nargs=0
_shtab_ahriman_package_changes__e_nargs=0
@@ -269,23 +263,10 @@ _shtab_ahriman_package_copy___help_nargs=0
_shtab_ahriman_package_copy__e_nargs=0
_shtab_ahriman_package_copy___exit_code_nargs=0
_shtab_ahriman_package_copy___remove_nargs=0
_shtab_ahriman_package_hold_pos_0_nargs=+
_shtab_ahriman_package_hold__h_nargs=0
_shtab_ahriman_package_hold___help_nargs=0
_shtab_ahriman_package_pkgbuild__h_nargs=0
_shtab_ahriman_package_pkgbuild___help_nargs=0
_shtab_ahriman_package_pkgbuild__e_nargs=0
_shtab_ahriman_package_pkgbuild___exit_code_nargs=0
_shtab_ahriman_package_pkgbuild_remove__h_nargs=0
_shtab_ahriman_package_pkgbuild_remove___help_nargs=0
_shtab_ahriman_package_remove_pos_0_nargs=+
_shtab_ahriman_package_remove__h_nargs=0
_shtab_ahriman_package_remove___help_nargs=0
_shtab_ahriman_package_rollback__h_nargs=0
_shtab_ahriman_package_rollback___help_nargs=0
_shtab_ahriman_package_rollback___hold_nargs=0
_shtab_ahriman_package_rollback___no_hold_nargs=0
_shtab_ahriman_package_status_pos_0_nargs='*'
_shtab_ahriman_package_status_pos_0_nargs=*
_shtab_ahriman_package_status__h_nargs=0
_shtab_ahriman_package_status___help_nargs=0
_shtab_ahriman_package_status___ahriman_nargs=0
@@ -296,12 +277,9 @@ _shtab_ahriman_package_status___no_info_nargs=0
_shtab_ahriman_package_status_remove_pos_0_nargs=+
_shtab_ahriman_package_status_remove__h_nargs=0
_shtab_ahriman_package_status_remove___help_nargs=0
_shtab_ahriman_package_status_update_pos_0_nargs='*'
_shtab_ahriman_package_status_update_pos_0_nargs=*
_shtab_ahriman_package_status_update__h_nargs=0
_shtab_ahriman_package_status_update___help_nargs=0
_shtab_ahriman_package_unhold_pos_0_nargs=+
_shtab_ahriman_package_unhold__h_nargs=0
_shtab_ahriman_package_unhold___help_nargs=0
_shtab_ahriman_package_update_pos_0_nargs=+
_shtab_ahriman_package_update__h_nargs=0
_shtab_ahriman_package_update___help_nargs=0
@@ -343,7 +321,7 @@ _shtab_ahriman_remove_unknown___help_nargs=0
_shtab_ahriman_remove_unknown___dry_run_nargs=0
_shtab_ahriman_repo_backup__h_nargs=0
_shtab_ahriman_repo_backup___help_nargs=0
_shtab_ahriman_repo_check_pos_0_nargs='*'
_shtab_ahriman_repo_check_pos_0_nargs=*
_shtab_ahriman_repo_check__h_nargs=0
_shtab_ahriman_repo_check___help_nargs=0
_shtab_ahriman_repo_check___changes_nargs=0
@@ -436,7 +414,7 @@ _shtab_ahriman_repo_setup___makeflags_jobs_nargs=0
_shtab_ahriman_repo_setup___no_makeflags_jobs_nargs=0
_shtab_ahriman_repo_setup___multilib_nargs=0
_shtab_ahriman_repo_setup___no_multilib_nargs=0
_shtab_ahriman_repo_sign_pos_0_nargs='*'
_shtab_ahriman_repo_sign_pos_0_nargs=*
_shtab_ahriman_repo_sign__h_nargs=0
_shtab_ahriman_repo_sign___help_nargs=0
_shtab_ahriman_repo_statistics__h_nargs=0
@@ -447,10 +425,10 @@ _shtab_ahriman_repo_sync__h_nargs=0
_shtab_ahriman_repo_sync___help_nargs=0
_shtab_ahriman_repo_tree__h_nargs=0
_shtab_ahriman_repo_tree___help_nargs=0
_shtab_ahriman_repo_triggers_pos_0_nargs='*'
_shtab_ahriman_repo_triggers_pos_0_nargs=*
_shtab_ahriman_repo_triggers__h_nargs=0
_shtab_ahriman_repo_triggers___help_nargs=0
_shtab_ahriman_repo_update_pos_0_nargs='*'
_shtab_ahriman_repo_update_pos_0_nargs=*
_shtab_ahriman_repo_update__h_nargs=0
_shtab_ahriman_repo_update___help_nargs=0
_shtab_ahriman_repo_update___aur_nargs=0
@@ -527,6 +505,8 @@ _shtab_ahriman_service_setup___multilib_nargs=0
_shtab_ahriman_service_setup___no_multilib_nargs=0
_shtab_ahriman_service_shell__h_nargs=0
_shtab_ahriman_service_shell___help_nargs=0
_shtab_ahriman_service_shell__v_nargs=0
_shtab_ahriman_service_shell___verbose_nargs=0
_shtab_ahriman_service_tree_migrate__h_nargs=0
_shtab_ahriman_service_tree_migrate___help_nargs=0
_shtab_ahriman_setup__h_nargs=0
@@ -539,10 +519,12 @@ _shtab_ahriman_setup___multilib_nargs=0
_shtab_ahriman_setup___no_multilib_nargs=0
_shtab_ahriman_shell__h_nargs=0
_shtab_ahriman_shell___help_nargs=0
_shtab_ahriman_sign_pos_0_nargs='*'
_shtab_ahriman_shell__v_nargs=0
_shtab_ahriman_shell___verbose_nargs=0
_shtab_ahriman_sign_pos_0_nargs=*
_shtab_ahriman_sign__h_nargs=0
_shtab_ahriman_sign___help_nargs=0
_shtab_ahriman_status_pos_0_nargs='*'
_shtab_ahriman_status_pos_0_nargs=*
_shtab_ahriman_status__h_nargs=0
_shtab_ahriman_status___help_nargs=0
_shtab_ahriman_status___ahriman_nargs=0
@@ -550,12 +532,12 @@ _shtab_ahriman_status__e_nargs=0
_shtab_ahriman_status___exit_code_nargs=0
_shtab_ahriman_status___info_nargs=0
_shtab_ahriman_status___no_info_nargs=0
_shtab_ahriman_status_update_pos_0_nargs='*'
_shtab_ahriman_status_update_pos_0_nargs=*
_shtab_ahriman_status_update__h_nargs=0
_shtab_ahriman_status_update___help_nargs=0
_shtab_ahriman_sync__h_nargs=0
_shtab_ahriman_sync___help_nargs=0
_shtab_ahriman_update_pos_0_nargs='*'
_shtab_ahriman_update_pos_0_nargs=*
_shtab_ahriman_update__h_nargs=0
_shtab_ahriman_update___help_nargs=0
_shtab_ahriman_update___aur_nargs=0
@@ -593,17 +575,6 @@ _shtab_ahriman_web__h_nargs=0
_shtab_ahriman_web___help_nargs=0
_shtab_ahriman_web_reload__h_nargs=0
_shtab_ahriman_web_reload___help_nargs=0
_shtab_ahriman_pos_0_nargs=A...
_shtab_ahriman__h_nargs=0
_shtab_ahriman___help_nargs=0
_shtab_ahriman___force_nargs=0
_shtab_ahriman__q_nargs=0
_shtab_ahriman___quiet_nargs=0
_shtab_ahriman___report_nargs=0
_shtab_ahriman___no_report_nargs=0
_shtab_ahriman___unsafe_nargs=0
_shtab_ahriman__V_nargs=0
_shtab_ahriman___version_nargs=0
# $1=COMP_WORDS[1]
@@ -631,7 +602,7 @@ _set_parser_defaults() {
completed_positional_actions=0
_set_new_action "pos_$completed_positional_actions" true
_set_new_action "pos_${completed_positional_actions}" true
}
# $1=action identifier
@@ -681,7 +652,7 @@ _shtab_ahriman() {
local prefix=_shtab_ahriman
local word_index=0
local pos_only=0 # "--" delimiter not encountered yet
local pos_only=0 # "--" delimeter not encountered yet
_set_parser_defaults
word_index=1
@@ -691,13 +662,13 @@ _shtab_ahriman() {
local this_word="${COMP_WORDS[$word_index]}"
if [[ $pos_only = 1 || " $this_word " != " -- " ]]; then
if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" $this_word "* ]]; then
if [[ -n $sub_parsers && " ${sub_parsers[@]} " == *" ${this_word} "* ]]; then
# valid subcommand: add it to the prefix & reset the current action
prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
_set_parser_defaults
fi
if [[ " ${current_option_strings[@]} " == *" $this_word "* ]]; then
if [[ " ${current_option_strings[@]} " == *" ${this_word} "* ]]; then
# a new action should be acquired (due to recognised option string or
# no more input expected from current action);
# the next positional action can fill in here
@@ -711,10 +682,10 @@ _shtab_ahriman() {
(( $word_index + 1 - $current_action_args_start_index - $pos_only >= \
$current_action_nargs )); then
$current_action_is_positional && let "completed_positional_actions += 1"
_set_new_action "pos_$completed_positional_actions" true
_set_new_action "pos_${completed_positional_actions}" true
fi
else
pos_only=1 # "--" delimiter encountered
pos_only=1 # "--" delimeter encountered
fi
let "word_index+=1"
@@ -722,32 +693,23 @@ _shtab_ahriman() {
# Generate the completions
COMPREPLY=()
if [[ $pos_only = 0 && "$completing_word" == -* &&
( -z "$current_action_compgen" || "$current_action_is_positional" = true ) ]]; then
if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
# optional argument started: use option strings
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
compgen -W "${current_option_strings[*]}" -- "$completing_word")
elif [[ "$previous_word" =~ ^[0-9\&]*[\<\>]\>?$ ]]; then
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
elif [[ "${previous_word}" == ">" || "${previous_word}" == ">>" ||
"${previous_word}" =~ ^[12]">" || "${previous_word}" =~ ^[12]">>" ]]; then
# handle redirection operators
compopt -o filenames 2>/dev/null || : # bash>=4
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(compgen -f -- "$completing_word")
COMPREPLY=( $(compgen -f -- "${completing_word}") )
else
# use choices & compgen
local action_compgen_word="$completing_word"
# handle tab-completing in the middle of a line (#248 <- #116)
[[ -n "$current_action_compgen" && "$completing_word" == -* ]] && action_compgen_word=""
[ -n "$current_action_compgen" ] && {
[[ "$current_action_compgen" =~ _(file|dir|glob|FILE|DIR|GLOB)|File|Dir|Glob ]] &&
compopt -o filenames 2>/dev/null || : # bash>=4
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
"$current_action_compgen" "$action_compgen_word")
}
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
compgen -W "${current_action_choices[*]}" -- "$completing_word")
local IFS=$'\n' # items may contain spaces, so delimit using newline
COMPREPLY=( $([ -n "${current_action_compgen}" ] \
&& "${current_action_compgen}" "${completing_word}") )
unset IFS
COMPREPLY+=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") )
fi
return 0
}
complete -F _shtab_ahriman ahriman
complete -o filenames -F _shtab_ahriman ahriman
+80 -179
View File
@@ -1,9 +1,9 @@
.TH AHRIMAN "1" "2026\-10\-13" "ahriman 2.22.2" "ArcH linux ReposItory MANager"
.TH AHRIMAN "1" "2026\-03\-08" "ahriman 2.20.0" "ArcH linux ReposItory MANager"
.SH NAME
ahriman \- ArcH linux ReposItory MANager
.SH SYNOPSIS
.B ahriman
[-h] [-a ARCHITECTURE] [-c CONFIGURATION] [--force] [-l LOCK] [--log-handler {console,syslog,journald}] [-q] [--report | --no-report] [-r REPOSITORY] [--unsafe] [-V] [--wait-timeout WAIT_TIMEOUT] {add,aur-search,check,clean,config,config-validate,copy,daemon,help,help-commands-unsafe,help-updates,help-version,init,key-import,package-add,package-archives,package-changes,package-changes-remove,package-copy,package-hold,package-pkgbuild,package-pkgbuild-remove,package-remove,package-rollback,package-status,package-status-remove,package-status-update,package-unhold,package-update,patch-add,patch-list,patch-remove,patch-set-add,rebuild,remove,remove-unknown,repo-backup,repo-check,repo-clean,repo-config,repo-config-validate,repo-create-keyring,repo-create-mirrorlist,repo-daemon,repo-init,repo-rebuild,repo-remove-unknown,repo-report,repo-restore,repo-setup,repo-sign,repo-statistics,repo-status-update,repo-sync,repo-tree,repo-triggers,repo-update,report,run,search,service-clean,service-config,service-config-validate,service-key-import,service-repositories,service-run,service-setup,service-shell,service-tree-migrate,setup,shell,sign,status,status-update,sync,update,user-add,user-list,user-remove,version,web,web-reload} ...
.B ahriman
[-h] [-a ARCHITECTURE] [-c CONFIGURATION] [--force] [-l LOCK] [--log-handler {console,syslog,journald}] [-q] [--report | --no-report] [-r REPOSITORY] [--unsafe] [-V] [--wait-timeout WAIT_TIMEOUT] {add,aur-search,check,clean,config,config-validate,copy,daemon,help,help-commands-unsafe,help-updates,help-version,init,key-import,package-add,package-changes,package-changes-remove,package-copy,package-remove,package-status,package-status-remove,package-status-update,package-update,patch-add,patch-list,patch-remove,patch-set-add,rebuild,remove,remove-unknown,repo-backup,repo-check,repo-clean,repo-config,repo-config-validate,repo-create-keyring,repo-create-mirrorlist,repo-daemon,repo-init,repo-rebuild,repo-remove-unknown,repo-report,repo-restore,repo-setup,repo-sign,repo-statistics,repo-status-update,repo-sync,repo-tree,repo-triggers,repo-update,report,run,search,service-clean,service-config,service-config-validate,service-key-import,service-repositories,service-run,service-setup,service-shell,service-tree-migrate,setup,shell,sign,status,status-update,sync,update,user-add,user-list,user-remove,version,web,web-reload} ...
.SH DESCRIPTION
ArcH linux ReposItory MANager
@@ -74,9 +74,6 @@ application version
\fBahriman\fR \fI\,package\-add\/\fR
add package
.TP
\fBahriman\fR \fI\,package\-archives\/\fR
list package archive versions
.TP
\fBahriman\fR \fI\,package\-changes\/\fR
get package changes
.TP
@@ -86,21 +83,9 @@ remove package changes
\fBahriman\fR \fI\,package\-copy\/\fR
copy package from another repository
.TP
\fBahriman\fR \fI\,package\-hold\/\fR
hold package
.TP
\fBahriman\fR \fI\,package\-pkgbuild\/\fR
get package pkgbuild
.TP
\fBahriman\fR \fI\,package\-pkgbuild\-remove\/\fR
remove package pkgbuild
.TP
\fBahriman\fR \fI\,package\-remove\/\fR
remove package
.TP
\fBahriman\fR \fI\,package\-rollback\/\fR
rollback package
.TP
\fBahriman\fR \fI\,package\-status\/\fR
get package status
.TP
@@ -110,9 +95,6 @@ remove package status
\fBahriman\fR \fI\,package\-status\-update\/\fR
update package status
.TP
\fBahriman\fR \fI\,package\-unhold\/\fR
unhold package
.TP
\fBahriman\fR \fI\,patch\-add\/\fR
add patch for PKGBUILD function
.TP
@@ -216,9 +198,9 @@ web server
reload configuration
.SH COMMAND \fI\,'ahriman aur\-search'\/\fR
usage: ahriman aur\-search [\-h] [\-e] [\-\-info | \-\-no\-info]
[\-\-sort\-by {description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,submitter,url,url_path,version}]
search [search ...]
usage: ahriman aur\-search [\-h] [\-e] [\-\-info | \-\-no\-info]
[\-\-sort\-by {description,first_submitted,id,last_modified,maintainer,name,num_votes,out_of_date,package_base,package_base_id,popularity,repository,submitter,url,url_path,version}]
search [search ...]
search for package in AUR using API
@@ -241,7 +223,7 @@ sort field by this field. In case if two packages have the same value of the spe
by name
.SH COMMAND \fI\,'ahriman help'\/\fR
usage: ahriman help [\-h] [subcommand]
usage: ahriman help [\-h] [subcommand]
show help message for application or command and exit
@@ -250,7 +232,7 @@ show help message for application or command and exit
show help message for specific command
.SH COMMAND \fI\,'ahriman help\-commands\-unsafe'\/\fR
usage: ahriman help\-commands\-unsafe [\-h] [subcommand ...]
usage: ahriman help\-commands\-unsafe [\-h] [subcommand ...]
list unsafe commands as defined in default args
@@ -260,7 +242,7 @@ instead of showing commands, just test command line for unsafe subcommand and re
otherwise
.SH COMMAND \fI\,'ahriman help\-updates'\/\fR
usage: ahriman help\-updates [\-h] [\-e]
usage: ahriman help\-updates [\-h] [\-e]
request AUR for current version and compare with current service version
@@ -270,15 +252,15 @@ request AUR for current version and compare with current service version
return non\-zero exit code if updates available
.SH COMMAND \fI\,'ahriman help\-version'\/\fR
usage: ahriman help\-version [\-h]
usage: ahriman help\-version [\-h]
print application and its dependencies versions
.SH COMMAND \fI\,'ahriman package\-add'\/\fR
usage: ahriman package\-add [\-h] [\-\-changes | \-\-no\-changes] [\-\-dependencies | \-\-no\-dependencies] [\-e]
[\-\-increment | \-\-no\-increment] [\-n] [\-s {auto,archive,aur,directory,local,remote,repository}]
[\-u USERNAME] [\-v VARIABLE] [\-y]
package [package ...]
usage: ahriman package\-add [\-h] [\-\-changes | \-\-no\-changes] [\-\-dependencies | \-\-no\-dependencies] [\-e]
[\-\-increment | \-\-no\-increment] [\-n] [\-y]
[\-s {auto,archive,aur,directory,local,remote,repository}] [\-u USERNAME] [\-v VARIABLE]
package [package ...]
add existing or new package to the build queue
@@ -307,6 +289,10 @@ increment package release (pkgrel) version on duplicate
\fB\-n\fR, \fB\-\-now\fR
run update function after
.TP
\fB\-y\fR, \fB\-\-refresh\fR
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
.TP
\fB\-s\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR, \fB\-\-source\fR \fI\,{auto,archive,aur,directory,local,remote,repository}\/\fR
explicitly specify the package source for this command
@@ -319,30 +305,8 @@ build as user
\fB\-v\fR \fI\,VARIABLE\/\fR, \fB\-\-variable\fR \fI\,VARIABLE\/\fR
apply specified makepkg variables to the next build
.TP
\fB\-y\fR, \fB\-\-refresh\fR
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
.SH COMMAND \fI\,'ahriman package\-archives'\/\fR
usage: ahriman package\-archives [\-h] [\-e] [\-\-info | \-\-no\-info] package
list available archive versions for the package
.TP
\fBpackage\fR
package base
.SH OPTIONS \fI\,'ahriman package\-archives'\/\fR
.TP
\fB\-e\fR, \fB\-\-exit\-code\fR
return non\-zero exit status if result is empty
.TP
\fB\-\-info\fR, \fB\-\-no\-info\fR
show additional package information
.SH COMMAND \fI\,'ahriman package\-changes'\/\fR
usage: ahriman package\-changes [\-h] [\-e] package
usage: ahriman package\-changes [\-h] [\-e] package
retrieve package changes stored in database
@@ -356,7 +320,7 @@ package base
return non\-zero exit status if result is empty
.SH COMMAND \fI\,'ahriman package\-changes\-remove'\/\fR
usage: ahriman package\-changes\-remove [\-h] package
usage: ahriman package\-changes\-remove [\-h] package
remove the package changes stored remotely
@@ -365,7 +329,7 @@ remove the package changes stored remotely
package base
.SH COMMAND \fI\,'ahriman package\-copy'\/\fR
usage: ahriman package\-copy [\-h] [\-e] [\-\-remove] source package [package ...]
usage: ahriman package\-copy [\-h] [\-e] [\-\-remove] source package [package ...]
copy package and its metadata from another repository
@@ -386,40 +350,8 @@ return non\-zero exit status if result is empty
\fB\-\-remove\fR
remove package from the source repository after
.SH COMMAND \fI\,'ahriman package\-hold'\/\fR
usage: ahriman package\-hold [\-h] package [package ...]
hold package from automatic updates
.TP
\fBpackage\fR
package base
.SH COMMAND \fI\,'ahriman package\-pkgbuild'\/\fR
usage: ahriman package\-pkgbuild [\-h] [\-e] package
retrieve package PKGBUILD stored in database
.TP
\fBpackage\fR
package base
.SH OPTIONS \fI\,'ahriman package\-pkgbuild'\/\fR
.TP
\fB\-e\fR, \fB\-\-exit\-code\fR
return non\-zero exit status if result is empty
.SH COMMAND \fI\,'ahriman package\-pkgbuild\-remove'\/\fR
usage: ahriman package\-pkgbuild\-remove [\-h] package
remove the package PKGBUILD stored remotely
.TP
\fBpackage\fR
package base
.SH COMMAND \fI\,'ahriman package\-remove'\/\fR
usage: ahriman package\-remove [\-h] package [package ...]
usage: ahriman package\-remove [\-h] package [package ...]
remove package from the repository
@@ -427,31 +359,9 @@ remove package from the repository
\fBpackage\fR
package name or base
.SH COMMAND \fI\,'ahriman package\-rollback'\/\fR
usage: ahriman package\-rollback [\-h] [\-\-hold | \-\-no\-hold] [\-u USERNAME] package version
rollback package to specified version from archives
.TP
\fBpackage\fR
package base
.TP
\fBversion\fR
package version
.SH OPTIONS \fI\,'ahriman package\-rollback'\/\fR
.TP
\fB\-\-hold\fR, \fB\-\-no\-hold\fR
hold package afterwards
.TP
\fB\-u\fR \fI\,USERNAME\/\fR, \fB\-\-username\fR \fI\,USERNAME\/\fR
build as user
.SH COMMAND \fI\,'ahriman package\-status'\/\fR
usage: ahriman package\-status [\-h] [\-\-ahriman] [\-e] [\-\-info | \-\-no\-info] [\-s {unknown,pending,building,failed,success}]
[package ...]
usage: ahriman package\-status [\-h] [\-\-ahriman] [\-e] [\-\-info | \-\-no\-info] [\-s {unknown,pending,building,failed,success}]
[package ...]
request status of the package
@@ -477,7 +387,7 @@ show additional package information
filter packages by status
.SH COMMAND \fI\,'ahriman package\-status\-remove'\/\fR
usage: ahriman package\-status\-remove [\-h] package [package ...]
usage: ahriman package\-status\-remove [\-h] package [package ...]
remove the package from the status page
@@ -486,7 +396,7 @@ remove the package from the status page
remove specified packages from status page
.SH COMMAND \fI\,'ahriman package\-status\-update'\/\fR
usage: ahriman package\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}] [package ...]
usage: ahriman package\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}] [package ...]
update package status on the status page
@@ -499,17 +409,8 @@ set status for specified packages. If no packages supplied, service status will
\fB\-s\fR \fI\,{unknown,pending,building,failed,success}\/\fR, \fB\-\-status\fR \fI\,{unknown,pending,building,failed,success}\/\fR
new package build status
.SH COMMAND \fI\,'ahriman package\-unhold'\/\fR
usage: ahriman package\-unhold [\-h] package [package ...]
remove package hold, allowing automatic updates
.TP
\fBpackage\fR
package base
.SH COMMAND \fI\,'ahriman patch\-add'\/\fR
usage: ahriman patch\-add [\-h] package variable [patch]
usage: ahriman patch\-add [\-h] package variable [patch]
create or update patched PKGBUILD function or variable
@@ -526,7 +427,7 @@ PKGBUILD variable or function name. If variable is a function, it must end with
path to file which contains function or variable value. If not set, the value will be read from stdin
.SH COMMAND \fI\,'ahriman patch\-list'\/\fR
usage: ahriman patch\-list [\-h] [\-e] [\-v VARIABLE] package
usage: ahriman patch\-list [\-h] [\-e] [\-v VARIABLE] package
list available patches for the package
@@ -544,7 +445,7 @@ return non\-zero exit status if result is empty
if set, show only patches for specified PKGBUILD variables
.SH COMMAND \fI\,'ahriman patch\-remove'\/\fR
usage: ahriman patch\-remove [\-h] [\-v VARIABLE] package
usage: ahriman patch\-remove [\-h] [\-v VARIABLE] package
remove patches for the package
@@ -559,7 +460,7 @@ should be used for single\-function patches in case if you wold like to remove o
if not set, it will remove all patches related to the package
.SH COMMAND \fI\,'ahriman patch\-set\-add'\/\fR
usage: ahriman patch\-set\-add [\-h] [\-t TRACK] package
usage: ahriman patch\-set\-add [\-h] [\-t TRACK] package
create or update source patches
@@ -573,7 +474,7 @@ path to directory with changed files for patch addition/update
files which has to be tracked
.SH COMMAND \fI\,'ahriman repo\-backup'\/\fR
usage: ahriman repo\-backup [\-h] path
usage: ahriman repo\-backup [\-h] path
backup repository settings and database
@@ -582,9 +483,9 @@ backup repository settings and database
path of the output archive
.SH COMMAND \fI\,'ahriman repo\-check'\/\fR
usage: ahriman repo\-check [\-h] [\-\-changes | \-\-no\-changes] [\-\-check\-files | \-\-no\-check\-files] [\-e] [\-\-vcs | \-\-no\-vcs]
[\-y]
[package ...]
usage: ahriman repo\-check [\-h] [\-\-changes | \-\-no\-changes] [\-\-check\-files | \-\-no\-check\-files] [\-e] [\-\-vcs | \-\-no\-vcs]
[\-y]
[package ...]
check for packages updates. Same as repo\-update \-\-dry\-run \-\-no\-manual
@@ -614,20 +515,20 @@ fetch actual version of VCS packages
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
.SH COMMAND \fI\,'ahriman repo\-create\-keyring'\/\fR
usage: ahriman repo\-create\-keyring [\-h]
usage: ahriman repo\-create\-keyring [\-h]
create package which contains list of trusted keys as set by configuration. Note, that this action will only create package, the package itself has to be built manually
.SH COMMAND \fI\,'ahriman repo\-create\-mirrorlist'\/\fR
usage: ahriman repo\-create\-mirrorlist [\-h]
usage: ahriman repo\-create\-mirrorlist [\-h]
create package which contains list of available mirrors as set by configuration. Note, that this action will only create package, the package itself has to be built manually
.SH COMMAND \fI\,'ahriman repo\-daemon'\/\fR
usage: ahriman repo\-daemon [\-h] [\-i INTERVAL] [\-\-aur | \-\-no\-aur] [\-\-changes | \-\-no\-changes]
[\-\-check\-files | \-\-no\-check\-files] [\-\-dependencies | \-\-no\-dependencies] [\-\-dry\-run]
[\-\-increment | \-\-no\-increment] [\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual]
[\-\-partitions | \-\-no\-partitions] [\-u USERNAME] [\-\-vcs | \-\-no\-vcs] [\-y]
usage: ahriman repo\-daemon [\-h] [\-i INTERVAL] [\-\-aur | \-\-no\-aur] [\-\-changes | \-\-no\-changes]
[\-\-check\-files | \-\-no\-check\-files] [\-\-dependencies | \-\-no\-dependencies] [\-\-dry\-run]
[\-\-increment | \-\-no\-increment] [\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual]
[\-\-partitions | \-\-no\-partitions] [\-u USERNAME] [\-\-vcs | \-\-no\-vcs] [\-y]
start process which periodically will run update process
@@ -685,8 +586,8 @@ fetch actual version of VCS packages
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
.SH COMMAND \fI\,'ahriman repo\-rebuild'\/\fR
usage: ahriman repo\-rebuild [\-h] [\-\-depends\-on DEPENDS_ON] [\-\-dry\-run] [\-\-from\-database] [\-\-increment | \-\-no\-increment]
[\-e] [\-s {unknown,pending,building,failed,success}] [\-u USERNAME]
usage: ahriman repo\-rebuild [\-h] [\-\-depends\-on DEPENDS_ON] [\-\-dry\-run] [\-\-from\-database] [\-\-increment | \-\-no\-increment]
[\-e] [\-s {unknown,pending,building,failed,success}] [\-u USERNAME]
force rebuild whole repository
@@ -722,7 +623,7 @@ filter packages by status. Requires \-\-from\-database to be set
build as user
.SH COMMAND \fI\,'ahriman repo\-remove\-unknown'\/\fR
usage: ahriman repo\-remove\-unknown [\-h] [\-\-dry\-run]
usage: ahriman repo\-remove\-unknown [\-h] [\-\-dry\-run]
remove packages which are missing in AUR and do not have local PKGBUILDs
@@ -732,12 +633,12 @@ remove packages which are missing in AUR and do not have local PKGBUILDs
just perform check for packages without removal
.SH COMMAND \fI\,'ahriman repo\-report'\/\fR
usage: ahriman repo\-report [\-h]
usage: ahriman repo\-report [\-h]
generate repository report according to current settings
.SH COMMAND \fI\,'ahriman repo\-restore'\/\fR
usage: ahriman repo\-restore [\-h] [\-o OUTPUT] path
usage: ahriman repo\-restore [\-h] [\-o OUTPUT] path
restore settings and database
@@ -751,7 +652,7 @@ path of the input archive
root path of the extracted files
.SH COMMAND \fI\,'ahriman repo\-sign'\/\fR
usage: ahriman repo\-sign [\-h] [package ...]
usage: ahriman repo\-sign [\-h] [package ...]
(re\-)sign packages and repository database according to current settings
@@ -760,10 +661,10 @@ usage: ahriman repo\-sign [\-h] [package ...]
sign only specified packages
.SH COMMAND \fI\,'ahriman repo\-statistics'\/\fR
usage: ahriman repo\-statistics [\-h] [\-\-chart CHART]
[\-e {build\-log,package\-held,package\-outdated,package\-removed,package\-status\-changed,package\-update\-failed,package\-updated,service\-status\-changed}]
[\-\-from\-date FROM_DATE] [\-\-limit LIMIT] [\-\-offset OFFSET] [\-\-to\-date TO_DATE]
[package]
usage: ahriman repo\-statistics [\-h] [\-\-chart CHART]
[\-e {package\-outdated,package\-removed,package\-update\-failed,package\-updated}]
[\-\-from\-date FROM_DATE] [\-\-limit LIMIT] [\-\-offset OFFSET] [\-\-to\-date TO_DATE]
[package]
fetch repository statistics
@@ -777,7 +678,7 @@ fetch only events for the specified package
create updates chart and save it to the specified path
.TP
\fB\-e\fR \fI\,{build\-log,package\-held,package\-outdated,package\-removed,package\-status\-changed,package\-update\-failed,package\-updated,service\-status\-changed}\/\fR, \fB\-\-event\fR \fI\,{build\-log,package\-held,package\-outdated,package\-removed,package\-status\-changed,package\-update\-failed,package\-updated,service\-status\-changed}\/\fR
\fB\-e\fR \fI\,{package\-outdated,package\-removed,package\-update\-failed,package\-updated}\/\fR, \fB\-\-event\fR \fI\,{package\-outdated,package\-removed,package\-update\-failed,package\-updated}\/\fR
event type filter
.TP
@@ -797,7 +698,7 @@ skip specified amount of events
only fetch events which are older than the date
.SH COMMAND \fI\,'ahriman repo\-status\-update'\/\fR
usage: ahriman repo\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}]
usage: ahriman repo\-status\-update [\-h] [\-s {unknown,pending,building,failed,success}]
update repository status on the status page
@@ -807,12 +708,12 @@ update repository status on the status page
new status
.SH COMMAND \fI\,'ahriman repo\-sync'\/\fR
usage: ahriman repo\-sync [\-h]
usage: ahriman repo\-sync [\-h]
sync repository files to remote server according to current settings
.SH COMMAND \fI\,'ahriman repo\-tree'\/\fR
usage: ahriman repo\-tree [\-h] [\-p PARTITIONS]
usage: ahriman repo\-tree [\-h] [\-p PARTITIONS]
dump repository tree based on packages dependencies
@@ -822,7 +723,7 @@ dump repository tree based on packages dependencies
also divide packages by independent partitions
.SH COMMAND \fI\,'ahriman repo\-triggers'\/\fR
usage: ahriman repo\-triggers [\-h] [trigger ...]
usage: ahriman repo\-triggers [\-h] [trigger ...]
run triggers on empty build result as configured by settings
@@ -831,10 +732,10 @@ run triggers on empty build result as configured by settings
instead of running all triggers as set by configuration, just process specified ones in order of mention
.SH COMMAND \fI\,'ahriman repo\-update'\/\fR
usage: ahriman repo\-update [\-h] [\-\-aur | \-\-no\-aur] [\-\-changes | \-\-no\-changes] [\-\-check\-files | \-\-no\-check\-files]
[\-\-dependencies | \-\-no\-dependencies] [\-\-dry\-run] [\-e] [\-\-increment | \-\-no\-increment]
[\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual] [\-u USERNAME] [\-\-vcs | \-\-no\-vcs] [\-y]
[package ...]
usage: ahriman repo\-update [\-h] [\-\-aur | \-\-no\-aur] [\-\-changes | \-\-no\-changes] [\-\-check\-files | \-\-no\-check\-files]
[\-\-dependencies | \-\-no\-dependencies] [\-\-dry\-run] [\-e] [\-\-increment | \-\-no\-increment]
[\-\-local | \-\-no\-local] [\-\-manual | \-\-no\-manual] [\-u USERNAME] [\-\-vcs | \-\-no\-vcs] [\-y]
[package ...]
check for packages updates and run build process if requested
@@ -892,8 +793,8 @@ fetch actual version of VCS packages
download fresh package databases from the mirror before actions, \-yy to force refresh even if up to date
.SH COMMAND \fI\,'ahriman service\-clean'\/\fR
usage: ahriman service\-clean [\-h] [\-\-cache | \-\-no\-cache] [\-\-chroot | \-\-no\-chroot] [\-\-manual | \-\-no\-manual]
[\-\-packages | \-\-no\-packages] [\-\-pacman | \-\-no\-pacman]
usage: ahriman service\-clean [\-h] [\-\-cache | \-\-no\-cache] [\-\-chroot | \-\-no\-chroot] [\-\-manual | \-\-no\-manual]
[\-\-packages | \-\-no\-packages] [\-\-pacman | \-\-no\-pacman]
remove local caches
@@ -919,7 +820,7 @@ clear directory with built packages
clear directory with pacman local database cache
.SH COMMAND \fI\,'ahriman service\-config'\/\fR
usage: ahriman service\-config [\-h] [\-\-info | \-\-no\-info] [\-\-secure | \-\-no\-secure] [section] [key]
usage: ahriman service\-config [\-h] [\-\-info | \-\-no\-info] [\-\-secure | \-\-no\-secure] [section] [key]
dump configuration for the specified architecture
@@ -941,7 +842,7 @@ show additional information, e.g. configuration files
hide passwords and secrets from output
.SH COMMAND \fI\,'ahriman service\-config\-validate'\/\fR
usage: ahriman service\-config\-validate [\-h] [\-e]
usage: ahriman service\-config\-validate [\-h] [\-e]
validate configuration and print found errors
@@ -951,7 +852,7 @@ validate configuration and print found errors
return non\-zero exit status if configuration is invalid
.SH COMMAND \fI\,'ahriman service\-key\-import'\/\fR
usage: ahriman service\-key\-import [\-h] [\-\-key\-server KEY_SERVER] key
usage: ahriman service\-key\-import [\-h] [\-\-key\-server KEY_SERVER] key
import PGP key from public sources to the repository user
@@ -965,7 +866,7 @@ PGP key to import from public server
key server for key import
.SH COMMAND \fI\,'ahriman service\-repositories'\/\fR
usage: ahriman service\-repositories [\-h] [\-\-id\-only | \-\-no\-id\-only]
usage: ahriman service\-repositories [\-h] [\-\-id\-only | \-\-no\-id\-only]
list all available repositories
@@ -975,7 +876,7 @@ list all available repositories
show machine readable identifier instead
.SH COMMAND \fI\,'ahriman service\-run'\/\fR
usage: ahriman service\-run [\-h] command [command ...]
usage: ahriman service\-run [\-h] command [command ...]
run multiple commands on success run of the previous command
@@ -984,13 +885,13 @@ run multiple commands on success run of the previous command
command to be run (quoted) without ``ahriman``
.SH COMMAND \fI\,'ahriman service\-setup'\/\fR
usage: ahriman service\-setup [\-h] [\-\-build\-as\-user BUILD_AS_USER] [\-\-from\-configuration FROM_CONFIGURATION]
[\-\-generate\-salt | \-\-no\-generate\-salt] [\-\-makeflags\-jobs | \-\-no\-makeflags\-jobs]
[\-\-mirror MIRROR] [\-\-multilib | \-\-no\-multilib] \-\-packager PACKAGER [\-\-server SERVER]
[\-\-sign\-key SIGN_KEY] [\-\-sign\-target {disabled,packages,repository}] [\-\-web\-port WEB_PORT]
[\-\-web\-unix\-socket WEB_UNIX_SOCKET]
usage: ahriman service\-setup [\-h] [\-\-build\-as\-user BUILD_AS_USER] [\-\-from\-configuration FROM_CONFIGURATION]
[\-\-generate\-salt | \-\-no\-generate\-salt] [\-\-makeflags\-jobs | \-\-no\-makeflags\-jobs]
[\-\-mirror MIRROR] [\-\-multilib | \-\-no\-multilib] \-\-packager PACKAGER [\-\-server SERVER]
[\-\-sign\-key SIGN_KEY] [\-\-sign\-target {disabled,packages,repository}] [\-\-web\-port WEB_PORT]
[\-\-web\-unix\-socket WEB_UNIX_SOCKET]
create initial service configuration as the repository owner
create initial service configuration, requires root
.SH OPTIONS \fI\,'ahriman service\-setup'\/\fR
.TP
@@ -1042,7 +943,7 @@ port of the web service
path to unix socket used for interprocess communications
.SH COMMAND \fI\,'ahriman service\-shell'\/\fR
usage: ahriman service\-shell [\-h] [\-o OUTPUT] [code]
usage: ahriman service\-shell [\-h] [\-o OUTPUT] [code]
drop into python shell
@@ -1056,13 +957,13 @@ instead of dropping into shell, just execute the specified code
output commands and result to the file
.SH COMMAND \fI\,'ahriman service\-tree\-migrate'\/\fR
usage: ahriman service\-tree\-migrate [\-h]
usage: ahriman service\-tree\-migrate [\-h]
migrate repository tree between versions
.SH COMMAND \fI\,'ahriman user\-add'\/\fR
usage: ahriman user\-add [\-h] [\-\-key KEY] [\-\-packager PACKAGER] [\-p PASSWORD] [\-R {unauthorized,read,reporter,full}]
username
usage: ahriman user\-add [\-h] [\-\-key KEY] [\-\-packager PACKAGER] [\-p PASSWORD] [\-R {unauthorized,read,reporter,full}]
username
update user for web services with the given password and role. In case if password was not entered it will be asked interactively
@@ -1089,7 +990,7 @@ authorization type.
user access level
.SH COMMAND \fI\,'ahriman user\-list'\/\fR
usage: ahriman user\-list [\-h] [\-e] [\-R {unauthorized,read,reporter,full}] [username]
usage: ahriman user\-list [\-h] [\-e] [\-R {unauthorized,read,reporter,full}] [username]
list users from the user mapping and their roles
@@ -1107,7 +1008,7 @@ return non\-zero exit status if result is empty
filter users by role
.SH COMMAND \fI\,'ahriman user\-remove'\/\fR
usage: ahriman user\-remove [\-h] username
usage: ahriman user\-remove [\-h] username
remove user from the user mapping and update the configuration
@@ -1116,12 +1017,12 @@ remove user from the user mapping and update the configuration
username for web service
.SH COMMAND \fI\,'ahriman web'\/\fR
usage: ahriman web [\-h]
usage: ahriman web [\-h]
start web server
.SH COMMAND \fI\,'ahriman web\-reload'\/\fR
usage: ahriman web\-reload [\-h]
usage: ahriman web\-reload [\-h]
reload web server configuration
@@ -1,97 +1,86 @@
#compdef ahriman
# AUTOMATICALLY GENERATED by https://github.com/tqdm/shtab
# Usage:
# 1) Copy this to a file named _ahriman (e.g. ~/.local/share/zsh_completion/_ahriman).
# 2) Add the following line to your .zshrc:
# fpath=(~/.local/share/zsh_completion $fpath)
# See also: https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
# AUTOMATICALLY GENERATED by `shtab`
_shtab_ahriman_commands() {
local _commands=(
add:'add existing or new package to the build queue'
aur-search:'search for package in AUR using API'
check:'check for packages updates. Same as repo-update --dry-run --no-manual'
clean:'remove local caches'
config:'dump configuration for the specified architecture'
config-validate:'validate configuration and print found errors'
copy:'copy package and its metadata from another repository'
daemon:'start process which periodically will run update process'
help:'show help message for application or command and exit'
help-commands-unsafe:'list unsafe commands as defined in default args'
help-updates:'request AUR for current version and compare with current service version'
help-version:'print application and its dependencies versions'
init:'create initial service configuration as the repository owner'
key-import:'import PGP key from public sources to the repository user'
package-add:'add existing or new package to the build queue'
package-archives:'list available archive versions for the package'
package-changes:'retrieve package changes stored in database'
package-changes-remove:'remove the package changes stored remotely'
package-copy:'copy package and its metadata from another repository'
package-hold:'hold package from automatic updates'
package-pkgbuild:'retrieve package PKGBUILD stored in database'
package-pkgbuild-remove:'remove the package PKGBUILD stored remotely'
package-remove:'remove package from the repository'
package-rollback:'rollback package to specified version from archives'
package-status:'request status of the package'
package-status-remove:'remove the package from the status page'
package-status-update:'update package status on the status page'
package-unhold:'remove package hold, allowing automatic updates'
package-update:'add existing or new package to the build queue'
patch-add:'create or update patched PKGBUILD function or variable'
patch-list:'list available patches for the package'
patch-remove:'remove patches for the package'
patch-set-add:'create or update source patches'
rebuild:'force rebuild whole repository'
remove:'remove package from the repository'
remove-unknown:'remove packages which are missing in AUR and do not have local PKGBUILDs'
repo-backup:'backup repository settings and database'
repo-check:'check for packages updates. Same as repo-update --dry-run --no-manual'
repo-clean:'remove local caches'
repo-config:'dump configuration for the specified architecture'
repo-config-validate:'validate configuration and print found errors'
repo-create-keyring:'create package which contains list of trusted keys as set by configuration. Note, that this action will only create package, the package itself has to be built manually'
repo-create-mirrorlist:'create package which contains list of available mirrors as set by configuration. Note, that this action will only create package, the package itself has to be built manually'
repo-daemon:'start process which periodically will run update process'
repo-init:'create initial service configuration as the repository owner'
repo-rebuild:'force rebuild whole repository'
repo-remove-unknown:'remove packages which are missing in AUR and do not have local PKGBUILDs'
repo-report:'generate repository report according to current settings'
repo-restore:'restore settings and database'
repo-setup:'create initial service configuration as the repository owner'
repo-sign:'(re-)sign packages and repository database according to current settings'
repo-statistics:'fetch repository statistics'
repo-status-update:'update repository status on the status page'
repo-sync:'sync repository files to remote server according to current settings'
repo-tree:'dump repository tree based on packages dependencies'
repo-triggers:'run triggers on empty build result as configured by settings'
repo-update:'check for packages updates and run build process if requested'
report:'generate repository report according to current settings'
run:'run multiple commands on success run of the previous command'
search:'search for package in AUR using API'
service-clean:'remove local caches'
service-config:'dump configuration for the specified architecture'
service-config-validate:'validate configuration and print found errors'
service-key-import:'import PGP key from public sources to the repository user'
service-repositories:'list all available repositories'
service-run:'run multiple commands on success run of the previous command'
service-setup:'create initial service configuration as the repository owner'
service-shell:'drop into python shell'
service-tree-migrate:'migrate repository tree between versions'
setup:'create initial service configuration as the repository owner'
shell:'drop into python shell'
sign:'(re-)sign packages and repository database according to current settings'
status:'request status of the package'
status-update:'update package status on the status page'
sync:'sync repository files to remote server according to current settings'
update:'check for packages updates and run build process if requested'
user-add:'update user for web services with the given password and role. In case if password was not entered it will be asked interactively'
user-list:'list users from the user mapping and their roles'
user-remove:'remove user from the user mapping and update the configuration'
version:'print application and its dependencies versions'
web:'start web server'
web-reload:'reload web server configuration'
"add:add existing or new package to the build queue"
"aur-search:search for package in AUR using API"
"check:check for packages updates. Same as repo-update --dry-run --no-manual"
"clean:remove local caches"
"config:dump configuration for the specified architecture"
"config-validate:validate configuration and print found errors"
"copy:copy package and its metadata from another repository"
"daemon:start process which periodically will run update process"
"help:show help message for application or command and exit"
"help-commands-unsafe:list unsafe commands as defined in default args"
"help-updates:request AUR for current version and compare with current service version"
"help-version:print application and its dependencies versions"
"init:create initial service configuration, requires root"
"key-import:import PGP key from public sources to the repository user"
"package-add:add existing or new package to the build queue"
"package-changes:retrieve package changes stored in database"
"package-changes-remove:remove the package changes stored remotely"
"package-copy:copy package and its metadata from another repository"
"package-remove:remove package from the repository"
"package-status:request status of the package"
"package-status-remove:remove the package from the status page"
"package-status-update:update package status on the status page"
"package-update:add existing or new package to the build queue"
"patch-add:create or update patched PKGBUILD function or variable"
"patch-list:list available patches for the package"
"patch-remove:remove patches for the package"
"patch-set-add:create or update source patches"
"rebuild:force rebuild whole repository"
"remove:remove package from the repository"
"remove-unknown:remove packages which are missing in AUR and do not have local PKGBUILDs"
"repo-backup:backup repository settings and database"
"repo-check:check for packages updates. Same as repo-update --dry-run --no-manual"
"repo-clean:remove local caches"
"repo-config:dump configuration for the specified architecture"
"repo-config-validate:validate configuration and print found errors"
"repo-create-keyring:create package which contains list of trusted keys as set by configuration. Note, that this action will only create package, the package itself has to be built manually"
"repo-create-mirrorlist:create package which contains list of available mirrors as set by configuration. Note, that this action will only create package, the package itself has to be built manually"
"repo-daemon:start process which periodically will run update process"
"repo-init:create initial service configuration, requires root"
"repo-rebuild:force rebuild whole repository"
"repo-remove-unknown:remove packages which are missing in AUR and do not have local PKGBUILDs"
"repo-report:generate repository report according to current settings"
"repo-restore:restore settings and database"
"repo-setup:create initial service configuration, requires root"
"repo-sign:(re-)sign packages and repository database according to current settings"
"repo-statistics:fetch repository statistics"
"repo-status-update:update repository status on the status page"
"repo-sync:sync repository files to remote server according to current settings"
"repo-tree:dump repository tree based on packages dependencies"
"repo-triggers:run triggers on empty build result as configured by settings"
"repo-update:check for packages updates and run build process if requested"
"report:generate repository report according to current settings"
"run:run multiple commands on success run of the previous command"
"search:search for package in AUR using API"
"service-clean:remove local caches"
"service-config:dump configuration for the specified architecture"
"service-config-validate:validate configuration and print found errors"
"service-key-import:import PGP key from public sources to the repository user"
"service-repositories:list all available repositories"
"service-run:run multiple commands on success run of the previous command"
"service-setup:create initial service configuration, requires root"
"service-shell:drop into python shell"
"service-tree-migrate:migrate repository tree between versions"
"setup:create initial service configuration, requires root"
"shell:drop into python shell"
"sign:(re-)sign packages and repository database according to current settings"
"status:request status of the package"
"status-update:update package status on the status page"
"sync:sync repository files to remote server according to current settings"
"update:check for packages updates and run build process if requested"
"user-add:update user for web services with the given password and role. In case if password was not entered it will be asked interactively"
"user-list:list users from the user mapping and their roles"
"user-remove:remove user from the user mapping and update the configuration"
"version:print application and its dependencies versions"
"web:start web server"
"web-reload:reload web server configuration"
)
_describe 'ahriman commands' _commands
}
@@ -104,7 +93,7 @@ _shtab_ahriman_options=(
{-l,--lock}"[lock file (default\: ahriman.pid)]:lock:"
"--log-handler[explicit log handler specification. If none set, the handler will be guessed from environment (default\: None)]:log_handler:(console syslog journald)"
{-q,--quiet}"[force disable any logging (default\: False)]"
{--report,--no-report}"[force enable or disable reporting to web service (default\: True)]"
{--report,--no-report}"[force enable or disable reporting to web service (default\: True)]:report:"
{-r,--repository}"[filter by target repository (default\: None)]:repository:"
"--unsafe[allow to run ahriman as non-ahriman user. Some actions might be unavailable (default\: False)]"
"(- : *)"{-V,--version}"[show program\'s version number and exit]"
@@ -116,15 +105,15 @@ _shtab_ahriman_defaults_added=0
_shtab_ahriman_add_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]:increment:"
{-n,--now}"[run update function after (default\: False)]"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
{-s,--source}"[explicitly specify the package source for this command (default\: auto)]:source:(auto archive aur directory local remote repository)"
{-u,--username}"[build as user (default\: None)]:username:"
"*"{-v,--variable}"[apply specified makepkg variables to the next build (default\: None)]:variable:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*):package source (base name, path to local files, remote URL):"
)
@@ -134,7 +123,7 @@ _shtab_ahriman_add_defaults_added=0
_shtab_ahriman_aur_search_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]:info:"
"--sort-by[sort field by this field. In case if two packages have the same value of the specified field, they will be always sorted by name (default\: name)]:sort_by:(description first_submitted id last_modified maintainer name num_votes out_of_date package_base package_base_id popularity repository submitter url url_path version)"
"(*):search terms, can be specified multiple times, the result will match all terms:"
)
@@ -144,10 +133,10 @@ _shtab_ahriman_aur_search_defaults_added=0
_shtab_ahriman_check_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*)::filter check by package base (default\: None):"
)
@@ -157,11 +146,11 @@ _shtab_ahriman_check_defaults_added=0
_shtab_ahriman_clean_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]:cache:"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]:chroot:"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]:manual:"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]:packages:"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]:pacman:"
)
# guard to ensure default positional specs are added only once per session
@@ -169,8 +158,8 @@ _shtab_ahriman_clean_defaults_added=0
_shtab_ahriman_config_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -200,17 +189,17 @@ _shtab_ahriman_copy_defaults_added=0
_shtab_ahriman_daemon_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-i,--interval}"[interval between runs in seconds (default\: 43200)]:interval:"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]:aur:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]"
{--partitions,--no-partitions}"[instead of updating whole repository, split updates into chunks (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]:local:"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]:manual:"
{--partitions,--no-partitions}"[instead of updating whole repository, split updates into chunks (default\: True)]:partitions:"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
)
@@ -252,10 +241,10 @@ _shtab_ahriman_init_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--build-as-user[force makepkg user to the specific one (default\: None)]:build_as_user:"
"--from-configuration[path to default devtools pacman configuration (default\: \/usr\/share\/devtools\/pacman.conf.d\/extra.conf)]:from_configuration:"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
"--mirror[use the specified explicitly mirror instead of including mirrorlist (default\: None)]:mirror:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]:multilib:"
"--packager[packager name and email]:packager:"
"--server[server to be used for devtools. If none set, local files will be used (default\: None)]:server:"
"--sign-key[sign key id (default\: None)]:sign_key:"
@@ -278,31 +267,21 @@ _shtab_ahriman_key_import_defaults_added=0
_shtab_ahriman_package_add_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]:increment:"
{-n,--now}"[run update function after (default\: False)]"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
{-s,--source}"[explicitly specify the package source for this command (default\: auto)]:source:(auto archive aur directory local remote repository)"
{-u,--username}"[build as user (default\: None)]:username:"
"*"{-v,--variable}"[apply specified makepkg variables to the next build (default\: None)]:variable:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*):package source (base name, path to local files, remote URL):"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_add_defaults_added=0
_shtab_ahriman_package_archives_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]"
":package base:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_archives_defaults_added=0
_shtab_ahriman_package_changes_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
@@ -331,31 +310,6 @@ _shtab_ahriman_package_copy_options=(
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_copy_defaults_added=0
_shtab_ahriman_package_hold_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"(*):package base:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_hold_defaults_added=0
_shtab_ahriman_package_pkgbuild_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
":package base:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_pkgbuild_defaults_added=0
_shtab_ahriman_package_pkgbuild_remove_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
":package base:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_pkgbuild_remove_defaults_added=0
_shtab_ahriman_package_remove_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"(*):package name or base:"
@@ -364,22 +318,11 @@ _shtab_ahriman_package_remove_options=(
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_remove_defaults_added=0
_shtab_ahriman_package_rollback_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--hold,--no-hold}"[hold package afterwards (default\: True)]"
{-u,--username}"[build as user (default\: None)]:username:"
":package base:"
":package version:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_rollback_defaults_added=0
_shtab_ahriman_package_status_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--ahriman[get service status itself (default\: False)]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]:info:"
{-s,--status}"[filter packages by status (default\: None)]:status:(unknown pending building failed success)"
"(*)::filter status by package base (default\: None):"
)
@@ -404,25 +347,17 @@ _shtab_ahriman_package_status_update_options=(
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_status_update_defaults_added=0
_shtab_ahriman_package_unhold_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"(*):package base:"
)
# guard to ensure default positional specs are added only once per session
_shtab_ahriman_package_unhold_defaults_added=0
_shtab_ahriman_package_update_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]:increment:"
{-n,--now}"[run update function after (default\: False)]"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
{-s,--source}"[explicitly specify the package source for this command (default\: auto)]:source:(auto archive aur directory local remote repository)"
{-u,--username}"[build as user (default\: None)]:username:"
"*"{-v,--variable}"[apply specified makepkg variables to the next build (default\: None)]:variable:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*):package source (base name, path to local files, remote URL):"
)
@@ -472,7 +407,7 @@ _shtab_ahriman_rebuild_options=(
"*--depends-on[only rebuild packages that depend on specified packages (default\: None)]:depends_on:"
"--dry-run[just perform check for packages without rebuild process itself (default\: False)]"
"--from-database[read packages from database instead of filesystem. This feature in particular is required in case if you would like to restore repository from another repository instance. Note, however, that in order to restore packages you need to have original ahriman instance run with web service and have run repo-update at least once. (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{-s,--status}"[filter packages by status. Requires --from-database to be set (default\: None)]:status:(unknown pending building failed success)"
{-u,--username}"[build as user (default\: None)]:username:"
@@ -507,10 +442,10 @@ _shtab_ahriman_repo_backup_defaults_added=0
_shtab_ahriman_repo_check_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*)::filter check by package base (default\: None):"
)
@@ -520,11 +455,11 @@ _shtab_ahriman_repo_check_defaults_added=0
_shtab_ahriman_repo_clean_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]:cache:"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]:chroot:"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]:manual:"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]:packages:"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]:pacman:"
)
# guard to ensure default positional specs are added only once per session
@@ -532,8 +467,8 @@ _shtab_ahriman_repo_clean_defaults_added=0
_shtab_ahriman_repo_config_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -566,17 +501,17 @@ _shtab_ahriman_repo_create_mirrorlist_defaults_added=0
_shtab_ahriman_repo_daemon_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-i,--interval}"[interval between runs in seconds (default\: 43200)]:interval:"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]:aur:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]"
{--partitions,--no-partitions}"[instead of updating whole repository, split updates into chunks (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]:local:"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]:manual:"
{--partitions,--no-partitions}"[instead of updating whole repository, split updates into chunks (default\: True)]:partitions:"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
)
@@ -587,10 +522,10 @@ _shtab_ahriman_repo_init_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--build-as-user[force makepkg user to the specific one (default\: None)]:build_as_user:"
"--from-configuration[path to default devtools pacman configuration (default\: \/usr\/share\/devtools\/pacman.conf.d\/extra.conf)]:from_configuration:"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
"--mirror[use the specified explicitly mirror instead of including mirrorlist (default\: None)]:mirror:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]:multilib:"
"--packager[packager name and email]:packager:"
"--server[server to be used for devtools. If none set, local files will be used (default\: None)]:server:"
"--sign-key[sign key id (default\: None)]:sign_key:"
@@ -607,7 +542,7 @@ _shtab_ahriman_repo_rebuild_options=(
"*--depends-on[only rebuild packages that depend on specified packages (default\: None)]:depends_on:"
"--dry-run[just perform check for packages without rebuild process itself (default\: False)]"
"--from-database[read packages from database instead of filesystem. This feature in particular is required in case if you would like to restore repository from another repository instance. Note, however, that in order to restore packages you need to have original ahriman instance run with web service and have run repo-update at least once. (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{-s,--status}"[filter packages by status. Requires --from-database to be set (default\: None)]:status:(unknown pending building failed success)"
{-u,--username}"[build as user (default\: None)]:username:"
@@ -644,10 +579,10 @@ _shtab_ahriman_repo_setup_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--build-as-user[force makepkg user to the specific one (default\: None)]:build_as_user:"
"--from-configuration[path to default devtools pacman configuration (default\: \/usr\/share\/devtools\/pacman.conf.d\/extra.conf)]:from_configuration:"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
"--mirror[use the specified explicitly mirror instead of including mirrorlist (default\: None)]:mirror:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]:multilib:"
"--packager[packager name and email]:packager:"
"--server[server to be used for devtools. If none set, local files will be used (default\: None)]:server:"
"--sign-key[sign key id (default\: None)]:sign_key:"
@@ -670,7 +605,7 @@ _shtab_ahriman_repo_sign_defaults_added=0
_shtab_ahriman_repo_statistics_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--chart[create updates chart and save it to the specified path (default\: None)]:chart:"
{-e,--event}"[event type filter (default\: package-updated)]:event:(build-log package-held package-outdated package-removed package-status-changed package-update-failed package-updated service-status-changed)"
{-e,--event}"[event type filter (default\: package-updated)]:event:(package-outdated package-removed package-update-failed package-updated)"
"--from-date[only fetch events which are newer than the date (default\: None)]:from_date:"
"--limit[limit response by specified amount of events (default\: -1)]:limit:"
"--offset[skip specified amount of events (default\: 0)]:offset:"
@@ -714,17 +649,17 @@ _shtab_ahriman_repo_triggers_defaults_added=0
_shtab_ahriman_repo_update_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]:aur:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]:local:"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]:manual:"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*)::filter check by package base (default\: None):"
)
@@ -750,7 +685,7 @@ _shtab_ahriman_run_defaults_added=0
_shtab_ahriman_search_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]:info:"
"--sort-by[sort field by this field. In case if two packages have the same value of the specified field, they will be always sorted by name (default\: name)]:sort_by:(description first_submitted id last_modified maintainer name num_votes out_of_date package_base package_base_id popularity repository submitter url url_path version)"
"(*):search terms, can be specified multiple times, the result will match all terms:"
)
@@ -760,11 +695,11 @@ _shtab_ahriman_search_defaults_added=0
_shtab_ahriman_service_clean_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]"
{--cache,--no-cache}"[clear directory with package caches (default\: False)]:cache:"
{--chroot,--no-chroot}"[clear build chroot (default\: False)]:chroot:"
{--manual,--no-manual}"[clear manually added packages queue (default\: False)]:manual:"
{--packages,--no-packages}"[clear directory with built packages (default\: False)]:packages:"
{--pacman,--no-pacman}"[clear directory with pacman local database cache (default\: False)]:pacman:"
)
# guard to ensure default positional specs are added only once per session
@@ -772,8 +707,8 @@ _shtab_ahriman_service_clean_defaults_added=0
_shtab_ahriman_service_config_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -800,7 +735,7 @@ _shtab_ahriman_service_key_import_defaults_added=0
_shtab_ahriman_service_repositories_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--id-only,--no-id-only}"[show machine readable identifier instead (default\: False)]"
{--id-only,--no-id-only}"[show machine readable identifier instead (default\: False)]:id_only:"
)
# guard to ensure default positional specs are added only once per session
@@ -818,10 +753,10 @@ _shtab_ahriman_service_setup_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--build-as-user[force makepkg user to the specific one (default\: None)]:build_as_user:"
"--from-configuration[path to default devtools pacman configuration (default\: \/usr\/share\/devtools\/pacman.conf.d\/extra.conf)]:from_configuration:"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
"--mirror[use the specified explicitly mirror instead of including mirrorlist (default\: None)]:mirror:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]:multilib:"
"--packager[packager name and email]:packager:"
"--server[server to be used for devtools. If none set, local files will be used (default\: None)]:server:"
"--sign-key[sign key id (default\: None)]:sign_key:"
@@ -853,10 +788,10 @@ _shtab_ahriman_setup_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--build-as-user[force makepkg user to the specific one (default\: None)]:build_as_user:"
"--from-configuration[path to default devtools pacman configuration (default\: \/usr\/share\/devtools\/pacman.conf.d\/extra.conf)]:from_configuration:"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]"
{--generate-salt,--no-generate-salt}"[generate salt for user passwords (default\: False)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
"--mirror[use the specified explicitly mirror instead of including mirrorlist (default\: None)]:mirror:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]:multilib:"
"--packager[packager name and email]:packager:"
"--server[server to be used for devtools. If none set, local files will be used (default\: None)]:server:"
"--sign-key[sign key id (default\: None)]:sign_key:"
@@ -889,7 +824,7 @@ _shtab_ahriman_status_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
"--ahriman[get service status itself (default\: False)]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]"
{--info,--no-info}"[show additional package information (default\: False)]:info:"
{-s,--status}"[filter packages by status (default\: None)]:status:(unknown pending building failed success)"
"(*)::filter status by package base (default\: None):"
)
@@ -915,17 +850,17 @@ _shtab_ahriman_sync_defaults_added=0
_shtab_ahriman_update_options=(
"(- : *)"{-h,--help}"[show this help message and exit]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{--aur,--no-aur}"[enable or disable checking for AUR updates (default\: True)]:aur:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available. Only applicable in dry run mode (default\: True)]:changes:"
{--check-files,--no-check-files}"[enable or disable checking of broken dependencies (e.g. dynamically linked libraries or modules directories) (default\: True)]:check_files:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{-e,--exit-code}"[return non-zero exit status if result is empty (default\: False)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]:increment:"
{--local,--no-local}"[enable or disable checking of local packages for updates (default\: True)]:local:"
{--manual,--no-manual}"[include or exclude manual updates (default\: True)]:manual:"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
"(*)::filter check by package base (default\: None):"
)
@@ -986,7 +921,7 @@ _shtab_ahriman_web_reload_defaults_added=0
_shtab_ahriman() {
local context state line curcontext="$curcontext" one_or_more='(*)' remainder='(-)*:' default='*::: :->ahriman'
local context state line curcontext="$curcontext" one_or_more='(*)' remainder='(-)*' default='*::: :->ahriman'
# Add default positional/remainder specs only if none exist, and only once per session
if (( ! _shtab_ahriman_defaults_added )); then
@@ -1018,19 +953,13 @@ _shtab_ahriman() {
init) _arguments -C -s $_shtab_ahriman_init_options ;;
key-import) _arguments -C -s $_shtab_ahriman_key_import_options ;;
package-add) _arguments -C -s $_shtab_ahriman_package_add_options ;;
package-archives) _arguments -C -s $_shtab_ahriman_package_archives_options ;;
package-changes) _arguments -C -s $_shtab_ahriman_package_changes_options ;;
package-changes-remove) _arguments -C -s $_shtab_ahriman_package_changes_remove_options ;;
package-copy) _arguments -C -s $_shtab_ahriman_package_copy_options ;;
package-hold) _arguments -C -s $_shtab_ahriman_package_hold_options ;;
package-pkgbuild) _arguments -C -s $_shtab_ahriman_package_pkgbuild_options ;;
package-pkgbuild-remove) _arguments -C -s $_shtab_ahriman_package_pkgbuild_remove_options ;;
package-remove) _arguments -C -s $_shtab_ahriman_package_remove_options ;;
package-rollback) _arguments -C -s $_shtab_ahriman_package_rollback_options ;;
package-status) _arguments -C -s $_shtab_ahriman_package_status_options ;;
package-status-remove) _arguments -C -s $_shtab_ahriman_package_status_remove_options ;;
package-status-update) _arguments -C -s $_shtab_ahriman_package_status_update_options ;;
package-unhold) _arguments -C -s $_shtab_ahriman_package_unhold_options ;;
package-update) _arguments -C -s $_shtab_ahriman_package_update_options ;;
patch-add) _arguments -C -s $_shtab_ahriman_patch_add_options ;;
patch-list) _arguments -C -s $_shtab_ahriman_patch_list_options ;;
+21 -20
View File
@@ -1,25 +1,24 @@
[build-system]
requires = [
"hatchling",
]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "ahriman-core"
description = "ArcH linux ReposItory MANager, core package"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
authors = [
{name = "ahriman team"},
]
dependencies = [
"bcrypt",
"filelock",
"inflection",
"pyelftools",
"requests",
"tree-sitter",
"tree-sitter-bash",
]
description = "ArcH linux ReposItory MANager, core package"
dynamic = [
"version",
]
requires-python = ">=3.14"
dynamic = ["version"]
[project.optional-dependencies]
journald = [
@@ -44,7 +43,7 @@ stats = [
"matplotlib",
]
unixsocket = [
"requests-unixsocket2", # required by unix socket support
"requests-unixsocket2",
]
validator = [
"cerberus",
@@ -53,15 +52,17 @@ validator = [
[project.scripts]
ahriman = "ahriman.application.ahriman:run"
[tool.hatch.build.targets.wheel]
packages = [
"src/ahriman",
]
[tool.hatch.build.targets.wheel.shared-data]
"package/bin" = "bin"
"package/lib" = "lib"
"package/share" = "share"
[project.urls]
Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
packages = ["src/ahriman"]
[tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib"
"package/share" = "share"
+1 -1
View File
@@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__version__ = "2.22.2"
__version__ = "2.20.0"
@@ -19,7 +19,6 @@
#
import argparse
from functools import partial
from pathlib import Path
import ahriman.application.handlers
@@ -28,19 +27,17 @@ from ahriman import __version__
from ahriman.application.handlers.handler import Handler
from ahriman.application.help_formatter import _HelpFormatter
from ahriman.core.module_loader import implementations
from ahriman.core.utils import enum_values
from ahriman.models.log_handler import LogHandler
__all__: list[str] = []
def _parser(*, color: bool = False) -> argparse.ArgumentParser:
def _parser() -> argparse.ArgumentParser:
"""
command line parser generator
Args:
color(bool, optional): enable colors in help messages (Default value = False)
Returns:
argparse.ArgumentParser: command line parser for the application
"""
@@ -66,7 +63,7 @@ Start web service (requires additional configuration):
>>> ahriman web
""",
fromfile_prefix_chars="@", formatter_class=_HelpFormatter, color=color)
fromfile_prefix_chars="@", formatter_class=_HelpFormatter)
parser.add_argument("-a", "--architecture", help="filter by target architecture")
parser.add_argument("-c", "--configuration", help="configuration path", type=Path,
default=Path("/") / "etc" / "ahriman.ini")
@@ -74,7 +71,7 @@ Start web service (requires additional configuration):
parser.add_argument("-l", "--lock", help="lock file", type=Path, default=Path("ahriman.pid"))
parser.add_argument("--log-handler", help="explicit log handler specification. If none set, the handler will be "
"guessed from environment",
type=LogHandler, choices=tuple(LogHandler))
type=LogHandler, choices=enum_values(LogHandler))
parser.add_argument("-q", "--quiet", help="force disable any logging", action="store_true")
parser.add_argument("--report", help="force enable or disable reporting to web service",
action=argparse.BooleanOptionalAction, default=True)
@@ -95,9 +92,8 @@ Start web service (requires additional configuration):
for handler in implementations(ahriman.application.handlers, Handler):
for subparser_parser in handler.arguments:
subparser = subparser_parser(subparsers)
subparser.color = color
subparser.formatter_class = _HelpFormatter
subparser.set_defaults(handler=handler, parser=partial(_parser, color=color))
subparser.set_defaults(handler=handler, parser=_parser)
# sort actions alphabetically in both choices and help message
# pylint: disable=protected-access
@@ -114,7 +110,7 @@ def run() -> int:
Returns:
int: application status code
"""
parser = _parser(color=True)
parser = _parser()
args = parser.parse_args()
if args.command is None: # in case of empty command we would like to print help message
@@ -158,8 +158,6 @@ class ApplicationRepository(ApplicationProperties):
# process already built packages if any
if built_packages := self.repository.packages_built(): # speedup a bit
build_result = self.repository.process_update(built_packages, packagers)
for package in build_result.success:
self.database.build_queue_clear(package.base)
self.on_result(build_result)
result.merge(build_result)
@@ -174,8 +172,6 @@ class ApplicationRepository(ApplicationProperties):
for num, partition in enumerate(partitions):
self.logger.info("processing chunk #%i %s", num, [package.base for package in partition])
build_result = builder.update(partition, packagers, bump_pkgrel=bump_pkgrel)
for package in partition:
self.database.build_queue_clear(package.base)
self.on_result(build_result)
result.merge(build_result)
@@ -23,7 +23,7 @@ from ahriman.application.application import Application
from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.application.handlers.update import Update
from ahriman.core.configuration import Configuration
from ahriman.core.utils import extract_user
from ahriman.core.utils import enum_values, extract_user
from ahriman.models.package_source import PackageSource
from ahriman.models.pkgbuild_patch import PkgbuildPatch
from ahriman.models.repository_id import RepositoryId
@@ -85,7 +85,7 @@ class Add(Handler):
action=argparse.BooleanOptionalAction, default=True)
parser.add_argument("-n", "--now", help="run update function after", action="store_true")
parser.add_argument("-s", "--source", help="explicitly specify the package source for this command",
type=PackageSource, choices=tuple(PackageSource), default=PackageSource.Auto)
type=PackageSource, choices=enum_values(PackageSource), default=PackageSource.Auto)
parser.add_argument("-u", "--username", help="build as user", default=extract_user())
parser.add_argument("-v", "--variable", help="apply specified makepkg variables to the next build",
action="append")
@@ -22,7 +22,7 @@ import argparse
from ahriman.application.application import Application
from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.core.configuration import Configuration
from ahriman.core.utils import extract_user
from ahriman.core.utils import enum_values, extract_user
from ahriman.models.build_status import BuildStatusEnum
from ahriman.models.package import Package
from ahriman.models.packagers import Packagers
@@ -88,7 +88,7 @@ class Rebuild(Handler):
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty",
action="store_true")
parser.add_argument("-s", "--status", help="filter packages by status. Requires --from-database to be set",
type=BuildStatusEnum, choices=tuple(BuildStatusEnum))
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum))
parser.add_argument("-u", "--username", help="build as user", default=extract_user())
return parser
@@ -18,18 +18,19 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import multiprocessing
import os
from pathlib import Path
from pwd import getpwuid
from typing import ClassVar
from urllib.parse import quote_plus as url_encode
from ahriman.application.application import Application
from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.core.configuration import Configuration
from ahriman.core.exceptions import InitializeError, MissingArchitectureError
from ahriman.core.exceptions import MissingArchitectureError
from ahriman.core.utils import enum_values
from ahriman.models.repository_id import RepositoryId
from ahriman.models.repository_paths import RepositoryPaths
from ahriman.models.sign_settings import SignSettings
from ahriman.models.user import User
@@ -39,12 +40,16 @@ class Setup(Handler):
setup handler
Attributes:
ARCHBUILD_COMMAND_PATH(Path): (class attribute) default devtools command
MIRRORLIST_PATH(Path): (class attribute) path to pacman default mirrorlist (used by multilib repository)
SUDOERS_DIR_PATH(Path): (class attribute) path to sudoers.d includes directory
"""
ALLOW_MULTI_ARCHITECTURE_RUN = False # conflicting io
ARCHBUILD_COMMAND_PATH: ClassVar[Path] = Path("/") / "usr" / "bin" / "archbuild"
MIRRORLIST_PATH: ClassVar[Path] = Path("/") / "etc" / "pacman.d" / "mirrorlist"
SUDOERS_DIR_PATH: ClassVar[Path] = Path("/") / "etc" / "sudoers.d"
@classmethod
def run(cls, args: argparse.Namespace, repository_id: RepositoryId, configuration: Configuration, *,
@@ -62,20 +67,21 @@ class Setup(Handler):
if args.architecture is None or args.repository is None:
raise MissingArchitectureError(args.command)
target_directory = Setup.configuration_create_directory(configuration)
Setup.configuration_create_ahriman(args, repository_id, configuration, target_directory)
Setup.configuration_create_ahriman(args, repository_id, configuration)
configuration.reload()
application = Application(repository_id, configuration, report=report)
paths = application.repository.paths
repository_server = f"file://{paths.repository}" if args.server is None else args.server
target_directory = paths.ensure_exists(configuration.getpath("build", "devtools_configs"))
Setup.configuration_create_devtools(repository_id, args.from_configuration, target_directory, args.mirror,
args.multilib, repository_server)
# basically we create configuration here as root, but it is ok, because those files are only used for reading
Setup.configuration_create_makepkg(args.packager, args.makeflags_jobs, application.repository.paths)
Setup.executable_create(application.repository.paths, repository_id)
repository_server = f"file://{application.repository.paths.repository}" if args.server is None else args.server
Setup.configuration_create_devtools(
repository_id, args.from_configuration, args.mirror, args.multilib, repository_server)
Setup.configuration_create_sudo(application.repository.paths, repository_id)
# finish initialization
with paths.preserve_owner():
with application.repository.paths.preserve_owner():
application.repository.repo.init()
# lazy database sync
application.repository.pacman.handle # pylint: disable=pointless-statement
@@ -93,7 +99,7 @@ class Setup(Handler):
"""
parser = root.add_parser("service-setup", aliases=["init", "repo-init", "repo-setup", "setup"],
help="initial service configuration",
description="create initial service configuration as the repository owner",
description="create initial service configuration, requires root",
epilog="Create minimal configuration for the service according to provided options.")
parser.add_argument("--build-as-user", help="force makepkg user to the specific one")
parser.add_argument("--from-configuration", help="path to default devtools pacman configuration",
@@ -111,16 +117,30 @@ class Setup(Handler):
parser.add_argument("--server", help="server to be used for devtools. If none set, local files will be used")
parser.add_argument("--sign-key", help="sign key id")
parser.add_argument("--sign-target", help="sign options", action="append",
type=SignSettings.from_option, choices=tuple(SignSettings))
type=SignSettings.from_option, choices=enum_values(SignSettings))
parser.add_argument("--web-port", help="port of the web service", type=int)
parser.add_argument("--web-unix-socket", help="path to unix socket used for interprocess communications",
type=Path)
parser.set_defaults(lock=None, quiet=True, report=False)
parser.set_defaults(lock=None, quiet=True, report=False, unsafe=True)
return parser
@staticmethod
def build_command(root: Path, repository_id: RepositoryId) -> Path:
"""
generate build command name
Args:
root(Path): root directory for the build command (must be root of the repository)
repository_id(RepositoryId): repository unique identifier
Returns:
Path: valid devtools command name
"""
return root / f"{repository_id.name}-{repository_id.architecture}-build"
@staticmethod
def configuration_create_ahriman(args: argparse.Namespace, repository_id: RepositoryId,
root: Configuration, target_directory: Path) -> None:
root: Configuration) -> None:
"""
create service specific configuration
@@ -128,16 +148,13 @@ class Setup(Handler):
args(argparse.Namespace): command line args
repository_id(RepositoryId): repository unique identifier
root(Configuration): root configuration instance
target_directory(Path): path to directory where configuration files will be written
"""
configuration = Configuration()
configuration.set_option("repository", "name", repository_id.name) # backward compatibility for docker
section = Configuration.section_name("build", repository_id.name, repository_id.architecture)
configuration.set_option(section, "packager", args.packager)
if args.makeflags_jobs:
configuration.set_option(section, "make_flags", f"-j{multiprocessing.cpu_count()}")
build_command = Setup.build_command(root.repository_paths.root, repository_id)
configuration.set_option(section, "build_command", str(build_command))
configuration.set_option("repository", "name", repository_id.name) # backward compatibility for docker
if args.build_as_user is not None:
configuration.set_option(section, "makechrootpkg_flags", f"-U {args.build_as_user}")
@@ -166,13 +183,14 @@ class Setup(Handler):
if args.generate_salt:
configuration.set_option("auth", "salt", User.generate_password(20))
target = target_directory / f"00-setup-overrides-{repository_id.id}.ini"
(root.include / "00-setup-overrides.ini").unlink(missing_ok=True) # remove old-style configuration
target = root.include / f"00-setup-overrides-{repository_id.id}.ini"
with target.open("w", encoding="utf8") as ahriman_configuration:
configuration.write(ahriman_configuration)
@staticmethod
def configuration_create_devtools(repository_id: RepositoryId, source: Path, target_directory: Path,
mirror: str | None, multilib: bool, repository_server: str) -> None:
def configuration_create_devtools(repository_id: RepositoryId, source: Path, mirror: str | None,
multilib: bool, repository_server: str) -> None:
"""
create configuration for devtools based on ``source`` configuration
@@ -182,7 +200,6 @@ class Setup(Handler):
Args:
repository_id(RepositoryId): repository unique identifier
source(Path): path to source configuration file
target_directory(Path): path to directory where configuration files will be written
mirror(str | None): link to package server mirror
multilib(bool): add or do not multilib repository to the configuration
repository_server(str): url of the repository
@@ -217,32 +234,54 @@ class Setup(Handler):
configuration.set_option(repository_id.name, "SigLevel", "Never") # we don't care
configuration.set_option(repository_id.name, "Server", repository_server)
target = target_directory / f"{repository_id.name}-{repository_id.architecture}.conf"
target = source.parent / f"{repository_id.name}-{repository_id.architecture}.conf"
with target.open("w", encoding="utf8") as devtools_configuration:
configuration.write(devtools_configuration)
@staticmethod
def configuration_create_directory(root: Configuration) -> Path:
def configuration_create_makepkg(packager: str, makeflags_jobs: bool, paths: RepositoryPaths) -> None:
"""
create directory for includes
create configuration for makepkg
Args:
root(Configuration): root configuration instance
Returns:
Path: path to first writable directory
Raises:
InitializeError: if no writable directories have been found
packager(str): packager identifier (e.g. name, email)
makeflags_jobs(bool): set MAKEFLAGS variable to number of cores
paths(RepositoryPaths): repository paths instance
"""
for include_path in root.include:
try:
directory = root.repository_paths.ensure_exists(include_path)
if os.access(directory, os.W_OK | os.X_OK):
return directory
except OSError:
continue
raise InitializeError("No writable include directory found")
content = f"PACKAGER='{packager}'\n"
if makeflags_jobs:
content += "MAKEFLAGS=\"-j$(nproc)\"\n"
uid, _ = paths.root_owner
home_dir = Path(getpwuid(uid).pw_dir)
(home_dir / ".makepkg.conf").write_text(content, encoding="utf8")
@staticmethod
def configuration_create_sudo(paths: RepositoryPaths, repository_id: RepositoryId) -> None:
"""
create configuration to run build command with sudo without password
Args:
paths(RepositoryPaths): repository paths instance
repository_id(RepositoryId): repository unique identifier
"""
command = Setup.build_command(paths.root, repository_id)
sudoers_file = Setup.build_command(Setup.SUDOERS_DIR_PATH, repository_id)
sudoers_file.write_text(f"ahriman ALL=(ALL) NOPASSWD:SETENV: {command} *\n", encoding="utf8")
sudoers_file.chmod(0o400) # security!
@staticmethod
def executable_create(paths: RepositoryPaths, repository_id: RepositoryId) -> None:
"""
create executable for the service
Args:
paths(RepositoryPaths): repository paths instance
repository_id(RepositoryId): repository unique identifier
"""
command = Setup.build_command(paths.root, repository_id)
command.unlink(missing_ok=True)
command.symlink_to(Setup.ARCHBUILD_COMMAND_PATH)
arguments = [_set_service_setup_parser]
@@ -28,7 +28,7 @@ from ahriman.application.application import Application
from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.core.configuration import Configuration
from ahriman.core.formatters import EventStatsPrinter, PackageStatsPrinter, RepositoryStatsPrinter
from ahriman.core.utils import pretty_datetime
from ahriman.core.utils import enum_values, pretty_datetime
from ahriman.models.event import Event, EventType
from ahriman.models.repository_id import RepositoryId
@@ -85,7 +85,7 @@ class Statistics(Handler):
parser.add_argument("package", help="fetch only events for the specified package", nargs="?")
parser.add_argument("--chart", help="create updates chart and save it to the specified path", type=Path)
parser.add_argument("-e", "--event", help="event type filter",
type=EventType, choices=tuple(EventType), default=EventType.PackageUpdated)
type=EventType, choices=enum_values(EventType), default=EventType.PackageUpdated)
parser.add_argument("--from-date", help="only fetch events which are newer than the date")
parser.add_argument("--limit", help="limit response by specified amount of events", type=int, default=-1)
parser.add_argument("--offset", help="skip specified amount of events", type=int, default=0)
@@ -26,6 +26,7 @@ from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.core.configuration import Configuration
from ahriman.core.formatters import PackagePrinter, StatusPrinter
from ahriman.core.types import Comparable
from ahriman.core.utils import enum_values
from ahriman.models.build_status import BuildStatus, BuildStatusEnum
from ahriman.models.package import Package
from ahriman.models.repository_id import RepositoryId
@@ -92,7 +93,7 @@ class Status(Handler):
parser.add_argument("--info", help="show additional package information",
action=argparse.BooleanOptionalAction, default=False)
parser.add_argument("-s", "--status", help="filter packages by status",
type=BuildStatusEnum, choices=tuple(BuildStatusEnum))
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum))
parser.set_defaults(lock=None, quiet=True, report=False, unsafe=True)
return parser
@@ -22,6 +22,7 @@ import argparse
from ahriman.application.application import Application
from ahriman.application.handlers.handler import Handler, SubParserAction
from ahriman.core.configuration import Configuration
from ahriman.core.utils import enum_values
from ahriman.models.action import Action
from ahriman.models.build_status import BuildStatusEnum
from ahriman.models.repository_id import RepositoryId
@@ -96,7 +97,7 @@ class StatusUpdate(Handler):
"If no packages supplied, service status will be updated",
nargs="*")
parser.add_argument("-s", "--status", help="new package build status",
type=BuildStatusEnum, choices=tuple(BuildStatusEnum), default=BuildStatusEnum.Success)
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
parser.set_defaults(action=Action.Update, lock=None, quiet=True, report=False, unsafe=True)
return parser
@@ -114,7 +115,7 @@ class StatusUpdate(Handler):
parser = root.add_parser("repo-status-update", help="update repository status",
description="update repository status on the status page")
parser.add_argument("-s", "--status", help="new status",
type=BuildStatusEnum, choices=tuple(BuildStatusEnum), default=BuildStatusEnum.Success)
type=BuildStatusEnum, choices=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
parser.set_defaults(action=Action.Update, lock=None, package=[], quiet=True, report=False, unsafe=True)
return parser
@@ -25,6 +25,7 @@ from ahriman.core.configuration import Configuration
from ahriman.core.database import SQLite
from ahriman.core.exceptions import PasswordError
from ahriman.core.formatters import UserPrinter
from ahriman.core.utils import enum_values
from ahriman.models.action import Action
from ahriman.models.repository_id import RepositoryId
from ahriman.models.user import User
@@ -88,7 +89,7 @@ class Users(Handler):
"-p", "--password", help="user password. Blank password will be treated as empty password, "
"which is in particular must be used for OAuth2 authorization type.")
parser.add_argument("-R", "--role", help="user access level",
type=UserAccess, choices=tuple(UserAccess), default=UserAccess.Read)
type=UserAccess, choices=enum_values(UserAccess), default=UserAccess.Read)
parser.set_defaults(action=Action.Update, architecture="", exit_code=False, lock=None, quiet=True,
report=False, repository="")
return parser
@@ -109,7 +110,8 @@ class Users(Handler):
parser.add_argument("username", help="filter users by username", nargs="?")
parser.add_argument("-e", "--exit-code", help="return non-zero exit status if result is empty",
action="store_true")
parser.add_argument("-R", "--role", help="filter users by role", type=UserAccess, choices=tuple(UserAccess))
parser.add_argument("-R", "--role", help="filter users by role", type=UserAccess,
choices=enum_values(UserAccess))
parser.set_defaults(action=Action.List, architecture="", lock=None, quiet=True, report=False, repository="",
unsafe=True)
return parser
@@ -17,242 +17,355 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import itertools
import re
import shlex
import tree_sitter_bash
from collections.abc import Iterator
from enum import StrEnum
from tree_sitter import Language, Node, Parser
from typing import IO, cast
from typing import IO
from ahriman.core.exceptions import PkgbuildParserError
from ahriman.models.pkgbuild_patch import PkgbuildPatch
class PkgbuildNodeType(StrEnum):
class PkgbuildToken(StrEnum):
"""
tree-sitter node types used by parser
well-known tokens dictionary
Attributes:
Append(PkgbuildNodeType): append node
Array(PkgbuildNodeType): array node
Comment(PkgbuildNodeType): comment node
Concatenation(PkgbuildNodeType): concatenation node
Error(PkgbuildNodeType): syntax error node
FunctionDefinition(PkgbuildNodeType): function definition node
Number(PkgbuildNodeType): numeric word node
RawString(PkgbuildNodeType): single-quoted string node
String(PkgbuildNodeType): double-quoted string node
StringContent(PkgbuildNodeType): string content node
VariableAssignment(PkgbuildNodeType): assignment node
Word(PkgbuildNodeType): word node
ArrayEnds(PkgbuildToken): array ends token
ArrayStarts(PkgbuildToken): array starts token
Comma(PkgbuildToken): comma token
Comment(PkgbuildToken): comment token
FunctionDeclaration(PkgbuildToken): function declaration token
FunctionEnds(PkgbuildToken): function ends token
FunctionStarts(PkgbuildToken): function starts token
NewLine(PkgbuildToken): new line token
"""
Append = "+="
Array = "array"
Comment = "comment"
Concatenation = "concatenation"
Error = "ERROR"
FunctionDefinition = "function_definition"
Number = "number"
RawString = "raw_string"
String = "string"
StringContent = "string_content"
VariableAssignment = "variable_assignment"
Word = "word"
ArrayStarts = "("
ArrayEnds = ")"
Comma = ","
Comment = "#"
FunctionDeclaration = "()"
FunctionStarts = "{"
FunctionEnds = "}"
NewLine = "\n"
class PkgbuildNodeField(StrEnum):
class PkgbuildParser(shlex.shlex):
"""
tree-sitter node fields used by parser
simple pkgbuild reader implementation in pure python, because others suck.
Attributes:
Body(PkgbuildNodeField): function body field
Name(PkgbuildNodeField): variable or function name field
Value(PkgbuildNodeField): assignment value field
"""
What is it:
Body = "body"
Name = "name"
Value = "value"
class PkgbuildParser:
"""
PKGBUILD parser implementation in python
What it is:
#. A PKGBUILD parser based on tree-sitter's bash grammar.
#. A parser for assignments, arrays, and functions.
#. A parser which does not execute shell code.
#. Simple PKGBUILD parser written in python.
#. No shell execution, so it is free from random shell attacks.
#. Able to parse simple constructions (assignments, comments, functions, arrays).
What it is not:
#. A shell executor.
#. A shell interpreter. Variable and command substitutions are returned as written.
#. Fully functional shell parser.
#. Shell executor.
#. No parameter expansion.
Simple comma-separated brace expressions in array elements are expanded. Function bodies are returned from the
original source, with their formatting preserved. Assignments inside shell statements and control-flow nodes are
extracted without checking whether those statements would run.
For more details what does it support, please, consult with the test cases.
Examples:
Parse package assignments::
This class is heavily based on :mod:`shlex` parser, but instead of strings operates with the
:class:`ahriman.models.pkgbuild_patch.PkgbuildPatch` objects. The main way to use it is to call :func:`parse()`
function and collect parsed objects, e.g.::
>>> source = b"pkgname=example\\npkgver=1\\n"
>>> for patch in PkgbuildParser(BytesIO(source)).parse():
... print(patch.key, patch.value)
>>> parser = PkgbuildParser(StringIO("input string"))
>>> for patch in parser.parse():
>>> print(f"{patch.key} = {patch.value}")
Function bodies are returned as function patches::
>>> source = b"pkgver() { printf 1; }"
>>> for patch in list(PkgbuildParser(BytesIO(source)).parse())
... print(patch.key, patch.value)
It doesn't store the state of the fields (but operates with the :mod:`shlex` parser state), so no shell
post-processing is performed (e.g. variable substitution).
"""
_BRACE_EXPANSION = re.compile(r"(.*)\{([^{}]+)\}(.*)")
_ARRAY_ASSIGNMENT = re.compile(r"^(?P<key>\w+)=$")
# in addition to usual assignment, functions can have dash
_FUNCTION_DECLARATION = re.compile(r"^(?P<key>[\w-]+)$")
_STRING_ASSIGNMENT = re.compile(r"^(?P<key>\w+)=(?P<value>.+)$")
def __init__(self, stream: IO[bytes]) -> None:
""""""
self._content = stream.read()
def __init__(self, stream: IO[str]) -> None:
"""
Args:
stream(IO[str]): input stream containing PKGBUILD content
"""
shlex.shlex.__init__(self, stream, posix=True, punctuation_chars=True)
self._io = stream # direct access without type casting
# ignore substitution and extend bash symbols
self.wordchars += "${}#:+-@!"
# in case of default behavior, it will ignore, for example, segment part of url outside of quotes
self.commenters = ""
@staticmethod
def _expand_braces(value: str, *, expand: bool = True) -> list[str]:
def _expand_array(array: list[str]) -> list[str]:
"""
expand comma-separated brace expressions in a value
bash array expansion simulator. It takes raw array and tries to expand constructions like
``(first prefix-{mid1,mid2}-suffix last)`` into ``(first, prefix-mid1-suffix prefix-mid2-suffix last)``
Args:
value(str): value that may contain a brace expression
expand(bool, optional): whether brace expansion is allowed (Default value = True)
array(list[str]): input array
Returns:
list[str]: expanded values if applicable
list[str]: either source array or expanded array if possible
Raises:
PkgbuildParserError: if there are errors in parser
"""
match = PkgbuildParser._BRACE_EXPANSION.fullmatch(value)
# if there is no comma inside it should be treated as normal value
if match is None or not expand or "," not in match.group(2):
return [value]
# we are using comma as marker for expansion (if any)
if PkgbuildToken.Comma not in array:
return array
# again sanity check, for expansion there are at least 3 elements (first, last and comma)
if len(array) < 3:
return array
prefix, values, suffix = match.groups()
return [f"{prefix}{item}{suffix}" for item in values.split(",")]
result = []
buffer, prefix = [], None
@staticmethod
def _text(node: Node) -> str:
for index, (first, second) in enumerate(itertools.pairwise(array)):
match (first, second):
# in this case we check if expansion should be started
# this condition matches "prefix{first", ","
case (_, PkgbuildToken.Comma) if PkgbuildToken.FunctionStarts in first:
prefix, part = first.rsplit(PkgbuildToken.FunctionStarts, maxsplit=1)
buffer.append(f"{prefix}{part}")
# the last element case, it matches either ",", "last}" or ",", "last}suffix"
# in case if there is suffix, it must be appended to all list elements
case (PkgbuildToken.Comma, _) if prefix is not None and PkgbuildToken.FunctionEnds in second:
part, suffix = second.rsplit(PkgbuildToken.FunctionEnds, maxsplit=1)
buffer.append(f"{prefix}{part}")
result.extend([f"{part}{suffix}" for part in buffer])
# reset state
buffer, prefix = [], None
# we have already got prefix string, so we are in progress of expansion
# we always operate the last element, so this matches ",", "next"
case (PkgbuildToken.Comma, _) if prefix is not None:
buffer.append(f"{prefix}{second}")
# exactly first element of the list
case (_, _) if prefix is None and index == 0:
result.append(first)
# any next normal element
case (_, _) if prefix is None:
result.append(second)
# small sanity check
if prefix is not None:
raise PkgbuildParserError("error in array expansion", array)
return result
def _is_escaped(self) -> bool:
"""
read the original source text represented by a syntax tree node
Args:
node(Node): syntax tree node to read
check if the last element was quoted. ``shlex.shlex`` parser doesn't provide information about was the token
quoted or not, thus there is no difference between "'#'" (sharp in quotes) and "#" (sharp without quotes). This
method simply rolls back to the last non-space character and check if it is a quotation mark
Returns:
str: source text for the node
bool: ``True`` if the previous element of the stream is a quote or escaped and ``False`` otherwise
"""
return cast(bytes, node.text).decode("utf8", errors="backslashreplace")
current_position = self._io.tell()
def _assignment(self, node: Node) -> PkgbuildPatch:
last_char = penultimate_char = None
index = current_position - 1
while index > 0:
index, last_char = self._read_last(index)
if last_char.isspace():
index -= 1
continue
if index > 1:
_, penultimate_char = self._read_last(index - 1)
break
self._io.seek(current_position) # reset position of the stream
is_quoted = last_char is not None and last_char in self.quotes
is_escaped = penultimate_char is not None and penultimate_char in self.escape
return is_quoted or is_escaped
def _parse_array(self) -> list[str]:
"""
convert an assignment node
Args:
node(Node): assignment node to convert
parse array from the PKGBUILD. This method will extract tokens from parser until it matches closing array,
modifying source parser state
Returns:
PkgbuildPatch: parsed assignment
list[str]: extracted arrays elements
Raises:
PkgbuildParserError: if array is not closed
"""
name = cast(Node, node.child_by_field_name(PkgbuildNodeField.Name))
value = cast(Node, node.child_by_field_name(PkgbuildNodeField.Value))
key = self._text(name)
def extract() -> Iterator[str]:
while token := self.get_token():
match token:
case _ if self._is_escaped():
pass
case PkgbuildToken.ArrayEnds:
break
case comment if comment.startswith(PkgbuildToken.Comment):
self._read_comment()
continue
match value.type:
case PkgbuildNodeType.Array:
array_values = []
for element in filter(lambda child: child.type != PkgbuildNodeType.Comment, value.named_children):
item = self._value(element)
values = self._expand_braces(item, expand=element.type == PkgbuildNodeType.Concatenation)
array_values.extend(values)
return PkgbuildPatch(key, array_values)
yield token
case _:
return PkgbuildPatch(key, self._value(value))
if token != PkgbuildToken.ArrayEnds:
raise PkgbuildParserError("no closing array bracket found")
def _read(self, node: Node) -> Iterator[PkgbuildPatch]:
return self._expand_array(list(extract()))
def _parse_function(self) -> str:
"""
find assignments and functions in a syntax tree node
parse function from the PKGBUILD. This method will extract tokens from parser until it matches closing function,
modifying source parser state. Instead of trying to combine tokens together, it uses positions of the file
and reads content again in this range
Returns:
str: function body
Raises:
PkgbuildParserError: if function body wasn't found or parser input stream doesn't support position reading
"""
# find start and end positions
start_position = end_position = -1
counter = 0 # simple processing of the inner "{" and "}"
for token in self:
match token:
case _ if self._is_escaped():
continue
case PkgbuildToken.FunctionStarts:
if counter == 0:
start_position = self._io.tell() - 1
counter += 1
case PkgbuildToken.FunctionEnds:
end_position = self._io.tell()
if self.state != self.eof: # type: ignore[attr-defined]
end_position -= 1 # if we are not at the end of the file, position is _after_ the token
counter -= 1
if counter == 0:
break
case comment if comment.startswith(PkgbuildToken.Comment):
self._read_comment()
if not 0 < start_position < end_position:
raise PkgbuildParserError("function body wasn't found")
# read the specified interval from source stream
self._io.seek(start_position - 1) # start from the previous symbol
# we cannot use :func:`read()` here, because it reads characters, not bytes
content = ""
while self._io.tell() != end_position and (next_char := self._io.read(1)):
content += next_char
# special case of the end of file
if self.state == self.eof: # type: ignore[attr-defined]
content += self._io.read(1)
return content
def _parse_token(self, token: str) -> Iterator[PkgbuildPatch]:
"""
parse single token to the PKGBUILD field
Args:
node(Node): syntax tree node to inspect
token(str): current token
Yields:
PkgbuildPatch: parsed entries
PkgbuildPatch: extracted a PKGBUILD node
"""
match node.type:
case PkgbuildNodeType.VariableAssignment if not any(child.type == PkgbuildNodeType.Append for child in node.children):
yield self._assignment(node)
# simple assignment rule
if m := self._STRING_ASSIGNMENT.match(token):
key = m.group("key")
value = m.group("value")
yield PkgbuildPatch(key, value)
return
case PkgbuildNodeType.FunctionDefinition:
name = cast(Node, node.child_by_field_name(PkgbuildNodeField.Name))
body = cast(Node, node.child_by_field_name(PkgbuildNodeField.Body))
yield PkgbuildPatch(f"{self._text(name)}()", self._text(body))
if token.startswith(PkgbuildToken.Comment):
self._read_comment()
return
case _:
# descend into statements, but skip command arguments and values
for child in node.named_children:
if child.type not in (
PkgbuildNodeType.Array,
PkgbuildNodeType.Comment,
PkgbuildNodeType.RawString,
PkgbuildNodeType.String,
PkgbuildNodeType.Word,
):
yield from self._read(child)
match self.get_token():
# array processing. Arrays will be sent as "key=", "(", values, ")"
case PkgbuildToken.ArrayStarts if m := self._ARRAY_ASSIGNMENT.match(token):
key = m.group("key")
value = self._parse_array()
yield PkgbuildPatch(key, value)
def _value(self, node: Node) -> str:
# functions processing. Function will be sent as "name", "()", "{", body, "}"
case PkgbuildToken.FunctionDeclaration if self._FUNCTION_DECLARATION.match(token):
key = f"{token}{PkgbuildToken.FunctionDeclaration}"
value = self._parse_function()
yield PkgbuildPatch(key, value) # this is not mistake, assign to token without ()
# special function case, where "(" and ")" are separated tokens, e.g. "pkgver ( )"
case PkgbuildToken.ArrayStarts if self._FUNCTION_DECLARATION.match(token):
next_token = self.get_token()
if next_token == PkgbuildToken.ArrayEnds: # replace closing bracket with "()"
next_token = PkgbuildToken.FunctionDeclaration
self.push_token(next_token) # type: ignore[arg-type]
yield from self._parse_token(token)
# some random token received without continuation, lets guess it is empty assignment (i.e. key=)
case other if other is not None:
yield from self._parse_token(other)
def _read_comment(self) -> None:
"""
extract a string value from a syntax tree node
read comment from the current position. This method doesn't check comment itself, just read the stream
until the comment line ends
"""
_, last_symbol = self._read_last()
if last_symbol != PkgbuildToken.NewLine:
self.instream.readline()
def _read_last(self, initial_index: int | None = None) -> tuple[int, str]:
"""
wrapper around read to read the last symbol from the input stream. This method is designed to process UTF-8
symbols correctly. This method does not reset current stream position
Args:
node(Node): syntax tree node to extract
initial_index(int | None, optional): initial index to start reading from. If none set, the previous position
will be used (Default value = None)
Returns:
str: extracted string value
tuple[int, str]: last symbol and its position in the stream
Raises:
PkgbuildParserError: in case if stream reached starting position, but no valid symbols were found
"""
if node.type in (PkgbuildNodeType.Concatenation, PkgbuildNodeType.String):
return "".join(self._value(child) for child in node.named_children)
if initial_index is None:
initial_index = self._io.tell() - 1
if initial_index < 0:
raise PkgbuildParserError("stream is on starting position")
self._io.seek(initial_index)
value = self._text(node)
match node.type:
case PkgbuildNodeType.StringContent:
value = f'"{value}"'
case PkgbuildNodeType.Number | PkgbuildNodeType.RawString | PkgbuildNodeType.Word:
pass
case _:
return value
while (position := self._io.tell()) > 0:
try:
return position, self._io.read(1)
except UnicodeDecodeError:
self._io.seek(position - 1)
return "".join(shlex.split(value, comments=False, posix=True))
raise PkgbuildParserError("reached starting position, no valid symbols found")
def parse(self) -> Iterator[PkgbuildPatch]:
"""
parse source and yield extracted entries
parse source stream and yield parsed entries
Yields:
PkgbuildPatch: parsed entries
Raises:
PkgbuildParserError: source contains invalid shell syntax
PkgbuildPatch: extracted a PKGBUILD node
"""
def walk(node: Node) -> Iterator[Node]:
yield node
for child in node.children:
yield from walk(child)
parser = Parser(Language(tree_sitter_bash.language()))
tree = parser.parse(self._content)
if tree.root_node.has_error:
error = next((node for node in walk(tree.root_node) if node.is_error or node.is_missing), tree.root_node)
raise PkgbuildParserError(
f"syntax error at line {error.start_point.row + 1}, column {error.start_point.column + 1}"
)
yield from self._read(tree.root_node)
for token in self:
yield from self._parse_token(token)
@@ -22,7 +22,6 @@ from ahriman.core.configuration import Configuration
from ahriman.core.log import LazyLogging
from ahriman.core.utils import full_version, utcnow
from ahriman.models.package import Package
from ahriman.models.package_source import PackageSource
from ahriman.models.pkgbuild import Pkgbuild
@@ -56,7 +55,7 @@ class PackageVersion(LazyLogging):
_, repository_id = configuration.check_loaded()
paths = configuration.repository_paths
task = Task(self.package, configuration, repository_id, paths)
task = Task(self.package, configuration, repository_id.architecture, paths)
try:
# create fresh chroot environment, fetch sources and - automagically - update PKGBUILD
@@ -65,7 +64,7 @@ class PackageVersion(LazyLogging):
return full_version(pkgbuild.get("epoch"), pkgbuild["pkgver"], pkgbuild["pkgrel"])
except Exception:
self.logger.exception("cannot determine version of VCS package %s", self.package.base)
self.logger.exception("cannot determine version of VCS package")
finally:
# clear log files generated by devtools
for log_file in paths.cache_for(self.package.base).glob("*.log"):
@@ -104,14 +103,9 @@ class PackageVersion(LazyLogging):
Returns:
bool: ``True`` if the package is out-of-dated and ``False`` otherwise
"""
min_allowed_age = configuration.getint("build", "min_age", fallback=0)
min_build_date = utcnow().timestamp() - min_allowed_age
if remote.remote.source == PackageSource.AUR and PackageVersion(remote).is_newer_than(min_build_date):
self.logger.info("package %s was modified too recently, skip update", remote.base)
return False
vcs_allowed_age = configuration.getint("build", "vcs_allowed_age", fallback=0)
min_vcs_build_date = utcnow().timestamp() - vcs_allowed_age
if calculate_version and not self.is_newer_than(min_vcs_build_date):
remote_version = PackageVersion(remote).actual_version(configuration)
else:
@@ -165,7 +165,7 @@ class Sources(LazyLogging):
# extract local files...
files = ["PKGBUILD", ".SRCINFO"] + [str(path) for path in Pkgbuild.local_files(sources_dir)]
instance.add(sources_dir, *files, force=True)
instance.add(sources_dir, *files)
# ...and commit them
instance.commit(sources_dir)
@@ -232,7 +232,7 @@ class Sources(LazyLogging):
git_url, branch = remote.git_source()
check_output(*instance.git(), "push", "--quiet", git_url, branch, cwd=sources_dir, logger=instance.logger)
def add(self, sources_dir: Path, *pattern: str, intent_to_add: bool = False, force: bool = False) -> None:
def add(self, sources_dir: Path, *pattern: str, intent_to_add: bool = False) -> None:
"""
track found files via git
@@ -241,7 +241,6 @@ class Sources(LazyLogging):
*pattern(str): glob patterns
intent_to_add(bool, optional): record only the fact that it will be added later, acts as
--intent-to-add git flag (Default value = False)
force(bool, optional): allow adding ignored files (Default value = False)
"""
# glob directory to find files which match the specified patterns
found_files: list[Path] = []
@@ -252,8 +251,6 @@ class Sources(LazyLogging):
self.logger.info("found matching files %s", found_files)
# add them to index
args = ["--intent-to-add"] if intent_to_add else []
if force:
args.append("--force")
check_output(*self.git(), "add", *args, *[str(fn.relative_to(sources_dir)) for fn in found_files],
cwd=sources_dir, logger=self.logger)
@@ -27,7 +27,6 @@ from ahriman.core.log import LazyLogging
from ahriman.core.utils import check_output, package_like
from ahriman.models.package import Package
from ahriman.models.pkgbuild_patch import PkgbuildPatch
from ahriman.models.repository_id import RepositoryId
from ahriman.models.repository_paths import RepositoryPaths
@@ -37,40 +36,33 @@ class Task(LazyLogging):
Attributes:
archbuild_flags(list[str]): command flags for archbuild command
build_command(list[str]): build command
devtools_configs(Path): path to local directory with devtools configuration files
architecture(str): repository architecture
build_command(str): build command
include_debug_packages(bool): whether to include debug packages or not
make_flags(str): MAKEFLAGS variable for makepkg command
makechrootpkg_flags(list[str]): command flags for makechrootpkg command
makepkg_flags(list[str]): command flags for makepkg command
package(Package): package definitions
paths(RepositoryPaths): repository paths instance
repository_id(RepositoryId): repository unique identifier
uid(int): uid of the repository owner user
"""
def __init__(self, package: Package, configuration: Configuration, repository_id: RepositoryId,
def __init__(self, package: Package, configuration: Configuration, architecture: str,
paths: RepositoryPaths) -> None:
"""
Args:
package(Package): package definitions
configuration(Configuration): configuration instance
repository_id(RepositoryId): repository unique identifier
architecture(str): repository architecture
paths(RepositoryPaths): repository paths instance
"""
self.package = package
self.paths = paths
self.uid, _ = paths.root_owner
self.repository_id = repository_id
self.architecture = architecture
self.archbuild_flags = configuration.getlist("build", "archbuild_flags", fallback=[])
self.build_command = configuration.getlist("build", "devtools_wrapper")
self.devtools_configs = configuration.getpath("build", "devtools_configs")
self._legacy_build_command = configuration.getlist("build", "build_command", fallback=[])
self.build_command = configuration.get("build", "build_command")
self.include_debug_packages = configuration.getboolean("build", "include_debug_packages", fallback=True)
# even though this option is declared as list, there is no need to read it as list,
# because it will be converted back to the string anyway
self.make_flags = configuration.get("build", "make_flags", fallback=None)
self.makepkg_flags = configuration.getlist("build", "makepkg_flags", fallback=[])
self.makechrootpkg_flags = configuration.getlist("build", "makechrootpkg_flags", fallback=[])
@@ -116,21 +108,12 @@ class Task(LazyLogging):
Returns:
list[Path]: paths of produced packages
"""
command = self._legacy_build_command[:]
if not command:
command = self.build_command + [
"-r", self.repository_id.name,
"-a", self.repository_id.architecture,
"-c", str(self.devtools_configs),
"--",
]
command.extend(["-r", str(self.paths.chroot)] + self.archbuild_flags) # archbuild flags
command.extend(["--", "-D", str(self.paths.archive)] + self.makechrootpkg_flags) # makechrootpkg flags
command.extend(["--"] + self.makepkg_flags) # makepkg flags
command = [self.build_command, "-r", str(self.paths.chroot)]
command.extend(self.archbuild_flags)
command.extend(["--", "-D", str(self.paths.archive)] + self.makechrootpkg_flags)
command.extend(["--"] + self.makepkg_flags)
if dry_run:
command.extend(["--nobuild"])
self.logger.info("using %s for %s", command, self.package.base)
environment: dict[str, str] = {
@@ -138,8 +121,6 @@ class Task(LazyLogging):
for key, value in kwargs.items()
if value is not None
}
if self.make_flags is not None:
environment["MAKEFLAGS"] = self.make_flags
self.logger.info("using environment variables %s", environment)
source_files = list(sources_dir.iterdir())
@@ -175,7 +156,7 @@ class Task(LazyLogging):
return last_commit_sha
# load fresh package
loaded_package = Package.from_build(sources_dir, self.repository_id.architecture, None)
loaded_package = Package.from_build(sources_dir, self.architecture, None)
if (pkgrel := loaded_package.next_pkgrel(local_version)) is not None:
self.logger.info("package %s is the same as in repo, bumping pkgrel to %s", self.package.base, pkgrel)
patch = PkgbuildPatch("pkgrel", pkgrel)
@@ -109,14 +109,14 @@ class Configuration(configparser.RawConfigParser):
return repository_id.architecture
@property
def include(self) -> list[Path]:
def include(self) -> Path:
"""
get full path to include directory
Returns:
list[Path]: paths to directories with configuration includes
Path: path to directory with configuration includes
"""
return self.getpathlist("settings", "include")
return self.getpath("settings", "include")
@property
def logging_path(self) -> Path:
@@ -325,26 +325,25 @@ class Configuration(configparser.RawConfigParser):
section, key = name.rsplit(":", maxsplit=1)
self.set_option(section, key, value)
def load_includes(self) -> None:
def load_includes(self, path: Path | None = None) -> None:
"""
load configuration includes from specified path
Args:
path(Path | None, optional): path to directory with include files. If none set, the default path will be
used (Default value = None)
"""
self.includes = [] # reset state
try:
include_directories = self.include
except (configparser.NoOptionError, configparser.NoSectionError):
return
for path in include_directories: # pylint: disable=not-an-iterable
if not path.is_dir():
continue
path = path or self.include
for include in sorted(path.glob("*.ini")):
if include == self.logging_path:
continue # we don't want to load logging explicitly
self.read(include)
self.includes.append(include)
except (FileNotFoundError, configparser.NoOptionError, configparser.NoSectionError):
pass
def merge_sections(self, repository_id: RepositoryId) -> None:
"""
@@ -404,7 +403,6 @@ class Configuration(configparser.RawConfigParser):
# create another instance and copy values from there
instance = self.from_path(path, repository_id)
self.copy_from(instance)
self.includes = instance.includes
def set_option(self, section: str, option: str, value: str) -> None:
"""
@@ -40,13 +40,10 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
"required": True,
},
"include": {
"type": "list",
"coerce": "list",
"schema": {
"type": "path",
"coerce": "absolute_path",
"path_type": "dir",
},
"type": "path",
"coerce": "absolute_path",
"path_exists": True,
"path_type": "dir",
},
"logging": {
"type": "path",
@@ -193,27 +190,8 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
},
},
"build_command": {
"type": "list",
"coerce": "list",
"schema": {
"type": "string",
"empty": False,
},
},
"devtools_configs": {
"type": "path",
"coerce": "absolute_path",
"type": "string",
"required": True,
"path_exists": True,
"path_type": "dir",
},
"devtools_wrapper": {
"type": "list",
"coerce": "list",
"schema": {
"type": "string",
"empty": False,
},
"empty": False,
},
"ignore_packages": {
@@ -228,7 +206,7 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
"type": "boolean",
"coerce": "boolean",
},
"make_flags": {
"makepkg_flags": {
"type": "list",
"coerce": "list",
"schema": {
@@ -244,23 +222,6 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
"empty": False,
},
},
"makepkg_flags": {
"type": "list",
"coerce": "list",
"schema": {
"type": "string",
"empty": False,
},
},
"min_age": {
"type": "integer",
"coerce": "integer",
"min": 0,
},
"packager": {
"type": "string",
"empty": False,
},
"scan_paths": {
"type": "list",
"coerce": "list",
@@ -190,5 +190,5 @@ class Validator(RootValidator):
{"type": "string"}
"""
fn = getattr(value, f"is_{constraint}")
if value.exists() and not fn():
if not fn():
self._error(field, f"Path {value} must be type of {constraint}")
+6 -11
View File
@@ -83,15 +83,6 @@ Process stderr:
{self.stderr}"""
class DependencyResolutionError(RuntimeError):
"""
exception raised when package dependencies cannot be resolved
"""
def __init__(self, unprocessed: list[str]) -> None:
RuntimeError.__init__(self, f"Could not process dependencies. Unresolved packages: {unprocessed}")
class DuplicateRunError(RuntimeError):
"""
exception which will be raised if there is another application instance
@@ -238,12 +229,16 @@ class PkgbuildParserError(ValueError):
exception raises in case of PKGBUILD parser errors
"""
def __init__(self, reason: str) -> None:
def __init__(self, reason: str, source: Any = None) -> None:
"""
Args:
reason(str): parser error reason
source(Any, optional): source line if available (Default value = None)
"""
ValueError.__init__(self, f"Could not parse PKGBUILD: {reason}")
message = f"Could not parse PKGBUILD: {reason}"
if source is not None:
message += f", source: `{source}`"
ValueError.__init__(self, message)
class PasswordError(ValueError):
@@ -87,12 +87,7 @@ class ArchiveRotationTrigger(Trigger):
if self.keep_built_packages == 0:
return
current = next(iter(repository.packages([package.base])), None)
to_remove = [
single
for single in repository.package_archives(package.base)
if current is None or single.version != current.version
]
to_remove = repository.package_archives(package.base)
for single in to_remove[:-self.keep_built_packages]:
self.logger.info("removing version %s of package %s", single.version, single.base)
@@ -21,8 +21,6 @@
from logging import NullHandler
from typing import Any
from ahriman.core.module_loader import optional_module
__all__ = ["JournalHandler"]
@@ -42,5 +40,7 @@ class _JournalHandler(NullHandler):
del args, kwargs
systemd_journal = optional_module("systemd.journal")
JournalHandler = systemd_journal.JournalHandler if systemd_journal else _JournalHandler
try:
from systemd.journal import JournalHandler # type: ignore[import-untyped]
except ImportError:
JournalHandler = _JournalHandler
@@ -26,7 +26,6 @@ from typing import ClassVar, Literal
from ahriman.core.configuration import Configuration
from ahriman.core.log.http_log_handler import HttpLogHandler
from ahriman.core.log.log_context import LogContext
from ahriman.core.module_loader import optional_module
from ahriman.models.log_handler import LogHandler
from ahriman.models.repository_id import RepositoryId
@@ -66,11 +65,14 @@ class LogLoader:
if selected is not None:
return selected
if optional_module("systemd.journal"):
try:
from systemd.journal import JournalHandler # type: ignore[import-untyped]
del JournalHandler
return LogHandler.Journald # journald import was found
if LogLoader.DEFAULT_SYSLOG_DEVICE.exists():
return LogHandler.Syslog
return LogHandler.Console
except ImportError:
if LogLoader.DEFAULT_SYSLOG_DEVICE.exists():
return LogHandler.Syslog
return LogHandler.Console
@staticmethod
def load(repository_id: RepositoryId, configuration: Configuration, handler: LogHandler, *,
+2 -17
View File
@@ -26,7 +26,8 @@ from pkgutil import ModuleInfo, walk_packages
from types import ModuleType
from typing import Any, TypeGuard, TypeVar
__all__ = ["implementations", "optional_module"]
__all__ = ["implementations"]
T = TypeVar("T")
@@ -73,19 +74,3 @@ def implementations(root_module: ModuleType, base_class: type[T]) -> Iterator[ty
for _, attribute in inspect.getmembers(module, is_base_class):
yield attribute
def optional_module(module_name: str) -> ModuleType | None:
"""
import an optional module
Args:
module_name(str): fully qualified module name
Returns:
ModuleType | None: imported module or ``None`` when it cannot be imported
"""
try:
return import_module(module_name)
except ImportError:
return None
@@ -73,8 +73,7 @@ class Executor(PackageInfo, Cleaner):
"""
self.reporter.set_building(package.base)
default_packager = self.configuration.get("build", "packager", fallback=None)
task = Task(package, self.configuration, self.repository_id, self.paths)
task = Task(package, self.configuration, self.repository_id.architecture, self.paths)
patches = self.reporter.package_patches_get(package.base, None)
commit_sha = task.init(path, patches, local_version)
@@ -87,7 +86,7 @@ class Executor(PackageInfo, Cleaner):
shutil.copy(artifact, path)
built.append(path / artifact.name)
else:
built = task.build(path, PACKAGER=packager or default_packager)
built = task.build(path, PACKAGER=packager)
package.with_packages(built)
for src in built:
@@ -36,17 +36,6 @@ class UpdateHandler(PackageInfo, Cleaner):
trait to get package update list
"""
def _updates_ignored(self) -> set[str]:
"""
collect package bases excluded from automatic updates
Returns:
set[str]: held and configured ignored package bases
"""
return set(self._ignore_list) | {
package.base for package, status in self.reporter.package_get(None) if status.is_held
}
def updates_aur(self, filter_packages: Iterable[str], *, vcs: bool) -> list[Package]:
"""
check AUR for updates
@@ -69,7 +58,9 @@ class UpdateHandler(PackageInfo, Cleaner):
continue
raise UnknownPackageError(package.base)
ignore_list = self._updates_ignored()
ignore_list = self._ignore_list + [
package.base for package, status in self.reporter.package_get(None) if status.is_held
]
result: list[Package] = []
for local in self.packages(filter_packages):
@@ -115,13 +106,8 @@ class UpdateHandler(PackageInfo, Cleaner):
return files
ignore_list = self._updates_ignored()
result: list[Package] = []
for local in self.packages(filter_packages):
if local.base in ignore_list:
self.logger.info("package %s is held, skip update check", local.base)
continue
dependencies = self.reporter.package_dependencies_get(local.base)
if not dependencies.paths:
continue # skip check if no package dependencies found
@@ -155,13 +141,9 @@ class UpdateHandler(PackageInfo, Cleaner):
"""
packages = {local.base: local for local in self.packages()}
local_versions = {package_base: package.version for package_base, package in packages.items()}
ignore_list = self._updates_ignored()
result: list[Package] = []
for cache_dir in self.paths.cache.iterdir():
if cache_dir.name in ignore_list:
self.logger.info("package %s is held, skip update check", cache_dir.name)
continue
with self.in_package_context(cache_dir.name, local_versions.get(cache_dir.name)):
try:
source = RemoteSource(
@@ -180,9 +162,6 @@ class UpdateHandler(PackageInfo, Cleaner):
continue # we don't add packages automatically
if local.remote.is_remote:
continue # avoid checking AUR packages
if local.base in ignore_list:
self.logger.info("package %s is held, skip update check", local.base)
continue
if PackageVersion(local).is_outdated(remote, self.configuration, calculate_version=vcs):
self.reporter.set_pending(local.base)
@@ -212,6 +191,7 @@ class UpdateHandler(PackageInfo, Cleaner):
self.reporter.set_pending(local.base)
self.event(local.base, EventType.PackageOutdated, "Manual update is requested")
self.clear_queue()
except Exception:
self.logger.exception("could not load packages from database")
+1 -6
View File
@@ -22,7 +22,7 @@ from __future__ import annotations
from collections.abc import Iterable
from functools import partial
from ahriman.core.exceptions import DependencyResolutionError, PartitionError
from ahriman.core.exceptions import PartitionError
from ahriman.core.utils import minmax, partition
from ahriman.models.package import Package
@@ -226,9 +226,6 @@ class Tree:
Returns:
list[list[Package]]: sorted list of packages lists based on their dependencies
Raises:
DependencyResolutionError: dependency cycle prevents ordering packages
"""
unsorted: list[list[Leaf]] = []
@@ -238,8 +235,6 @@ class Tree:
# additional workaround with partial in order to hide cell-var-from-loop pylint warning
predicate = partial(Leaf.is_root, packages=unprocessed)
new_level, unprocessed = partition(unprocessed, predicate)
if not new_level:
raise DependencyResolutionError([leaf.package.base for leaf in unprocessed])
unsorted.append(new_level)
# move leaves to the end if they are not required at the next level
+15
View File
@@ -31,6 +31,7 @@ import subprocess
from collections.abc import Callable, Iterable, Iterator, Mapping
from dataclasses import asdict
from enum import Enum
from filelock import FileLock
from pathlib import Path
from pwd import getpwuid
@@ -45,6 +46,7 @@ __all__ = [
"check_output",
"check_user",
"dataclass_view",
"enum_values",
"extract_user",
"filelock",
"filter_json",
@@ -240,6 +242,19 @@ def dataclass_view(instance: Any) -> dict[str, Any]:
return asdict(instance, dict_factory=lambda fields: {key: value for key, value in fields if value is not None})
def enum_values(enum: type[Enum]) -> list[str]:
"""
generate list of enumeration values from the source
Args:
enum(type[Enum]): source enumeration class
Returns:
list[str]: available enumeration values as string
"""
return [str(key.value) for key in enum] # explicit str conversion for typing
def extract_user() -> str | None:
"""
extract user from system environment
@@ -113,7 +113,6 @@ class PackageDescription:
Self: package properties based on source AUR package
"""
return cls(
build_date=int(package.last_modified.timestamp()),
depends=package.depends,
make_depends=package.make_depends,
opt_depends=package.opt_depends,
+25 -11
View File
@@ -19,12 +19,12 @@
#
from collections.abc import Iterator, Mapping
from dataclasses import dataclass
from io import BytesIO
from io import StringIO
from pathlib import Path
from typing import Any, IO, Self
from typing import Any, ClassVar, IO, Self
from urllib.parse import urlparse
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser, PkgbuildToken
from ahriman.core.utils import srcinfo_property_list
from ahriman.models.pkgbuild_patch import PkgbuildPatch
@@ -35,11 +35,14 @@ class Pkgbuild(Mapping[str, Any]):
model and proxy for PKGBUILD properties
Attributes:
DEFAULT_ENCODINGS(str): (class attribute) default encoding to be applied on the file content
fields(dict[str, PkgbuildPatch]): PKGBUILD fields
"""
fields: dict[str, PkgbuildPatch]
DEFAULT_ENCODINGS: ClassVar[str] = "utf8"
@property
def variables(self) -> dict[str, str]:
"""
@@ -56,26 +59,37 @@ class Pkgbuild(Mapping[str, Any]):
}
@classmethod
def from_file(cls, path: Path) -> Self:
def from_file(cls, path: Path, encoding: str | None = None) -> Self:
"""
parse PKGBUILD from the file
Args:
path(Path): path to the PKGBUILD file
encoding(str | None, optional): the encoding of the file (Default value = None)
Returns:
Self: constructed instance of self
Raises:
EncodeError: if encoding is unknown
"""
# read raw bytes from file
with path.open("rb") as input_file:
return cls.from_io(input_file)
content = input_file.read()
# decode bytes content based on either
encoding = encoding or cls.DEFAULT_ENCODINGS
io = StringIO(content.decode(encoding, errors="backslashreplace"))
return cls.from_io(io)
@classmethod
def from_io(cls, stream: IO[bytes]) -> Self:
def from_io(cls, stream: IO[str]) -> Self:
"""
parse PKGBUILD from input stream
Args:
stream(IO[bytes]): input stream containing PKGBUILD content
stream(IO[str]): input stream containing PKGBUILD content
Returns:
Self: constructed instance of self
@@ -148,10 +162,10 @@ class Pkgbuild(Mapping[str, Any]):
"""
packages = [self["pkgname"]] if isinstance(self["pkgname"], str) else self["pkgname"]
def io(package_name: str) -> IO[bytes]:
def io(package_name: str) -> IO[str]:
# try to read package specific function and fallback to default otherwise
content = self.get(f"package_{package_name}") or self.get("package") or ""
return BytesIO(content.encode("utf8"))
return StringIO(content)
return {package: self.from_io(io(package)) for package in packages}
@@ -171,8 +185,8 @@ class Pkgbuild(Mapping[str, Any]):
"""
value = self.fields.get(item)
# if the key wasn't found and user didn't ask for function explicitly, we can try to get by function name
if value is None and not item.endswith("()"):
value = self.fields.get(f"{item}()")
if value is None and not item.endswith(PkgbuildToken.FunctionDeclaration):
value = self.fields.get(f"{item}{PkgbuildToken.FunctionDeclaration}")
# if we still didn't find anything, we can just raise the exception
if value is None:
@@ -103,7 +103,7 @@ class RepositoryPaths(LazyLogging):
Returns:
Path: path to directory in which build process is run
"""
uid, _ = self.root_owner
uid, _ = owner(self.root)
return self.chroot / f"{self.repository_id.name}-{self.repository_id.architecture}" / getpwuid(uid).pw_name
@property
@@ -127,16 +127,6 @@ class RepositoryPaths(LazyLogging):
# for the chroot directory devtools will create own tree, and we don't have to specify architecture here
return self.root / "chroot" / self.repository_id.name
@property
def configs(self) -> Path:
"""
get directory for local configuration files
Returns:
Path: full path to local configuration directory
"""
return self.root / ".config" / "ahriman"
@property
def packages(self) -> Path:
"""
@@ -333,7 +323,6 @@ class RepositoryPaths(LazyLogging):
self.archive,
self.cache,
self.chroot,
self.configs,
self.packages,
self.pacman,
self.repository,
@@ -188,7 +188,6 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
"""
must process package updates
"""
application_repository.database.build_queue_insert(package_ahriman)
paths = [package.filepath for package in package_ahriman.packages.values()]
tree = Tree([Leaf(package_ahriman)])
prebuilt_result = Result()
@@ -208,15 +207,12 @@ def test_update(application_repository: ApplicationRepository, package_ahriman:
update_mock.assert_called_once_with(paths, Packagers("username"))
on_result_mock.assert_has_calls([MockCall(prebuilt_result), MockCall(result)])
assert application_repository.database.build_queue_get() == []
def test_update_prebuilt_filter(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
mocker: MockerFixture) -> None:
"""
must filter out packages which were successfully prebuilt
"""
application_repository.database.build_queue_insert(package_ahriman)
paths = [package.filepath for package in package_ahriman.packages.values()]
resolve_mock = mocker.patch("ahriman.application.application.workers.local_updater.LocalUpdater.partition",
@@ -228,8 +224,6 @@ def test_update_prebuilt_filter(application_repository: ApplicationRepository, p
application_repository.update([package_ahriman], Packagers("username"), bump_pkgrel=True)
resolve_mock.assert_called_once_with([])
assert application_repository.database.build_queue_get() == []
def test_update_empty(application_repository: ApplicationRepository, package_ahriman: Package, result: Result,
mocker: MockerFixture) -> None:
@@ -3,6 +3,7 @@ import pytest
from pytest_mock import MockerFixture
from ahriman.application.ahriman import _parser
from ahriman.application.application import Application
from ahriman.application.help_formatter import _HelpFormatter
from ahriman.application.lock import Lock
@@ -32,6 +33,18 @@ def application(configuration: Configuration, repository: Repository, database:
return Application(repository_id, configuration, report=False)
@pytest.fixture
def args() -> argparse.Namespace:
"""
fixture for command line arguments
Returns:
argparse.Namespace: command line arguments test instance
"""
return argparse.Namespace(architecture=None, lock=None, force=False, unsafe=False, report=False,
repository=None, repository_id=None, wait_timeout=-1)
@pytest.fixture
def formatter() -> _HelpFormatter:
"""
@@ -57,3 +70,14 @@ def lock(args: argparse.Namespace, configuration: Configuration) -> Lock:
"""
_, repository_id = configuration.check_loaded()
return Lock(args, repository_id, configuration)
@pytest.fixture
def parser() -> argparse.ArgumentParser:
"""
fixture for command line arguments parser
Returns:
argparse.ArgumentParser: command line arguments parser test instance
"""
return _parser()
@@ -1,6 +1,4 @@
import argparse
import multiprocessing
import os
import pytest
from pathlib import Path
@@ -12,8 +10,9 @@ from urllib.parse import quote_plus as url_encode
from ahriman.application.handlers.setup import Setup
from ahriman.core.configuration import Configuration
from ahriman.core.database import SQLite
from ahriman.core.exceptions import InitializeError, MissingArchitectureError
from ahriman.core.exceptions import MissingArchitectureError
from ahriman.core.repository import Repository
from ahriman.models.repository_id import RepositoryId
from ahriman.models.repository_paths import RepositoryPaths
from ahriman.models.sign_settings import SignSettings
@@ -51,29 +50,25 @@ def test_run(args: argparse.Namespace, configuration: Configuration, repository:
must run command
"""
args = _default_args(args)
local = Path("local")
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
mkdir_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_directory",
return_value=local)
ahriman_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_ahriman")
devtools_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_devtools")
makepkg_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_makepkg")
sudo_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_sudo")
executable_mock = mocker.patch("ahriman.application.handlers.setup.Setup.executable_create")
init_mock = mocker.patch("ahriman.core.alpm.repo.Repo.init")
owner_guard_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.preserve_owner")
_, repository_id = configuration.check_loaded()
Setup.run(args, repository_id, configuration, report=False)
owner_guard_mock.assert_called_once_with()
mkdir_mock.assert_called_once_with(configuration)
ahriman_configuration_mock.assert_called_once_with(args, repository_id, configuration, local)
ahriman_configuration_mock.assert_called_once_with(args, repository_id, configuration)
devtools_configuration_mock.assert_called_once_with(
repository_id,
args.from_configuration,
configuration.getpath("build", "devtools_configs"),
args.mirror,
args.multilib,
f"file://{repository_paths.repository}",
)
repository_id, args.from_configuration, args.mirror, args.multilib, f"file://{repository_paths.repository}")
makepkg_configuration_mock.assert_called_once_with(args.packager, args.makeflags_jobs, repository_paths)
sudo_configuration_mock.assert_called_once_with(repository_paths, repository_id)
executable_mock.assert_called_once_with(repository_paths, repository_id)
init_mock.assert_called_once_with()
@@ -106,23 +101,31 @@ def test_run_with_server(args: argparse.Namespace, configuration: Configuration,
mocker.patch("ahriman.core.database.SQLite.load", return_value=database)
mocker.patch("ahriman.core.repository.Repository.load", return_value=repository)
mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_ahriman")
mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_makepkg")
mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_sudo")
mocker.patch("ahriman.application.handlers.setup.Setup.executable_create")
mocker.patch("ahriman.core.alpm.repo.Repo.init")
devtools_configuration_mock = mocker.patch("ahriman.application.handlers.setup.Setup.configuration_create_devtools")
_, repository_id = configuration.check_loaded()
Setup.run(args, repository_id, configuration, report=False)
devtools_configuration_mock.assert_called_once_with(
repository_id,
args.from_configuration,
configuration.getpath("build", "devtools_configs"),
args.mirror,
args.multilib,
"server",
)
repository_id, args.from_configuration, args.mirror, args.multilib, "server")
def test_configuration_create_ahriman(args: argparse.Namespace, configuration: Configuration, tmp_path: Path,
mocker: MockerFixture) -> None:
def test_build_command(repository_id: RepositoryId) -> None:
"""
must generate correct build command name
"""
path = Path("local")
build_command = Setup.build_command(path, repository_id)
assert build_command.name == f"{repository_id.name}-{repository_id.architecture}-build"
assert build_command.parent == path
def test_configuration_create_ahriman(args: argparse.Namespace, configuration: Configuration,
repository_paths: RepositoryPaths, mocker: MockerFixture) -> None:
"""
must create configuration for the service
"""
@@ -130,23 +133,23 @@ def test_configuration_create_ahriman(args: argparse.Namespace, configuration: C
mocker.patch("pathlib.Path.open")
set_option_mock = mocker.patch("ahriman.core.configuration.Configuration.set_option")
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
remove_mock = mocker.patch("pathlib.Path.unlink", autospec=True)
_, repository_id = configuration.check_loaded()
command = Setup.build_command(repository_paths.root, repository_id)
Setup.configuration_create_ahriman(args, repository_id, configuration, tmp_path)
Setup.configuration_create_ahriman(args, repository_id, configuration)
set_option_mock.assert_has_calls([
MockCall(Configuration.section_name("build", repository_id.name, repository_id.architecture), "build_command",
str(command)),
MockCall("repository", "name", repository_id.name),
MockCall(Configuration.section_name("build", repository_id.name, repository_id.architecture),
"packager", args.packager),
MockCall(Configuration.section_name("build", repository_id.name, repository_id.architecture),
"make_flags", f"-j{multiprocessing.cpu_count()}"),
MockCall(Configuration.section_name("build", repository_id.name, repository_id.architecture),
"makechrootpkg_flags", f"-U {args.build_as_user}"),
MockCall(Configuration.section_name("alpm", repository_id.name, repository_id.architecture),
"mirror", args.mirror),
MockCall(Configuration.section_name("sign", repository_id.name, repository_id.architecture),
"target", " ".join([target.name.lower() for target in args.sign_target])),
MockCall(Configuration.section_name("sign", repository_id.name, repository_id.architecture),
"key", args.sign_key),
MockCall(Configuration.section_name(
"alpm", repository_id.name, repository_id.architecture), "mirror", args.mirror),
MockCall(Configuration.section_name("sign", repository_id.name, repository_id.architecture), "target",
" ".join([target.name.lower() for target in args.sign_target])),
MockCall(Configuration.section_name("sign", repository_id.name, repository_id.architecture), "key",
args.sign_key),
MockCall("web", "port", str(args.web_port)),
MockCall("status", "address", f"http://127.0.0.1:{str(args.web_port)}"),
MockCall("web", "unix_socket", str(args.web_unix_socket)),
@@ -154,10 +157,11 @@ def test_configuration_create_ahriman(args: argparse.Namespace, configuration: C
MockCall("auth", "salt", pytest.helpers.anyvar(str, strict=True)),
])
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
remove_mock.assert_called_once_with(configuration.include / "00-setup-overrides.ini", missing_ok=True)
def test_configuration_create_ahriman_no_multilib(args: argparse.Namespace, configuration: Configuration,
tmp_path: Path, mocker: MockerFixture) -> None:
mocker: MockerFixture) -> None:
"""
must create configuration for the service without multilib repository
"""
@@ -168,14 +172,14 @@ def test_configuration_create_ahriman_no_multilib(args: argparse.Namespace, conf
set_option_mock = mocker.patch("ahriman.core.configuration.Configuration.set_option")
_, repository_id = configuration.check_loaded()
Setup.configuration_create_ahriman(args, repository_id, configuration, tmp_path)
Setup.configuration_create_ahriman(args, repository_id, configuration)
set_option_mock.assert_has_calls([
MockCall(Configuration.section_name("alpm", repository_id.name, repository_id.architecture), "mirror",
args.mirror),
]) # non-strict check called intentionally
def test_configuration_create_devtools(args: argparse.Namespace, configuration: Configuration, tmp_path: Path,
def test_configuration_create_devtools(args: argparse.Namespace, configuration: Configuration,
mocker: MockerFixture) -> None:
"""
must create configuration for the devtools
@@ -187,12 +191,12 @@ def test_configuration_create_devtools(args: argparse.Namespace, configuration:
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
_, repository_id = configuration.check_loaded()
Setup.configuration_create_devtools(repository_id, args.from_configuration, tmp_path, None, args.multilib, "server")
Setup.configuration_create_devtools(repository_id, args.from_configuration, None, args.multilib, "server")
add_section_mock.assert_has_calls([MockCall("multilib"), MockCall(repository_id.name)])
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
def test_configuration_create_devtools_mirror(args: argparse.Namespace, configuration: Configuration, tmp_path: Path,
def test_configuration_create_devtools_mirror(args: argparse.Namespace, configuration: Configuration,
mocker: MockerFixture) -> None:
"""
must create configuration for the devtools with mirror set explicitly
@@ -212,21 +216,14 @@ def test_configuration_create_devtools_mirror(args: argparse.Namespace, configur
set_option_mock = mocker.patch("ahriman.core.configuration.Configuration.set_option")
_, repository_id = configuration.check_loaded()
Setup.configuration_create_devtools(
repository_id,
args.from_configuration,
tmp_path,
args.mirror,
args.multilib,
"server",
)
Setup.configuration_create_devtools(repository_id, args.from_configuration, args.mirror, args.multilib, "server")
get_mock.assert_has_calls([MockCall("core", "Include", fallback=None), MockCall("extra", "Include", fallback=None)])
remove_option_mock.assert_called_once_with("core", "Include")
set_option_mock.assert_has_calls([MockCall("core", "Server", args.mirror)]) # non-strict check called intentionally
def test_configuration_create_devtools_no_multilib(args: argparse.Namespace, configuration: Configuration,
tmp_path: Path, mocker: MockerFixture) -> None:
mocker: MockerFixture) -> None:
"""
must create configuration for the devtools without multilib
"""
@@ -236,31 +233,50 @@ def test_configuration_create_devtools_no_multilib(args: argparse.Namespace, con
write_mock = mocker.patch("ahriman.core.configuration.Configuration.write")
_, repository_id = configuration.check_loaded()
Setup.configuration_create_devtools(repository_id, args.from_configuration, tmp_path, args.mirror, False, "server")
Setup.configuration_create_devtools(repository_id, args.from_configuration, args.mirror, False, "server")
write_mock.assert_called_once_with(pytest.helpers.anyvar(int))
def test_configuration_create_directory(configuration: Configuration, mocker: MockerFixture) -> None:
def test_configuration_create_makepkg(args: argparse.Namespace, repository_paths: RepositoryPaths,
passwd: Any, mocker: MockerFixture) -> None:
"""
must create writable directory for includes
must create makepkg configuration
"""
configuration.set_option("settings", "include", f"/path1 /path2 /path3")
mkdir_mock = mocker.patch("ahriman.models.repository_paths.RepositoryPaths.ensure_exists",
side_effect=[OSError, "/path2", "/path3"])
access_mock = mocker.patch("os.access", side_effect=[False, True])
args = _default_args(args)
mocker.patch("ahriman.application.handlers.setup.getpwuid", return_value=passwd)
write_text_mock = mocker.patch("pathlib.Path.write_text", autospec=True)
assert Setup.configuration_create_directory(configuration) == "/path3"
mkdir_mock.assert_has_calls([MockCall(Path("/path1")), MockCall(Path("/path2")), MockCall(Path("/path3"))])
access_mock.assert_has_calls([MockCall("/path2", os.W_OK | os.X_OK), MockCall("/path3", os.W_OK | os.X_OK)])
Setup.configuration_create_makepkg(args.packager, args.makeflags_jobs, repository_paths)
write_text_mock.assert_called_once_with(
Path("home") / ".makepkg.conf", pytest.helpers.anyvar(str, True), encoding="utf8")
def test_configuration_create_directory_no_writable(configuration: Configuration, mocker: MockerFixture) -> None:
def test_configuration_create_sudo(configuration: Configuration, repository_paths: RepositoryPaths,
mocker: MockerFixture) -> None:
"""
must raise InitializeError if no writable directories found
must create sudo configuration
"""
mocker.patch("ahriman.models.repository_paths.RepositoryPaths.ensure_exists", side_effect=OSError)
with pytest.raises(InitializeError):
Setup.configuration_create_directory(configuration)
chmod_text_mock = mocker.patch("pathlib.Path.chmod")
write_text_mock = mocker.patch("pathlib.Path.write_text")
_, repository_id = configuration.check_loaded()
Setup.configuration_create_sudo(repository_paths, repository_id)
chmod_text_mock.assert_called_once_with(0o400)
write_text_mock.assert_called_once_with(pytest.helpers.anyvar(str, True), encoding="utf8")
def test_executable_create(configuration: Configuration, repository_paths: RepositoryPaths,
mocker: MockerFixture) -> None:
"""
must create executable
"""
symlink_mock = mocker.patch("pathlib.Path.symlink_to")
unlink_mock = mocker.patch("pathlib.Path.unlink")
_, repository_id = configuration.check_loaded()
Setup.executable_create(repository_paths, repository_id)
symlink_mock.assert_called_once_with(Setup.ARCHBUILD_COMMAND_PATH)
unlink_mock.assert_called_once_with(missing_ok=True)
def test_disallow_multi_architecture_run() -> None:
@@ -63,7 +63,7 @@ def test_run_default(args: argparse.Namespace, configuration: Configuration) ->
default = Configuration.from_path(Configuration.SYSTEM_CONFIGURATION_PATH, repository_id)
# copy autogenerated values
for section, key in (("repository", "root"), ("build", "devtools_configs")):
for section, key in (("build", "build_command"), ("repository", "root")):
value = configuration.get(section, key)
default.set_option(section, key, value)
@@ -1488,7 +1488,7 @@ def test_subparsers_service_run_option_repository(parser: argparse.ArgumentParse
def test_subparsers_service_setup(parser: argparse.ArgumentParser) -> None:
"""
service-setup command must imply lock, quiet and report
service-setup command must imply lock, quiet, report and unsafe
"""
args = parser.parse_args(["-a", "x86_64", "-r", "repo", "service-setup",
"--packager", "ahriman bot <ahriman@example.com>"])
@@ -1497,6 +1497,7 @@ def test_subparsers_service_setup(parser: argparse.ArgumentParser) -> None:
assert args.quiet
assert not args.report
assert args.repository == "repo"
assert args.unsafe
def test_subparsers_service_setup_option_from_configuration(parser: argparse.ArgumentParser) -> None:
@@ -1,56 +1,71 @@
import pytest
from io import StringIO
from pathlib import Path
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser
from ahriman.core.exceptions import PkgbuildParserError
from ahriman.models.pkgbuild_patch import PkgbuildPatch
from io import BytesIO
from pathlib import Path
def test_expand_array() -> None:
"""
must correctly expand array
"""
assert PkgbuildParser._expand_array(["${pkgbase}{", ",", "-libs", ",", "-fortran}"]) == [
"${pkgbase}", "${pkgbase}-libs", "${pkgbase}-fortran"
]
assert PkgbuildParser._expand_array(["first", "prefix{1", ",", "2", ",", "3}suffix", "last"]) == [
"first", "prefix1suffix", "prefix2suffix", "prefix3suffix", "last"
]
def test_expand_array_no_comma() -> None:
"""
must skip array extraction if there is no comma
"""
assert PkgbuildParser._expand_array(["${pkgbase}{", "-libs", "-fortran}"]) == ["${pkgbase}{", "-libs", "-fortran}"]
def test_expand_array_short() -> None:
"""
must skip array extraction if it is short
"""
assert PkgbuildParser._expand_array(["${pkgbase}{", ","]) == ["${pkgbase}{", ","]
def test_expand_array_exception() -> None:
"""
must raise exception if there is unclosed element
"""
with pytest.raises(PkgbuildParserError):
assert PkgbuildParser._expand_array(["${pkgbase}{", ",", "-libs"])
def test_is_escaped_exception(resource_path_root: Path) -> None:
"""
must raise PkgbuildParserError if no valid utf symbols found
"""
utf8 = resource_path_root / "models" / "utf8"
with utf8.open(encoding="utf8") as content:
content.seek(2)
with pytest.raises(PkgbuildParserError):
assert not PkgbuildParser(content)._is_escaped()
def test_parse_array() -> None:
"""
must parse array
"""
parser = PkgbuildParser(BytesIO(b"var=(first second)"))
parser = PkgbuildParser(StringIO("var=(first second)"))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", "second"])]
def test_parse_array_brace_expansion() -> None:
"""
must correctly expand bash braces in array values
"""
parser = PkgbuildParser(BytesIO(b"array=(prefix{only}suffix)"))
assert list(parser.parse()) == [PkgbuildPatch("array", ["prefix{only}suffix"])]
parser = PkgbuildParser(BytesIO(b"array=(prefix{first,second}suffix)"))
assert list(parser.parse()) == [PkgbuildPatch("array", ["prefixfirstsuffix", "prefixsecondsuffix"])]
parser = PkgbuildParser(BytesIO(b"""array=("prefix{first,second}suffix")"""))
assert list(parser.parse()) == [PkgbuildPatch("array", ["prefix{first,second}suffix"])]
def test_parse_array_brackets() -> None:
"""
must correctly process quoted brackets
"""
parser = PkgbuildParser(BytesIO(b"""var=(first "(" second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", "(", "second"])]
parser = PkgbuildParser(BytesIO(b"""var=(first ")" second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
parser = PkgbuildParser(BytesIO(b"""var=(first ')' second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
parser = PkgbuildParser(BytesIO(b"""var=(first \\) second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
def test_parse_array_comment() -> None:
"""
must parse array with comments inside
"""
parser = PkgbuildParser(BytesIO(b"""validpgpkeys=(
parser = PkgbuildParser(StringIO("""validpgpkeys=(
'F3691687D867B81B51CE07D9BBE43771487328A9' # bpiotrowski@archlinux.org
'86CFFCA918CF3AF47147588051E8B148A9999C34' # evangelos@foutrelis.com
'13975A70E63C361C73AE69EF6EEB81F8981C74C7' # richard.guenther@gmail.com
@@ -64,23 +79,28 @@ def test_parse_array_comment() -> None:
])]
def test_parse_array_escaped() -> None:
"""
must correctly process quoted brackets
"""
parser = PkgbuildParser(StringIO("""var=(first "(" second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", "(", "second"])]
parser = PkgbuildParser(StringIO("""var=(first ")" second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
parser = PkgbuildParser(StringIO("""var=(first ')' second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
parser = PkgbuildParser(StringIO("""var=(first \\) second)"""))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", ")", "second"])]
def test_parse_array_exception() -> None:
"""
must raise exception if there is no closing bracket
"""
parser = PkgbuildParser(BytesIO(b"var=(first second"))
with pytest.raises(PkgbuildParserError, match="line 1"):
assert list(parser.parse())
def test_parse_conditional_assignment() -> None:
"""
must parse an assignment inside a Bash conditional
"""
source = b"if [[ -n value ]]; then\n pkgver=1\nfi\n"
assert list(PkgbuildParser(BytesIO(source)).parse()) == [PkgbuildPatch("pkgver", "1")]
parser = PkgbuildParser(BytesIO(b"var() { echo hello world"))
parser = PkgbuildParser(StringIO("var=(first second"))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
@@ -89,92 +109,86 @@ def test_parse_function() -> None:
"""
must parse function
"""
parser = PkgbuildParser(BytesIO(b"var() { echo hello world; } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world; }")]
parser = PkgbuildParser(StringIO("var() { echo hello world } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world }")]
def test_parse_function_eof() -> None:
"""
must parse function with "}" at the end of the file
"""
parser = PkgbuildParser(BytesIO(b"var() { echo hello world; }"))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world; }")]
parser = PkgbuildParser(StringIO("var() { echo hello world }"))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world }")]
def test_parse_function_escaped() -> None:
def test_parse_function_spaces() -> None:
"""
must parse function with bracket in quotes
must parse function with spaces in declaration
"""
parser = PkgbuildParser(BytesIO(b"""var() { echo "hello world {"; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo "hello world {"; }""")]
parser = PkgbuildParser(BytesIO(b"""var() { echo hello world "{"; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world "{"; }""")]
parser = PkgbuildParser(BytesIO(b"""var() { echo "hello world }"; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo "hello world }"; }""")]
parser = PkgbuildParser(BytesIO(b"""var() { echo hello world "}"; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world "}"; }""")]
parser = PkgbuildParser(BytesIO(b"""var() { echo hello world '}'; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world '}'; }""")]
parser = PkgbuildParser(BytesIO(b"""var() { echo hello world \\}; } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world \\}; }""")]
def test_parse_function_exception() -> None:
"""
must raise exception if no bracket found
"""
parser = PkgbuildParser(BytesIO(b"var() echo hello world } "))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
parser = PkgbuildParser(StringIO("var ( ) { echo hello world } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world }")]
def test_parse_function_inner_shell() -> None:
"""
must parse function with inner shell
"""
parser = PkgbuildParser(BytesIO(b"var() { { echo hello world; }; } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ { echo hello world; }; }")]
parser = PkgbuildParser(StringIO("var ( ) { { echo hello world } } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ { echo hello world } }")]
def test_parse_function_spaces() -> None:
def test_parse_function_escaped() -> None:
"""
must parse function with spaces before body
must parse function with bracket in quotes
"""
parser = PkgbuildParser(BytesIO(b"var() { echo hello world; } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world; }")]
parser = PkgbuildParser(StringIO("""var ( ) { echo "hello world {" } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo "hello world {" }""")]
parser = PkgbuildParser(StringIO("""var ( ) { echo hello world "{" } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world "{" }""")]
parser = PkgbuildParser(StringIO("""var ( ) { echo "hello world }" } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo "hello world }" }""")]
parser = PkgbuildParser(StringIO("""var ( ) { echo hello world "}" } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world "}" }""")]
parser = PkgbuildParser(StringIO("""var ( ) { echo hello world '}' } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world '}' }""")]
parser = PkgbuildParser(StringIO("""var ( ) { echo hello world \\} } """))
assert list(parser.parse()) == [PkgbuildPatch("var()", """{ echo hello world \\} }""")]
def test_parse_nested_quotes() -> None:
def test_parse_function_exception() -> None:
"""
must parse command substitutions that contain their own quote characters
must raise exception if no bracket found
"""
source = b"""pkgbase="$(grep X f | cut -d '"' -f2)"
pkgver() {
cd aften
_ver="$(cat CMakeLists.txt | grep -e SO_MAJOR_VERSION -e SO_MINOR_VERSION -e SO_BUILD_VERSION | cut -d '"' -f2 | head -n3)"
echo "$(echo ${_ver} | tr ' ' .).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}
"""
assert list(PkgbuildParser(BytesIO(source)).parse()) == [
PkgbuildPatch("pkgbase", """$(grep X f | cut -d '"' -f2)"""),
PkgbuildPatch("pkgver()", """{
cd aften
_ver="$(cat CMakeLists.txt | grep -e SO_MAJOR_VERSION -e SO_MINOR_VERSION -e SO_BUILD_VERSION | cut -d '"' -f2 | head -n3)"
echo "$(echo ${_ver} | tr ' ' .).r$(git rev-list --count HEAD).$(git rev-parse --short HEAD)"
}"""),
]
parser = PkgbuildParser(StringIO("var() echo hello world } "))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
parser = PkgbuildParser(StringIO("var() { echo hello world"))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
def test_parse_token_assignment() -> None:
"""
must parse simple assignment
"""
parser = PkgbuildParser(StringIO())
assert next(parser._parse_token("var=value")) == PkgbuildPatch("var", "value")
assert next(parser._parse_token("var=$value")) == PkgbuildPatch("var", "$value")
assert next(parser._parse_token("var=${value}")) == PkgbuildPatch("var", "${value}")
assert next(parser._parse_token("var=${value/-/_}")) == PkgbuildPatch("var", "${value/-/_}")
def test_parse_token_comment() -> None:
"""
must correctly parse comment
"""
parser = PkgbuildParser(BytesIO(b"""first=1 # comment
parser = PkgbuildParser(StringIO("""first=1 # comment
# comment line
second=2
#third=3
@@ -185,12 +199,58 @@ def test_parse_token_comment() -> None:
]
def test_read_comment() -> None:
"""
must read comment correctly
"""
io = StringIO("# comment\nnew line")
io.seek(2)
PkgbuildParser(io)._read_comment()
assert io.tell() == 10
def test_read_comment_skip() -> None:
"""
must skip reading new line if comment ends with new line
"""
io = StringIO("#comment\nnew line")
io.seek(7)
PkgbuildParser(io)._read_comment()
assert io.tell() == 9
def test_read_last() -> None:
"""
must read last symbol from current position
"""
io = StringIO("mock")
io.seek(2)
assert PkgbuildParser(io)._read_last() == (1, "o")
def test_read_last_starting() -> None:
"""
must raise exception if it reads from starting position
"""
with pytest.raises(PkgbuildParserError):
assert PkgbuildParser(StringIO("mock"))._read_last()
def test_read_last_from_position() -> None:
"""
must read last symbol from the specified position
"""
assert PkgbuildParser(StringIO("mock"))._read_last(2) == (2, "c")
def test_parse(resource_path_root: Path) -> None:
"""
must parse complex file
"""
pkgbuild = resource_path_root / "models" / "pkgbuild"
with pkgbuild.open("rb") as content:
with pkgbuild.open(encoding="utf8") as content:
parser = PkgbuildParser(content)
assert list(parser.parse()) == [
PkgbuildPatch("var", "value"),
@@ -217,50 +277,50 @@ def test_parse(resource_path_root: Path) -> None:
PkgbuildPatch("array", ["first", ")", "second"]),
PkgbuildPatch("array", ["first", "(", "second"]),
PkgbuildPatch("array", ["first", ")", "second"]),
PkgbuildPatch("func()", """{ single line; }"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{ single line }"""),
PkgbuildPatch("function()", """{
multi
line
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
c
multi
line
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
# comment
multi
line
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body
}"""),
PkgbuildPatch("function_with-package-name()", """{ body; }"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function_with-package-name()", """{ body }"""),
PkgbuildPatch("function()", """{
first
{ inner shell; }
{ inner shell }
last
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body "{" argument
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body "}" argument
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body '{' argument
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
body '}' argument
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
# we don't care about unclosed quotation in comments
body # no, I said we really don't care
}"""),
PkgbuildPatch("func()", """{
PkgbuildPatch("function()", """{
mv "$pkgdir"/usr/share/fonts/站酷小薇体 "$pkgdir"/usr/share/fonts/zcool-xiaowei-regular
mv "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.站酷小薇体 "$pkgdir"/usr/share/licenses/"$pkgname"/LICENSE.zcool-xiaowei-regular
}"""),
@@ -90,19 +90,6 @@ def test_is_outdated_true(package_ahriman: Package, configuration: Configuration
actual_version_mock.assert_called_once_with(configuration)
def test_is_outdated_aur_cooldown(package_ahriman: Package, configuration: Configuration) -> None:
"""
must be not outdated if AUR package is modified too recently
"""
other = Package.from_json(package_ahriman.view())
other.version = other.version.replace("-1", "-2")
for description in other.packages.values():
description.build_date = int(utcnow().timestamp())
configuration.set_option("build", "min_age", "3600")
assert not PackageVersion(package_ahriman).is_outdated(other, configuration)
def test_is_outdated_no_version_calculation(package_ahriman: Package, configuration: Configuration,
mocker: MockerFixture) -> None:
"""
@@ -195,7 +195,7 @@ def test_init(sources: Sources, mocker: MockerFixture) -> None:
sources.init(local)
check_output_mock.assert_called_once_with(*sources.git(), "init", "--quiet", "--initial-branch",
sources.DEFAULT_BRANCH, cwd=local, logger=pytest.helpers.anyvar(int))
add_mock.assert_called_once_with(local, "PKGBUILD", ".SRCINFO", "local", force=True)
add_mock.assert_called_once_with(local, "PKGBUILD", ".SRCINFO", "local")
commit_mock.assert_called_once_with(local)
@@ -347,17 +347,6 @@ def test_add_skip(sources: Sources, mocker: MockerFixture) -> None:
check_output_mock.assert_not_called()
def test_add_force(sources: Sources, tmp_path: Path, mocker: MockerFixture) -> None:
"""
must add files to git with --force flag
"""
mocker.patch("pathlib.Path.glob", return_value=[Path("local/1"), Path("local/2")])
check_output_mock = mocker.patch("ahriman.core.build_tools.sources.check_output")
sources.add(Path("local"), "PKGBUILD", force=True)
assert "--force" in check_output_mock.call_args.args
def test_commit(sources: Sources, mocker: MockerFixture) -> None:
"""
must commit changes
@@ -53,11 +53,8 @@ def test_build(task_ahriman: Task, mocker: MockerFixture) -> None:
assert task_ahriman.build(local) == [task_ahriman.package.base]
check_output_mock.assert_called_once_with(
"ahriman-archbuild",
"-r", task_ahriman.repository_id.name,
"-a", task_ahriman.repository_id.architecture,
"-c", str(task_ahriman.devtools_configs),
"--", "-r", str(task_ahriman.paths.chroot),
"extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
exception=pytest.helpers.anyvar(int),
@@ -82,11 +79,8 @@ def test_build_environment(task_ahriman: Task, mocker: MockerFixture) -> None:
task_ahriman.build(local, **environment, empty=None)
check_output_mock.assert_called_once_with(
"ahriman-archbuild",
"-r", task_ahriman.repository_id.name,
"-a", task_ahriman.repository_id.architecture,
"-c", str(task_ahriman.devtools_configs),
"--", "-r", str(task_ahriman.paths.chroot),
"extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
exception=pytest.helpers.anyvar(int),
@@ -97,33 +91,6 @@ def test_build_environment(task_ahriman: Task, mocker: MockerFixture) -> None:
)
def test_build_makeflags(task_ahriman: Task, mocker: MockerFixture) -> None:
"""
must build package with MAKEFLAGS variable if set
"""
local = Path("local")
mocker.patch("pathlib.Path.iterdir", return_value=["file"])
mocker.patch("ahriman.core.build_tools.task.Task._package_archives", return_value=[task_ahriman.package.base])
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
task_ahriman.make_flags = "-j1"
task_ahriman.build(local)
check_output_mock.assert_called_once_with(
"ahriman-archbuild",
"-r", task_ahriman.repository_id.name,
"-a", task_ahriman.repository_id.architecture,
"-c", str(task_ahriman.devtools_configs),
"--", "-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
exception=pytest.helpers.anyvar(int),
cwd=local,
logger=task_ahriman.logger,
user=task_ahriman.uid,
environment={"MAKEFLAGS": "-j1"},
)
def test_build_dry_run(task_ahriman: Task, mocker: MockerFixture) -> None:
"""
must run devtools in dry-run mode
@@ -133,40 +100,13 @@ def test_build_dry_run(task_ahriman: Task, mocker: MockerFixture) -> None:
mocker.patch("ahriman.core.build_tools.task.Task._package_archives", return_value=[task_ahriman.package.base])
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
task_ahriman.build(local, dry_run=True)
check_output_mock.assert_called_once_with(
"ahriman-archbuild",
"-r", task_ahriman.repository_id.name,
"-a", task_ahriman.repository_id.architecture,
"-c", str(task_ahriman.devtools_configs),
"--", "-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
"--nobuild",
exception=pytest.helpers.anyvar(int),
cwd=local,
logger=task_ahriman.logger,
user=task_ahriman.uid,
environment={},
)
def test_build_legacy_subcommand(task_ahriman: Task, mocker: MockerFixture) -> None:
"""
must build package by using legacy subcommand if set
"""
local = Path("local")
mocker.patch("pathlib.Path.iterdir", return_value=["file"])
mocker.patch("ahriman.core.build_tools.task.Task._package_archives", return_value=[task_ahriman.package.base])
check_output_mock = mocker.patch("ahriman.core.build_tools.task.check_output")
task_ahriman._legacy_build_command = ["extra-x86_64-build"]
task_ahriman.build(local)
assert task_ahriman.build(local, dry_run=True) == [task_ahriman.package.base]
check_output_mock.assert_called_once_with(
"extra-x86_64-build",
"-r", str(task_ahriman.paths.chroot),
"--", "-D", str(task_ahriman.paths.archive),
"--", "--skippgpcheck",
"--nobuild",
exception=pytest.helpers.anyvar(int),
cwd=local,
logger=task_ahriman.logger,
@@ -374,16 +374,17 @@ def test_load_environment(configuration: Configuration) -> None:
assert configuration.get("section:identifier", "key") == "value2"
def test_load_includes(configuration: Configuration, mocker: MockerFixture) -> None:
def test_load_includes(mocker: MockerFixture) -> None:
"""
must load includes
"""
mocker.patch.object(Configuration, "logging_path", Path("logging"))
read_mock = mocker.patch("ahriman.core.configuration.Configuration.read")
glob_mock = mocker.patch("pathlib.Path.glob", autospec=True, return_value=[Path("include"), Path("logging")])
configuration = Configuration()
configuration.load_includes()
glob_mock.assert_called_once_with(configuration.path.absolute().parent, "*.ini")
configuration.load_includes(Path("path"))
glob_mock.assert_called_once_with(Path("path"), "*.ini")
read_mock.assert_called_once_with(Path("include"))
assert configuration.includes == [Path("include")]
@@ -414,6 +415,17 @@ def test_load_includes_no_section() -> None:
configuration.load_includes()
def test_load_includes_default_path(mocker: MockerFixture) -> None:
"""
must load includes from default path
"""
mocker.patch.object(Configuration, "include", Path("path"))
glob_mock = mocker.patch("pathlib.Path.glob", autospec=True, return_value=[])
Configuration().load_includes()
glob_mock.assert_called_once_with(Path("path"), "*.ini")
def test_merge_sections_missing(configuration: Configuration) -> None:
"""
must merge create section if not exists
@@ -134,10 +134,6 @@ def test_validate_path_type(validator: Validator, mocker: MockerFixture) -> None
"""
error_mock = mocker.patch("ahriman.core.configuration.validator.Validator._error")
validator._validate_path_type("file", "field", Path("42"))
mocker.patch("pathlib.Path.exists", return_value=True)
mocker.patch("pathlib.Path.is_file", return_value=True)
validator._validate_path_type("file", "field", Path("1"))
+16 -2
View File
@@ -4,6 +4,7 @@ import pytest
from ahriman.core.alpm.repo import Repo
from ahriman.core.build_tools.task import Task
from ahriman.core.configuration import Configuration
from ahriman.core.sign.gpg import GPG
from ahriman.core.tree import Leaf
from ahriman.models.package import Package
from ahriman.models.repository_paths import RepositoryPaths
@@ -63,6 +64,20 @@ def repo(configuration: Configuration, repository_paths: RepositoryPaths) -> Rep
return Repo(configuration.get("repository", "name"), repository_paths, [])
@pytest.fixture
def gpg(configuration: Configuration) -> GPG:
"""
fixture for empty GPG
Args:
configuration(Configuration): configuration fixture
Returns:
GPG: GPG test instance
"""
return GPG(configuration)
@pytest.fixture
def task_ahriman(package_ahriman: Package, configuration: Configuration, repository_paths: RepositoryPaths) -> Task:
"""
@@ -76,5 +91,4 @@ def task_ahriman(package_ahriman: Package, configuration: Configuration, reposit
Returns:
Task: built task test instance
"""
_, repository_id = configuration.check_loaded()
return Task(package_ahriman, configuration, repository_id, repository_paths)
return Task(package_ahriman, configuration, "x86_64", repository_paths)
@@ -22,10 +22,10 @@ def test_configuration_sections(configuration: Configuration) -> None:
def test_archives_remove(archive_rotation_trigger: ArchiveRotationTrigger, package_ahriman: Package,
repository: Repository, mocker: MockerFixture) -> None:
"""
must keep the current package and the configured amount of additional packages
must remove older packages
"""
packages = []
for i in range(1, 7):
for i in range(5):
generated = replace(package_ahriman, version=str(i))
generated.packages = {
key: replace(value, filename=str(i))
@@ -33,17 +33,14 @@ def test_archives_remove(archive_rotation_trigger: ArchiveRotationTrigger, packa
}
packages.append(generated)
archive_rotation_trigger.keep_built_packages = 2
mocker.patch.object(repository, "packages", return_value=[replace(package_ahriman, version="3")])
mocker.patch("ahriman.core.repository.package_info.PackageInfo.package_archives", return_value=packages)
mocker.patch("pathlib.Path.glob", side_effect=lambda pattern: [Path(pattern.removesuffix("*"))])
mocker.patch("pathlib.Path.glob", return_value=[Path(str(i)) for i in range(5)])
unlink_mock = mocker.patch("pathlib.Path.unlink", autospec=True)
archive_rotation_trigger.archives_remove(package_ahriman, repository)
unlink_mock.assert_has_calls([
MockCall(Path("0")),
MockCall(Path("1")),
MockCall(Path("2")),
MockCall(Path("4")),
])
@@ -14,20 +14,6 @@ from ahriman.models.package_source import PackageSource
from ahriman.models.remote_source import RemoteSource
def test_updates_ignored(update_handler: UpdateHandler, package_ahriman: Package,
package_python_schedule: Package, mocker: MockerFixture) -> None:
"""
must combine configured ignored packages and held packages only
"""
update_handler._ignore_list = ["ignored-package"]
mocker.patch("ahriman.core.status.local_client.LocalClient.package_get", return_value=[
(package_ahriman, BuildStatus(is_held=True)),
(package_python_schedule, BuildStatus(is_held=False)),
])
assert update_handler._updates_ignored() == {"ignored-package", package_ahriman.base}
def test_updates_aur(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
@@ -208,18 +194,6 @@ def test_updates_dependencies(update_handler: UpdateHandler, package_ahriman: Pa
pytest.helpers.anyvar(str, True))
def test_updates_dependencies_ignore(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
must skip held packages when checking broken dependencies
"""
mocker.patch("ahriman.core.status.local_client.LocalClient.package_get",
return_value=[(package_ahriman, BuildStatus(is_held=True))])
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages", return_value=[package_ahriman])
assert update_handler.updates_dependencies([]) == []
def test_updates_dependencies_skip_unknown(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
@@ -275,19 +249,6 @@ def test_updates_local(update_handler: UpdateHandler, package_ahriman: Package,
calculate_version=True)
def test_updates_local_ignore(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
must skip held packages before fetching local sources
"""
mocker.patch("ahriman.core.status.local_client.LocalClient.package_get",
return_value=[(package_ahriman, BuildStatus(is_held=True))])
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages", return_value=[package_ahriman])
mocker.patch("pathlib.Path.iterdir", return_value=[Path(package_ahriman.base)])
assert update_handler.updates_local(vcs=True) == []
def test_updates_local_ignore_vcs(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
@@ -345,32 +306,17 @@ def test_updates_local_with_failures(update_handler: UpdateHandler, package_ahri
assert not update_handler.updates_local(vcs=True)
def test_updates_local_held_metadata(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
def test_updates_manual_clear(update_handler: UpdateHandler, mocker: MockerFixture) -> None:
"""
must respect the held base even when the source directory has a different name
requesting manual updates must clear packages directory
"""
package_ahriman.remote = RemoteSource(source=PackageSource.Local)
mocker.patch.object(update_handler.reporter, "package_get",
return_value=[(package_ahriman, BuildStatus(is_held=True))])
mocker.patch.object(update_handler, "packages", return_value=[package_ahriman])
mocker.patch("pathlib.Path.iterdir", return_value=[Path("different-base")])
mocker.patch("ahriman.core.build_tools.sources.Sources.fetch")
mocker.patch("ahriman.models.package.Package.from_build", return_value=package_ahriman)
mocker.patch("pathlib.Path.iterdir", return_value=[])
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages")
assert update_handler.updates_local(vcs=True) == []
update_handler.updates_manual()
def test_updates_manual_preserves_queue(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
discovery must leave manual requests queued for execution
"""
update_handler.database.build_queue_insert(package_ahriman)
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages", return_value=[package_ahriman])
assert update_handler.updates_manual() == [package_ahriman]
assert update_handler.database.build_queue_get() == [package_ahriman]
from ahriman.core.repository.cleaner import Cleaner
Cleaner.clear_queue.assert_called_once_with()
def test_updates_manual_status_known(update_handler: UpdateHandler, package_ahriman: Package,
@@ -2,7 +2,7 @@ import ahriman.web.views
from pathlib import Path
from ahriman.core.module_loader import _modules, implementations, optional_module
from ahriman.core.module_loader import _modules, implementations
from ahriman.web.views.base import BaseView
@@ -23,17 +23,3 @@ def test_implementations() -> None:
assert routes
assert all(isinstance(view, type) for view in routes)
assert all(issubclass(view, BaseView) for view in routes)
def test_optional_module() -> None:
"""
must import an available module
"""
assert optional_module("ahriman.web.views") is ahriman.web.views
def test_optional_module_fallback() -> None:
"""
must return none when the module cannot be imported
"""
assert optional_module("missing_ahriman_module") is None
+1 -12
View File
@@ -1,6 +1,6 @@
import pytest
from ahriman.core.exceptions import DependencyResolutionError, PartitionError
from ahriman.core.exceptions import PartitionError
from ahriman.core.tree import Leaf, Tree
from ahriman.models.package import Package
from ahriman.models.package_description import PackageDescription
@@ -270,14 +270,3 @@ def test_tree_partitions() -> None:
first, second = tree.partitions(count=3)
assert first == [leaf1.package, leaf2.package, leaf3.package, leaf5.package]
assert second == [leaf4.package]
def test_tree_levels_cycle(leaf_ahriman: Leaf, leaf_python_schedule: Leaf) -> None:
"""
must raise an exception if dependencies contain a cycle
"""
leaf_ahriman.dependencies = set(leaf_python_schedule.items)
leaf_python_schedule.dependencies = set(leaf_ahriman.items)
with pytest.raises(DependencyResolutionError):
Tree([leaf_ahriman, leaf_python_schedule]).levels()
@@ -221,6 +221,15 @@ def test_dataclass_view_without_none(package_ahriman: Package) -> None:
assert Package.from_json(result) == package_ahriman
def test_enum_values() -> None:
"""
must correctly generate choices from enumeration classes
"""
values = enum_values(PackageSource)
for value in values:
assert PackageSource(value).value == value
def test_extract_user() -> None:
"""
must extract user from system environment
@@ -1,6 +1,6 @@
import pytest
from io import BytesIO
from io import BytesIO, StringIO
from pathlib import Path
from pytest_mock import MockerFixture
@@ -22,14 +22,26 @@ def test_from_file(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
"""
must correctly load from file
"""
stream = BytesIO(b"content")
open_mock = mocker.patch("pathlib.Path.open")
open_mock.return_value.__enter__.return_value = stream
open_mock.return_value.__enter__.return_value = BytesIO(b"content")
load_mock = mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_io", return_value=pkgbuild_ahriman)
assert Pkgbuild.from_file(Path("local"))
open_mock.assert_called_once_with("rb")
load_mock.assert_called_once_with(stream)
load_mock.assert_called_once_with(pytest.helpers.anyvar(int))
def test_from_file_latin(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
"""
must correctly load from file with latin encoding
"""
open_mock = mocker.patch("pathlib.Path.open")
open_mock.return_value.__enter__.return_value = BytesIO("contént".encode("latin-1"))
load_mock = mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_io", return_value=pkgbuild_ahriman)
assert Pkgbuild.from_file(Path("local"))
open_mock.assert_called_once_with("rb")
load_mock.assert_called_once_with(pytest.helpers.anyvar(int))
def test_from_io(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
@@ -38,7 +50,7 @@ def test_from_io(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
"""
load_mock = mocker.patch("ahriman.core.alpm.pkgbuild_parser.PkgbuildParser.parse",
return_value=pkgbuild_ahriman.fields.values())
assert Pkgbuild.from_io(BytesIO(b"mock")) == pkgbuild_ahriman
assert Pkgbuild.from_io(StringIO("mock")) == pkgbuild_ahriman
load_mock.assert_called_once_with()
@@ -52,9 +64,9 @@ def test_from_io_pkgbase(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> N
[value for key, value in pkgbuild_ahriman.fields.items()] + [PkgbuildPatch("pkgbase", "pkgbase")],
])
assert Pkgbuild.from_io(BytesIO(b"mock"))["pkgbase"] == pkgbuild_ahriman["pkgname"]
assert "pkgbase" not in Pkgbuild.from_io(BytesIO(b"mock"))
assert Pkgbuild.from_io(BytesIO(b"mock"))["pkgbase"] == "pkgbase"
assert Pkgbuild.from_io(StringIO("mock"))["pkgbase"] == pkgbuild_ahriman["pkgname"]
assert "pkgbase" not in Pkgbuild.from_io(StringIO("mock"))
assert Pkgbuild.from_io(StringIO("mock"))["pkgbase"] == "pkgbase"
def test_from_io_empty(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
@@ -63,7 +75,7 @@ def test_from_io_empty(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> Non
"""
mocker.patch("ahriman.core.alpm.pkgbuild_parser.PkgbuildParser.parse",
return_value=list(pkgbuild_ahriman.fields.values()) + [PkgbuildPatch("", "")])
assert Pkgbuild.from_io(BytesIO(b"mock")) == pkgbuild_ahriman
assert Pkgbuild.from_io(StringIO("mock")) == pkgbuild_ahriman
def test_local_files(mocker: MockerFixture, resource_path_root: Path) -> None:
@@ -555,6 +567,7 @@ def test_parse_pacman_static(resource_path_root: Path) -> None:
"""
pkgbuild = Pkgbuild.from_file(resource_path_root / "models" / "package_pacman-static_pkgbuild")
values = {key: value.value for key, value in pkgbuild.fields.items() if not value.is_function}
print(values)
assert values == {
"pkgbase": "pacman-static",
"pkgname": "pacman-static",
File renamed without changes.
+20 -15
View File
@@ -1,27 +1,32 @@
[build-system]
requires = [
"hatchling",
]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "ahriman-triggers"
description = "ArcH linux ReposItory MANager, additional extensions"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
authors = [
{name = "ahriman team"},
]
dependencies = [
"ahriman-core",
]
description = "ArcH linux ReposItory MANager, additional extensions"
dynamic = [
"version",
]
requires-python = ">=3.14"
dynamic = ["version"]
[tool.hatch.build.targets.wheel]
packages = [
"src/ahriman",
]
[tool.hatch.build.targets.wheel.shared-data]
"package/share" = "share"
[project.urls]
Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
only-include = ["src/ahriman"]
sources = ["src"]
[tool.hatch.build.targets.wheel.shared-data]
"package/share" = "share"
View File
Whitespace-only changes.
+20 -15
View File
@@ -1,11 +1,16 @@
[build-system]
requires = [
"hatchling",
]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "ahriman-web"
description = "ArcH linux ReposItory MANager, web server"
readme = "../README.md"
requires-python = ">=3.13"
license = {file = "../COPYING"}
authors = [
{name = "ahriman team"},
]
dependencies = [
"ahriman-core",
"aiohttp",
@@ -13,11 +18,7 @@ dependencies = [
"aiohttp_jinja2",
"aiohttp_sse",
]
description = "ArcH linux ReposItory MANager, web server"
dynamic = [
"version",
]
requires-python = ">=3.14"
dynamic = ["version"]
[project.optional-dependencies]
auth = [
@@ -27,7 +28,7 @@ auth = [
]
docs = [
"aiohttp-apispec",
"setuptools", # required by aiohttp-apispec
"setuptools",
]
metrics = [
"aiohttp-openmetrics",
@@ -37,14 +38,18 @@ oauth2 = [
"aioauth-client",
]
[project.urls]
Documentation = "https://ahriman.readthedocs.io/"
Repository = "https://github.com/arcan1s/ahriman"
Changelog = "https://github.com/arcan1s/ahriman/releases"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
[tool.hatch.build.targets.wheel]
packages = [
"src/ahriman",
]
only-include = ["src/ahriman"]
sources = ["src"]
[tool.hatch.build.targets.wheel.shared-data]
"package/lib" = "lib"
"package/share" = "share"
[tool.hatch.version]
path = "../ahriman-core/src/ahriman/__init__.py"
+15 -11
View File
@@ -17,9 +17,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from typing import Any
try:
import aiohttp_security
except ImportError:
aiohttp_security = None # type: ignore[assignment]
from ahriman.core.module_loader import optional_module
try:
import aiohttp_session
except ImportError:
aiohttp_session = None # type: ignore[assignment]
from typing import Any
__all__ = [
@@ -31,10 +39,6 @@ __all__ = [
]
aiohttp_security = optional_module("aiohttp_security")
aiohttp_session = optional_module("aiohttp_session")
async def authorized_userid(*args: Any, **kwargs: Any) -> Any:
"""
handle aiohttp security methods
@@ -46,7 +50,7 @@ async def authorized_userid(*args: Any, **kwargs: Any) -> Any:
Returns:
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if aiohttp_security:
if aiohttp_security is not None:
return await aiohttp_security.authorized_userid(*args, **kwargs) # pylint: disable=no-value-for-parameter
return None
@@ -62,7 +66,7 @@ async def check_authorized(*args: Any, **kwargs: Any) -> Any:
Returns:
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if aiohttp_security:
if aiohttp_security is not None:
return await aiohttp_security.check_authorized(*args, **kwargs) # pylint: disable=no-value-for-parameter
return None
@@ -78,7 +82,7 @@ async def forget(*args: Any, **kwargs: Any) -> Any:
Returns:
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if aiohttp_security:
if aiohttp_security is not None:
return await aiohttp_security.forget(*args, **kwargs) # pylint: disable=no-value-for-parameter
return None
@@ -94,7 +98,7 @@ async def get_session(*args: Any, **kwargs: Any) -> Any:
Returns:
Any: empty dictionary in case if no aiohttp_session module found and function call otherwise
"""
if aiohttp_session:
if aiohttp_session is not None:
return await aiohttp_session.get_session(*args, **kwargs)
return {}
@@ -110,6 +114,6 @@ async def remember(*args: Any, **kwargs: Any) -> Any:
Returns:
Any: ``None`` in case if no aiohttp_security module found and function call otherwise
"""
if aiohttp_security:
if aiohttp_security is not None:
return await aiohttp_security.remember(*args, **kwargs) # pylint: disable=no-value-for-parameter
return None
@@ -17,20 +17,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from ahriman.core.module_loader import optional_module
try:
import aiohttp_apispec # type: ignore[import-untyped]
aiohttp_apispec = optional_module("aiohttp_apispec")
marshmallow = optional_module("marshmallow")
if aiohttp_apispec and marshmallow:
Schema = marshmallow.Schema
fields = marshmallow.fields
else:
from marshmallow import Schema, fields
except ImportError:
from unittest.mock import Mock
Schema = Mock # type: ignore[misc]
aiohttp_apispec = None
fields = Mock()
@@ -115,7 +115,7 @@ def apidocs(*,
authorization_required = permission != UserAccess.Unauthorized
def wrapper(handler: Callable[..., Any]) -> Callable[..., Any]:
if not aiohttp_apispec:
if aiohttp_apispec is None:
return handler # apispec is disabled
responses = _response_schema(
+6 -3
View File
@@ -100,17 +100,20 @@ def _servers(application: Application) -> list[dict[str, Any]]:
}]
def setup_apispec(application: Application) -> None:
def setup_apispec(application: Application) -> Any:
"""
setup swagger api specification
Args:
application(Application): web application instance
Returns:
Any: created specification instance if module is available
"""
if aiohttp_apispec is None:
return
return None
aiohttp_apispec.setup_aiohttp_apispec(
return aiohttp_apispec.setup_aiohttp_apispec(
application,
url="/api-docs/swagger.json",
openapi_version="3.0.2",
@@ -17,10 +17,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
try:
import aiohttp_openmetrics
except ImportError:
aiohttp_openmetrics = None # type: ignore[assignment]
from aiohttp.typedefs import Middleware
from aiohttp.web import HTTPNotFound, Request, Response, StreamResponse, middleware
from ahriman.core.module_loader import optional_module
from ahriman.web.middlewares import HandlerType
@@ -30,9 +34,6 @@ __all__ = [
]
aiohttp_openmetrics = optional_module("aiohttp_openmetrics")
async def metrics(request: Request) -> Response:
"""
handler for returning metrics
@@ -46,7 +47,7 @@ async def metrics(request: Request) -> Response:
Raises:
HTTPNotFound: endpoint is disabled
"""
if not aiohttp_openmetrics:
if aiohttp_openmetrics is None:
raise HTTPNotFound
return await aiohttp_openmetrics.metrics(request)
@@ -58,7 +59,7 @@ def metrics_handler() -> Middleware:
Returns:
Middleware: middleware function to handle server metrics
"""
if aiohttp_openmetrics:
if aiohttp_openmetrics is not None:
return aiohttp_openmetrics.metrics_middleware
@middleware
+1 -1
View File
@@ -60,7 +60,7 @@ async def server_info(view: BaseView) -> dict[str, Any]:
"username": await authorized_userid(view.request),
},
"autorefresh_intervals": sorted(autorefresh_intervals, key=comparator),
"docs_enabled": bool(aiohttp_apispec),
"docs_enabled": aiohttp_apispec is not None,
"index_url": view.configuration.get("web", "index_url", fallback=None),
"repositories": [
{
@@ -50,7 +50,7 @@ class DocsView(BaseView):
list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set
and returns empty list otherwise
"""
if not aiohttp_apispec:
if aiohttp_apispec is None:
return []
return cls.ROUTES
@@ -51,7 +51,7 @@ class SwaggerView(BaseView):
list[str]: list of routes defined for the view. By default, it tries to read :attr:`ROUTES` option if set
and returns empty list otherwise
"""
if not aiohttp_apispec:
if aiohttp_apispec is None:
return []
return cls.ROUTES
@@ -87,8 +87,7 @@ class EventBusView(BaseView):
"""
while response.is_connected():
try:
# pylint: disable=protected-access
event_type, data = await wait_for(queue.get(), timeout=response._ping_interval)
event_type, data = await wait_for(queue.get(), timeout=response.ping_interval)
except TimeoutError:
continue
except QueueShutDown:
@@ -22,7 +22,6 @@ from secrets import token_urlsafe
from typing import ClassVar
from ahriman.core.auth.helpers import get_session, remember
from ahriman.core.module_loader import optional_module
from ahriman.models.user_access import UserAccess
from ahriman.web.apispec.decorators import apidocs
from ahriman.web.schemas import LoginSchema, OAuth2Schema
@@ -63,12 +62,14 @@ class LoginView(BaseView):
HTTPMethodNotAllowed: in case if method is used, but OAuth is disabled
HTTPUnauthorized: if case of authorization error
"""
oauth = optional_module("ahriman.core.auth.oauth")
if not oauth:
try:
from ahriman.core.auth.oauth import OAuth
except ImportError:
# no aioauth library found
raise HTTPMethodNotAllowed(self.request.method, ["POST"])
oauth_provider = self.validator
if not isinstance(oauth_provider, oauth.OAuth):
if not isinstance(oauth_provider, OAuth):
raise HTTPMethodNotAllowed(self.request.method, ["POST"])
session = await get_session(self.request)
@@ -48,8 +48,7 @@ def test_setup_apispec(application: Application, mocker: MockerFixture) -> None:
must set api specification
"""
apispec_mock = mocker.patch("aiohttp_apispec.setup_aiohttp_apispec")
setup_apispec(application)
assert setup_apispec(application)
apispec_mock.assert_called_once_with(
application,
url="/api-docs/swagger.json",
@@ -3,7 +3,6 @@ import pytest
from aiohttp.test_utils import TestClient
from aiohttp.web import HTTPBadRequest
from aiohttp_sse import EventSourceResponse
from asyncio import Queue
from multidict import MultiDict
from pytest_mock import MockerFixture
@@ -96,20 +95,21 @@ def test_routes() -> None:
async def test_run_timeout() -> None:
"""
must recheck the connection after a queue timeout
must handle timeout and continue loop
"""
queue = AsyncMock(spec_set=Queue)
queue.get.side_effect = TimeoutError
response = AsyncMock(spec_set=EventSourceResponse())
response._ping_interval = 0.01
response.is_connected.side_effect = [True, False]
queue = Queue()
async def _shutdown() -> None:
await asyncio.sleep(0.05)
queue.shutdown()
response = AsyncMock()
response.is_connected = lambda: True
response.ping_interval = 0.01
asyncio.create_task(_shutdown())
await EventBusView._run(response, queue)
assert response.is_connected.call_count == 2
queue.get.assert_awaited_once()
response.send.assert_not_awaited()
def test_topics() -> None:
"""
@@ -37,7 +37,7 @@ async def test_get_import_error(client_with_auth: TestClient, mocker: MockerFixt
"""
must return 405 on import error
"""
mocker.patch("ahriman.web.views.v1.user.login.optional_module", return_value=None)
pytest.helpers.import_error("ahriman.core.auth.oauth", ["OAuth"], mocker)
response = await client_with_auth.get("/api/v1/login")
assert response.status == 405
File renamed without changes.
+6 -9
View File
@@ -2,18 +2,17 @@
pkgbase='ahriman'
pkgname=('ahriman' 'ahriman-core' 'ahriman-triggers' 'ahriman-web')
pkgver=2.22.2
pkgver=2.20.0
pkgrel=1
pkgdesc="ArcH linux ReposItory MANager"
arch=('any')
url="https://ahriman.readthedocs.io/"
license=('GPL-3.0-or-later')
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-bcrypt' 'python-filelock' 'python-inflection' 'python-pyelftools' 'python-requests' 'python-tree-sitter' 'python-tree-sitter-bash')
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-bcrypt' 'python-filelock' 'python-inflection' 'python-pyelftools' 'python-requests')
makedepends=('npm' 'python-build' 'python-hatchling' 'python-installer' 'python-wheel')
source=("https://github.com/arcan1s/ahriman/releases/download/$pkgver/$pkgbase-$pkgver.tar.gz"
"$pkgbase.sysusers"
"$pkgbase.tmpfiles"
"sudoers.conf")
"$pkgbase.tmpfiles")
build() {
cd "$pkgbase-$pkgver"
@@ -21,9 +20,9 @@ build() {
npm --prefix "frontend" install --cache "$srcdir/npm-cache"
npm --prefix "frontend" run build
python -m build --wheel --no-isolation "ahriman-core"
python -m build --wheel --no-isolation "ahriman-triggers"
python -m build --wheel --no-isolation "ahriman-web"
python -m build --wheel --no-isolation ahriman-core
python -m build --wheel --no-isolation ahriman-triggers
python -m build --wheel --no-isolation ahriman-web
}
package_ahriman() {
@@ -60,8 +59,6 @@ package_ahriman-core() {
install -Dm644 "$srcdir/$pkgbase.sysusers" "$pkgdir/usr/lib/sysusers.d/$pkgbase.conf"
install -Dm644 "$srcdir/$pkgbase.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/$pkgbase.conf"
install -Dm440 "$srcdir/sudoers.conf" "$pkgdir/etc/sudoers.d/$pkgname"
}
package_ahriman-triggers() {
-2
View File
@@ -1,2 +0,0 @@
Defaults!/usr/bin/ahriman-archbuild env_keep += "SOURCE_DATE_EPOCH SRCDEST SRCPKGDEST PKGDEST LOGDEST NPROC MAKEFLAGS PACKAGER GNUPGHOME"
ahriman ALL= NOPASSWD:NOSETENV: /usr/bin/ahriman-archbuild *
@@ -1,22 +1,3 @@
#
# Copyright (c) 2021-2025 ahriman team.
#
# This file is part of ahriman
# (see https://github.com/arcan1s/ahriman).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import datetime
import pytest
@@ -60,6 +41,7 @@ T = TypeVar("T")
# helpers
# https://stackoverflow.com/a/21611963
@pytest.helpers.register
def anyvar(cls: type[T], strict: bool = False) -> T:
"""
any value helper for mocker calls check
@@ -91,6 +73,7 @@ def anyvar(cls: type[T], strict: bool = False) -> T:
return AnyVar()
@pytest.helpers.register
def get_package_status(package: Package) -> dict[str, Any]:
"""
helper to extract package status from package
@@ -104,6 +87,7 @@ def get_package_status(package: Package) -> dict[str, Any]:
return {"status": BuildStatusEnum.Unknown.value, "package": package.view()}
@pytest.helpers.register
def get_package_status_extended(package: Package) -> dict[str, Any]:
"""
helper to extract package status from package
@@ -117,18 +101,33 @@ def get_package_status_extended(package: Package) -> dict[str, Any]:
return {"status": BuildStatus().view(), "package": package.view()}
@pytest.hookimpl(trylast=True)
def pytest_configure() -> None:
@pytest.helpers.register
def import_error(package: str, components: list[str], mocker: MockerFixture) -> MagicMock:
"""
register helpers after pytest-helpers-namespace has initialized
mock import error
Args:
package(str): package name to import
components(list[str]): component to import if any (e.g. from ... import ...)
mocker(MockerFixture): mocker object
Returns:
MagicMock: mocked object
"""
for helper in (anyvar, get_package_status, get_package_status_extended):
pytest.helpers.register(helper)
import builtins
_import = builtins.__import__
def test_import(name: str, globals: Any, locals: Any, from_list: list[str], level: Any):
if name == package and (not components or any(component in from_list for component in components)):
raise ImportError
return _import(name, globals, locals, from_list, level)
return mocker.patch.object(builtins, "__import__", test_import)
# generic fixtures
@pytest.fixture(autouse=True)
def _register_log_context() -> None:
def register_log_context() -> None:
"""
register log context variables and factory
"""
@@ -147,6 +146,31 @@ def args() -> argparse.Namespace:
repository=None, repository_id=None, wait_timeout=-1)
@pytest.fixture
def gpg(configuration: Configuration) -> GPG:
"""
fixture for empty GPG
Args:
configuration(Configuration): configuration fixture
Returns:
GPG: GPG test instance
"""
return GPG(configuration)
@pytest.fixture
def parser() -> argparse.ArgumentParser:
"""
fixture for command line arguments parser
Returns:
argparse.ArgumentParser: command line arguments parser instance
"""
return _parser()
@pytest.fixture
def aur_package_ahriman() -> AURPackage:
"""
@@ -231,6 +255,43 @@ def configuration(repository_id: RepositoryId, tmp_path: Path, resource_path_roo
path = resource_path_root / "core" / "ahriman.ini"
instance = Configuration.from_path(path, repository_id)
settings_root = resource_path_root.parent.parent / "ahriman-core" / "package" / "share" / "ahriman" / "settings"
logging_path = settings_root / "ahriman.ini.d" / "logging.ini"
instance.set_option("settings", "include", str(settings_root / "ahriman.ini.d"))
instance.set_option("settings", "logging", str(logging_path))
for include_root in (
settings_root /
"ahriman.ini.d",
resource_path_root.parent.parent /
"ahriman-triggers" /
"package" /
"share" /
"ahriman" /
"settings" /
"ahriman.ini.d",
resource_path_root.parent.parent /
"ahriman-web" /
"package" /
"share" /
"ahriman" /
"settings" /
"ahriman.ini.d",
):
for include in sorted(include_root.glob("*.ini")):
if include != logging_path:
instance.read(include)
core_templates = resource_path_root.parent.parent / "ahriman-core" / "package" / "share" / "ahriman" / "templates"
web_templates = resource_path_root.parent.parent / "ahriman-web" / "package" / "share" / "ahriman" / "templates"
for section in ("email", "html", "rss", "telegram"):
instance.set_option(section, "templates", str(core_templates))
instance.set_option("keyring", "target", "keyring")
instance.set_option("mirrorlist", "target", "mirrorlist")
instance.set_option("web", "templates", str(web_templates))
instance.set_option("web", "static_path", str(web_templates / "static"))
instance.set_option("web", "autorefresh_intervals", "")
instance.set_option("repository", "root", str(tmp_path))
instance.set_option("settings", "database", str(tmp_path / "ahriman.db"))
@@ -258,20 +319,6 @@ def database(configuration: Configuration, mocker: MockerFixture) -> SQLite:
return SQLite.load(configuration)
@pytest.fixture
def gpg(configuration: Configuration) -> GPG:
"""
fixture for empty GPG
Args:
configuration(Configuration): configuration fixture
Returns:
GPG: GPG test instance
"""
return GPG(configuration)
@pytest.fixture
def local_client(database: SQLite, configuration: Configuration) -> Client:
"""
@@ -441,17 +488,6 @@ def package_description_python2_schedule() -> PackageDescription:
)
@pytest.fixture
def parser() -> argparse.ArgumentParser:
"""
fixture for command line arguments parser
Returns:
argparse.ArgumentParser: command line arguments parser instance
"""
return _parser()
@pytest.fixture
def remote_source() -> RemoteSource:
"""
-2
View File
@@ -1,2 +0,0 @@
[web]
host = $AHRIMAN_HOST
+3 -5
View File
@@ -8,7 +8,7 @@ ARG BUILD_DATE
RUN useradd -m -d "/home/build" -s "/usr/bin/nologin" build
## extract container creation date and set mirror for this timestamp, set PKGEXT and refresh database next
RUN echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE//-//}/\$repo/os/\$arch" > "/etc/pacman.d/mirrorlist" && \
RUN echo "Server = https://archive.archlinux.org/repos/${BUILD_DATE//-/\/}/\$repo/os/\$arch" > "/etc/pacman.d/mirrorlist" && \
pacman -Syyuu --noconfirm
## setup package cache
RUN runuser -u build -- mkdir "/tmp/pkg" && \
@@ -80,6 +80,7 @@ FROM archlinux:base AS ahriman
# image configuration
ENV AHRIMAN_ARCHITECTURE="x86_64"
ENV AHRIMAN_DEBUG=""
ENV AHRIMAN_FORCE_ROOT=""
ENV AHRIMAN_HOST="0.0.0.0"
ENV AHRIMAN_MULTILIB="yes"
ENV AHRIMAN_OUTPUT=""
@@ -90,6 +91,7 @@ ENV AHRIMAN_POSTSETUP_COMMAND=""
ENV AHRIMAN_PRESETUP_COMMAND=""
ENV AHRIMAN_REPOSITORY="aur"
ENV AHRIMAN_REPOSITORY_SERVER=""
ENV AHRIMAN_REPOSITORY_ROOT="/var/lib/ahriman/ahriman"
ENV AHRIMAN_UNIX_SOCKET=""
ENV AHRIMAN_USER="ahriman"
ENV AHRIMAN_VALIDATE_CONFIGURATION="yes"
@@ -133,15 +135,11 @@ RUN find "/var/cache/pacman/pkg" "/var/lib/pacman/sync" -type "f,l" -delete && \
VOLUME ["/var/lib/ahriman"]
# minimal runtime ahriman setup
RUN systemd-machine-id-setup
COPY "docker/01-docker.ini" "/etc/ahriman.ini.d/01-docker.ini"
## FIXME since 1.0.4 devtools requires dbus to be run, which doesn't work now in container
COPY "docker/systemd-nspawn.sh" "/usr/local/bin/systemd-nspawn"
## entrypoint setup
COPY "docker/entrypoint.sh" "/usr/local/bin/entrypoint"
COPY "docker/entrypoint-web.sh" "/usr/local/bin/entrypoint-web"
USER ahriman
ENTRYPOINT ["entrypoint"]
# default command
CMD ["repo-update", "--refresh"]
+1 -6
View File
@@ -2,9 +2,4 @@
# Special workaround for running web service in github actions, must not be usually used in real environment,
# consider running web command explicitly instead
if (( EUID == 0 )); then
chown ahriman:ahriman /var/lib/ahriman
exec sudo -E -u ahriman -- entrypoint web "$@"
fi
exec entrypoint web "$@"
exec entrypoint web "$@"
+28 -1
View File
@@ -3,15 +3,30 @@
set -e
[ -n "$AHRIMAN_DEBUG" ] && set -x
# configuration tune
cat <<EOF > "/etc/ahriman.ini.d/01-docker.ini"
[repository]
root = $AHRIMAN_REPOSITORY_ROOT
[web]
host = $AHRIMAN_HOST
EOF
AHRIMAN_DEFAULT_ARGS=("--architecture" "$AHRIMAN_ARCHITECTURE")
AHRIMAN_DEFAULT_ARGS+=("--repository" "$AHRIMAN_REPOSITORY")
if [ -n "$AHRIMAN_OUTPUT" ]; then
AHRIMAN_DEFAULT_ARGS+=("--log-handler" "$AHRIMAN_OUTPUT")
fi
# create repository root inside the [[mounted]] directory and set correct ownership
[ -d "$AHRIMAN_REPOSITORY_ROOT" ] || mkdir "$AHRIMAN_REPOSITORY_ROOT"
chown "$AHRIMAN_USER":"$AHRIMAN_USER" "$AHRIMAN_REPOSITORY_ROOT"
# create .gnupg directory which is required for keys
AHRIMAN_GNUPG_HOME="$(getent passwd "$AHRIMAN_USER" | cut -d : -f 6)/.gnupg"
[ -d "$AHRIMAN_GNUPG_HOME" ] || mkdir -m700 "$AHRIMAN_GNUPG_HOME"
chown "$AHRIMAN_USER":"$AHRIMAN_USER" "$AHRIMAN_GNUPG_HOME"
# run built-in setup command
AHRIMAN_SETUP_ARGS=("--build-as-user" "$AHRIMAN_USER")
@@ -39,7 +54,19 @@ ahriman "${AHRIMAN_DEFAULT_ARGS[@]}" service-setup "${AHRIMAN_SETUP_ARGS[@]}"
# validate configuration if set
[ -n "$AHRIMAN_VALIDATE_CONFIGURATION" ] && ahriman "${AHRIMAN_DEFAULT_ARGS[@]}" service-config-validate --exit-code
# create machine-id which is required by build tools
systemd-machine-id-setup &> /dev/null
# special workaround to emulate /bin/bash entrypoint if first argument starts with /
[[ "$1" =~ ^/.* ]] && exec "$@"
exec ahriman "${AHRIMAN_DEFAULT_ARGS[@]}" "$@"
# if AHRIMAN_FORCE_ROOT is set or command is unsafe we can run without sudo
# otherwise we prepend executable by sudo command
if [ -n "$AHRIMAN_FORCE_ROOT" ]; then
AHRIMAN_EXECUTABLE=("ahriman")
elif ahriman help-commands-unsafe -- "$@" &> /dev/null; then
AHRIMAN_EXECUTABLE=("sudo" "-E" "-u" "$AHRIMAN_USER" "--" "ahriman")
else
AHRIMAN_EXECUTABLE=("ahriman")
fi
exec "${AHRIMAN_EXECUTABLE[@]}" "${AHRIMAN_DEFAULT_ARGS[@]}" "$@"
+1515 -1443
View File
File diff suppressed because it is too large. Load diff
+7 -11
View File
@@ -116,7 +116,7 @@ Filesystem tree
The application supports two types of trees, one is for the legacy configuration (when there were no explicit repository name configuration available) and another one is the new-style tree. This document describes only new-style tree in order to avoid deprecated structures.
Having default root as ``/var/lib/ahriman``, the directory structure is the following:
Having default root as ``/var/lib/ahriman`` (differs from container though), the directory structure is the following:
.. code-block::
@@ -257,10 +257,6 @@ There are few ways for packages to be marked as out-of-date and hence requiring
#. In addition to the above, if package is named as VCS (e.g. has suffix ``-git``) and the last update was more than specified threshold ago, the service will also try to fetch sources and check if the revision is newer than the built one.
#. In addition, there is ability to check if the dependencies of the package have been updated (e.g. if linked library has been renamed or the modules directory - e.g. in case of python and ruby packages - has been changed). And if so, the package will be marked as out-of-date as well.
Held packages and bases listed in ``build.ignore_packages`` are excluded from automatic AUR, official-repository, local-source, and broken-dependency update checks. These checks leave their package status unchanged. Manual updates and explicit rebuilds remain available.
Reading manual updates, including during ``repo-update --dry-run``, leaves the build queue intact. Execution removes requests by package base after a build chunk returns or a remote worker accepts it; successful prebuilt imports also remove requests by package base. Interrupted chunks and work that was not selected remain queued. Concurrent requests for the same package base are not distinguished; request revisions and crash recovery are separate work.
Update packages
^^^^^^^^^^^^^^^
@@ -426,13 +422,13 @@ There are several supported synchronization providers, currently they are ``rsyn
PKGBUILD parsing
^^^^^^^^^^^^^^^^
The application uses the Tree-sitter Bash grammar in ``ahriman.core.alpm.pkgbuild_parser.PkgbuildParser`` to process
PKGBUILDs without executing them. It extracts assignment and function nodes from the syntax tree and preserves function
bodies from the original source.
The application provides a house-made shell parser ``ahriman.core.alpm.pkgbuild_parser.PkgbuildParser`` to process PKGBUILDs and extract package data from them. It relies on the ``shlex.shlex`` parser with some configuration tweaks and adds some token post-processing.
#. Assignments, arrays, and functions are read from the syntax tree. Quote and escape handling follows Bash syntax.
#. Function bodies are sliced from the source so their original formatting is preserved.
#. Bash syntax errors raise ``PkgbuildParserError`` with the source location.
#. During the parser process, firstly, it extracts the next token from the source file (basically, the word) and tries to match it to the variable assignment. If so, then just processes accordingly.
#. If it is not an assignment, the parser checks if the token was quoted.
#. If it wasn't quoted then the parser tries to match the array starts (two consecutive tokens like ``array=`` and ``(``) or it is function (``function``, ``()`` and ``{``).
#. The arrays are processed until the next closing bracket ``)``. After extraction, the parser tries to expand an array according to bash rules (``prefix{first,second}suffix`` constructions).
#. The functions are just read until the closing bracket ``}`` and then reread whole text from the input string without a tokenization.
All extracted fields are packed as ``ahriman.models.pkgbuild_patch.PkgbuildPatch`` and then can be used as ``ahriman.models.pkgbuild.Pkgbuild`` instance.
+8
View File
@@ -11,6 +11,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import datetime
import sys
from pathlib import Path
# support package imports
basedir = Path(__file__).resolve().parent.parent / "src"
sys.path.insert(0, str(basedir))
# -- Project information -----------------------------------------------------
+4 -8
View File
@@ -82,7 +82,7 @@ Base configuration settings.
* ``apply_migrations`` - perform database migrations on the application start, boolean, optional, default ``yes``. Useful if you are using git version. Note, however, that this option must be changed only if you know what to do and going to handle migrations manually.
* ``database`` - path to the application SQLite database, string, required.
* ``include`` - path to directories with configuration files overrides, space separated list of strings, optional. Files will be read in alphabetical order.
* ``include`` - path to directory with configuration files overrides, string, optional. Files will be read in alphabetical order.
* ``logging`` - path to logging configuration, string, required. Check ``logging.ini`` for reference.
``alpm:*`` groups
@@ -131,15 +131,11 @@ Authorized users are stored inside internal database, if any of external provide
Build related configuration. Group name can refer to architecture, e.g. ``build:x86_64`` can be used for x86_64 architecture specific settings.
* ``archbuild_flags`` - additional flags passed to ``archbuild`` command, space separated list of strings, optional.
* ``devtools_configs`` - path to devtools configuration directory, string, required.
* ``devtools_wrapper`` - path to devtools wrapper, space separated list of strings, required.
* ``build_command`` - default build command, string, required.
* ``ignore_packages`` - list packages to ignore during a regular update (manual update will still work), space separated list of strings, optional.
* ``include_debug_packages`` - distribute debug packages, boolean, optional, default ``yes``.
* ``make_flags`` - additional flags passed to ``make`` command via environment variable, space separated list of strings, optional.
* ``makechrootpkg_flags`` - additional flags passed to ``makechrootpkg`` command, space separated list of strings, optional.
* ``makepkg_flags`` - additional flags passed to ``makepkg`` command, space separated list of strings, optional.
* ``min_age`` - minimal age in seconds since the latest AUR package modification before automatic updates are allowed, integer, optional, default ``0``.
* ``packager`` - default packager identifier in form ``Name Surname <mail@example.com>``, string, optional.
* ``makechrootpkg_flags`` - additional flags passed to ``makechrootpkg`` command, space separated list of strings, optional.
* ``scan_paths`` - paths to be used for implicit dependencies scan, space separated list of strings, optional. If any of those paths is matched against the path, it will be added to the allowed list.
* ``triggers`` - list of ``ahriman.core.triggers.Trigger`` class implementation (e.g. ``ahriman.core.report.ReportTrigger ahriman.core.upload.UploadTrigger``) which will be loaded and run at the end of processing, space separated list of strings, optional. You can also specify triggers by their paths, e.g. ``/usr/lib/python3.10/site-packages/ahriman/core/report/report.py.ReportTrigger``. Triggers are run in the order of definition.
* ``triggers_known`` - optional list of ``ahriman.core.triggers.Trigger`` class implementations which are not run automatically and used only for trigger discovery and configuration validation.
@@ -207,7 +203,7 @@ Web server settings. This feature requires ``aiohttp`` libraries to be installed
Describes settings for packages archives management extensions.
* ``keep_built_packages`` - keep this amount of additional built package versions alongside the version currently published in the repository, integer, required. ``0`` will effectively disable archives removal.
* ``keep_built_packages`` - keep this amount of built packages with different versions, integer, required. ``0`` will effectively disable archives removal.
``keyring`` group
-----------------
+8 -12
View File
@@ -22,12 +22,6 @@ In order to make data available outside of container, you would need to mount lo
docker run --privileged -v /path/to/local/repo:/var/lib/ahriman -v /path/to/overrides/overrides.ini:/etc/ahriman.ini.d/10-overrides.ini arcan1s/ahriman:latest
The volume must have correct rights, e.g.:
.. code-block:: shell
chown 643:643 /path/to/local/repo
The action can be specified during run, e.g.:
.. code-block:: shell
@@ -65,17 +59,19 @@ The following environment variables are supported:
* ``AHRIMAN_ARCHITECTURE`` - architecture of the repository, default is ``x86_64``.
* ``AHRIMAN_DEBUG`` - if set all commands will be logged to console.
* ``AHRIMAN_FORCE_ROOT`` - force run ahriman as root instead of guessing by subcommand.
* ``AHRIMAN_HOST`` - host for the web interface, default is ``0.0.0.0``.
* ``AHRIMAN_MULTILIB`` - if set (default) multilib repository will be used, disabled otherwise.
* ``AHRIMAN_OUTPUT`` - controls logging handler, e.g. ``syslog``, ``console``. The name must be found in logging configuration. Note that if ``syslog`` handler is used you will need to mount ``/dev/log`` inside container because it is not available there.
* ``AHRIMAN_PACKAGER`` - packager name from which packages will be built, default is ``ahriman bot <ahriman@example.com>``.
* ``AHRIMAN_PACMAN_MIRROR`` - override pacman mirror server if set.
* ``AHRIMAN_PORT`` - HTTP server port if any, default is empty.
* ``AHRIMAN_POSTSETUP_COMMAND`` - if set, the command which will be called after the setup command, but before any other actions.
* ``AHRIMAN_PRESETUP_COMMAND`` - if set, the command which will be called right before the setup command.
* ``AHRIMAN_POSTSETUP_COMMAND`` - if set, the command which will be called (as root) after the setup command, but before any other actions.
* ``AHRIMAN_PRESETUP_COMMAND`` - if set, the command which will be called (as root) right before the setup command.
* ``AHRIMAN_REPOSITORY`` - repository name, default is ``aur``.
* ``AHRIMAN_REPOSITORY_SERVER`` - optional override for the repository URL. Useful if you would like to download packages from remote instead of local filesystem.
* ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside repository root directory (e.g. ``/var/lib/ahriman/ahriman-web.sock``) or to ``/run/ahriman``.
* ``AHRIMAN_REPOSITORY_ROOT`` - repository root. Because of filesystem rights it is required to override default repository root. By default, it uses ``ahriman`` directory inside ahriman's home, which can be passed as mount volume.
* ``AHRIMAN_UNIX_SOCKET`` - full path to unix socket which is used by web server, default is empty. Note that more likely you would like to put it inside ``AHRIMAN_REPOSITORY_ROOT`` directory (e.g. ``/var/lib/ahriman/ahriman/ahriman-web.sock``) or to ``/run/ahriman``.
* ``AHRIMAN_USER`` - ahriman user, usually must not be overwritten, default is ``ahriman``.
* ``AHRIMAN_VALIDATE_CONFIGURATION`` - if set (default) validate service configuration.
@@ -103,7 +99,7 @@ For that you would need to have web container instance running forever; it can b
.. code-block:: shell
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman-web.sock -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman/ahriman-web.sock -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
Note about ``AHRIMAN_PORT`` environment variable which is required in order to enable web service. An additional port bind by ``-p 8080:8080`` is required to pass docker port outside of container.
@@ -113,7 +109,7 @@ If you are using ``AHRIMAN_UNIX_SOCKET`` variable, for every next container run
.. code-block:: shell
docker run --privileged -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman-web.sock -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
docker run --privileged -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman/ahriman-web.sock -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
Otherwise, you would need to pass ``AHRIMAN_PORT`` and mount container network to the host system (``--net=host``), e.g.:
@@ -132,7 +128,7 @@ In order to create configuration for additional repositories, the ``AHRIMAN_POST
.. code-block:: shell
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman-web.sock -e AHRIMAN_POSTSETUP_COMMAND="ahriman --architecture x86_64 --repository aur-v2 service-setup --build-as-user ahriman --packager 'ahriman bot <ahriman@example.com>'" -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
docker run --privileged -p 8080:8080 -e AHRIMAN_PORT=8080 -e AHRIMAN_UNIX_SOCKET=/var/lib/ahriman/ahriman/ahriman-web.sock -e AHRIMAN_POSTSETUP_COMMAND="ahriman --architecture x86_64 --repository aur-v2 service-setup --build-as-user ahriman --packager 'ahriman bot <ahriman@example.com>'" -v /path/to/local/repo:/var/lib/ahriman arcan1s/ahriman:latest
The command above will also create configuration for the repository named ``aur-v2``.
-11
View File
@@ -55,13 +55,6 @@ There are two possible ways to achieve same setup, by using docker container. Th
FROM arcan1s/ahriman:latest
#.
Switch to ``root`` user:
.. code-block:: dockerfile
USER root
#.
Init pacman keys. This command is required in order to populate distribution keys:
@@ -85,16 +78,12 @@ There are two possible ways to achieve same setup, by using docker container. Th
FROM arcan1s/ahriman:latest
USER root
RUN pacman-key --init
RUN pacman --noconfirm -Sy wget
RUN wget https://pool.mirror.archlinux32.org/i686/extra/devtools-20221208-1.2-any.pkg.tar.zst && pacman --noconfirm -U devtools-20221208-1.2-any.pkg.tar.zst
RUN wget https://pool.mirror.archlinux32.org/i686/core/archlinux32-keyring-20230705-1.0-any.pkg.tar.zst && pacman --noconfirm -U archlinux32-keyring-20230705-1.0-any.pkg.tar.zst
USER ahriman
#.
After that you can build you own container, e.g.:
-56
View File
@@ -1,56 +0,0 @@
To 2.22.0
---------
This release stores newly generated configuration files in the repository root and changes the docker image to run as the ``ahriman`` user. Existing system-wide configuration files remain supported, so regular installations do not require manual intervention. Docker installations require data migration.
Regular installation
^^^^^^^^^^^^^^^^^^^^
Newly generated ahriman and devtools configuration files are stored below ``/var/lib/ahriman/.config/ahriman`` instead of system-wide configuration directories. Existing configurations continue to work without any changes.
However, it is recommended to migrate to the new configuration schema by doing the following steps:
#.
Stop all ahriman services.
#.
Remove the old generated configuration files. For example, for repository ``aur`` and architecture ``x86_64``:
.. code-block:: shell
sudo rm /etc/ahriman.ini.d/00-setup-overrides-x86_64-aur.ini
sudo rm /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
Repeat this step for every configured repository. Do not remove manually maintained configuration overrides.
#.
Run setup command (i.e. ``ahriman service-setup``) again with the same arguments as used before as the ``ahriman`` user.
#.
Start the services again.
Docker installation
^^^^^^^^^^^^^^^^^^^
The repository root inside the Docker image has changed from ``/var/lib/ahriman/ahriman`` to ``/var/lib/ahriman``. Existing repository contents must therefore be moved one directory level up, and the volume must be owned by the ``ahriman`` user.
#.
Stop all containers using the repository volume and create a backup.
#.
Run a one-off container which mounts the existing volume. Replace ``VOLUME`` with the named volume or bind mount used by the installation:
.. code-block:: shell
docker run --rm --user root --entrypoint bash \
--volume VOLUME:/var/lib/ahriman \
arcan1s/ahriman:latest \
-c 'find /var/lib/ahriman/ahriman -mindepth 1 -maxdepth 1 -exec mv -t /var/lib/ahriman -- {} + && rmdir /var/lib/ahriman/ahriman && chown ahriman:ahriman /var/lib/ahriman'
#.
Update custom configuration and container arguments which refer to ``/var/lib/ahriman/ahriman``. The new path is ``/var/lib/ahriman``.
#.
Start the containers again.
Please note, that some environment variables - ``AHRIMAN_FORCE_ROOT`` and ``AHRIMAN_REPOSITORY_ROOT`` - have been also removed and not supported anymore. ``AHRIMAN_POSTSETUP_COMMAND`` and ``AHRIMAN_PRESETUP_COMMAND`` are now executed as non-root user.
-1
View File
@@ -12,4 +12,3 @@ Upgrades to breakpoints
2.9.0
2.12.0
2.16.0
2.22.0
Loaded 100 of 141 files, more files were not shown because too many files have changed in this diff. Show more