Compare commits

..
29 Commits
Author SHA1 Message Date
arcanis 0e7e2a9128 Release 2.23.0 2026-10-20 00:28:44 +03:00
arcanis bb1fb86036 fix: fix docker build with new dependencies 2026-10-20 00:00:40 +03:00
arcanis 6e7651a176 fix: handle version subcommand correctly
After package split it was looking for metapackage and lookup was broken
because it doesn't contain any python metadata
2026-10-19 23:26:23 +03:00
arcanis 9e5468313e feat: migrate pkgbuild parser to tree-sitter (#168) 2026-10-19 23:10:58 +03:00
arcanis 9b65e01d2f feat: show notification on hold action 2026-10-19 10:22:42 +03:00
arcanis 7f28e47ac4 fix: add files to git with force flag
It has been reported that AUR repositories might contain .gitignore,
which prevents PKGBUILD/.SRCINFO/whatever to be added without --force
flag. This commit simply adds force flag for all those operations, which
should be fine, because we don't commit wildcards

Closes #167
2026-10-17 12:17:40 +03:00
arcanis 0b371b3e77 feat: add tooltip for held packages 2026-10-16 13:09:17 +03:00
arcanis ef47c6fa72 feat: distinguish between repo update and package update in ui 2026-10-16 13:03:48 +03:00
arcanis 81ea175034 bug: always keep existing package version in archive 2026-10-16 12:11:51 +03:00
arcanis b73be7abcc feat: only remove packages from build queue which were actually built 2026-10-16 11:49:52 +03:00
arcanis 4537969d5d fix: handle is_held flag in all update processes
Previos implementation has ignored this flag in dependencies checks,
local package update and so on
2026-10-14 13:44:37 +03:00
arcanis 47c39f93b7 feat: align tables vertically in center 2026-10-13 13:22:00 +03:00
arcanis 3ac5f13f18 Release 2.22.2 2026-10-13 12:44:51 +03:00
arcanis e20deea1dd fix: fix typescript dependencies 2026-10-13 12:11:29 +03:00
arcanis 118ffdffe5 fix: update event bus for the last aiohttp-sse api change 2026-10-13 11:21:24 +03:00
arcanis 19ca1ac797 feat: detect dependencies resolution error 2026-10-13 10:31:11 +03:00
arcanis 16afb50c19 feat: add update and remove buttons to the status table 2026-09-23 16:04:42 +03:00
arcanis 23c834e186 refactor: drop enum_values helper, use direct cast to tuple instead 2026-09-21 11:40:38 +03:00
arcanis cd374dfbdf docs: update contributing guide 2026-08-18 15:13:41 +03:00
arcanis 25ecefab83 Release 2.22.1 2026-08-18 12:15:35 +03:00
arcanis b0248ed1cd refactor: split include option 2026-08-18 12:15:05 +03:00
arcanis 5d27fb1248 Release 2.22.0 2026-08-18 11:57:10 +03:00
arcanis 0faf3910c6 refactor: shell script simplification 2026-08-18 11:40:30 +03:00
arcanis fc520de146 docs: mention environment variables change in migration 2026-08-18 11:10:05 +03:00
arcanis c640239f8a build: move toxfile to tools packages 2026-08-18 01:22:18 +03:00
arcanis 024b6a014f build: update frontend dependencies 2026-08-17 13:44:40 +03:00
arcanis e12e844312 build: remove unused backslashes 2026-08-17 13:22:51 +03:00
arcanis eaac507d12 feat: limit environment variables passed to sudo 2026-08-17 12:26:56 +03:00
arcanis 117db10932 docs: update setup instructions to follow new logic 2026-08-17 12:13:46 +03:00
62 changed files with 2456 additions and 2478 deletions

No files matched your search

+4 -4
View File
@@ -10,15 +10,15 @@ echo -e '[arcanisrepo]\nServer = https://repo.arcanis.me/$arch\nSigLevel = Never
# refresh the image
pacman -Syyu --noconfirm
# main dependencies
pacman -S --noconfirm devtools git npm pyalpm python-bcrypt python-filelock python-inflection python-pyelftools python-requests python-systemd sudo
pacman -S --noconfirm --asdeps devtools git pyalpm python-bcrypt python-filelock python-inflection python-pyelftools python-requests python-tree-sitter python-tree-sitter-bash
# make dependencies
pacman -S --noconfirm --asdeps base-devel python-build python-hatchling python-installer python-tox python-wheel
pacman -S --noconfirm --asdeps base-devel npm python-build python-hatchling python-installer python-tox python-wheel
# optional dependencies
if [[ -z $MINIMAL_INSTALL ]]; then
# web server
pacman -S --noconfirm python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-aiohttp-sse-git python-cryptography python-jinja
pacman -S --noconfirm --asdeps python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-aiohttp-sse-git python-cryptography python-jinja
# additional features
pacman -S --noconfirm gnupg ipython python-boto3 python-cerberus python-matplotlib rsync
pacman -S --noconfirm --asdeps gnupg ipython python-boto3 python-cerberus python-matplotlib python-systemd rsync
fi
# FIXME since 1.0.4 devtools requires dbus to be run, which doesn't work now in container
cp "docker/systemd-nspawn.sh" "/usr/local/bin/systemd-nspawn"
+7 -1
View File
@@ -247,13 +247,19 @@ 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.
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.
### Hotfixes policy
+15 -10
View File
@@ -8,7 +8,6 @@ usage() {
echo " -r <repository> Repository name"
echo " -a <architecture> Repository architecture"
echo " -c <directory> Read devtools pacman configurations from this directory"
exit 1
}
repository=
@@ -20,12 +19,18 @@ while getopts ":r:a:c:" arg; do
r) repository="$OPTARG" ;;
a) architecture="$OPTARG" ;;
c) pacman_config_dir="$OPTARG" ;;
*) usage ;;
*) usage >&2; exit 1 ;;
esac
done
if [[ -z $repository || -z $architecture ]]; then
usage
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"
@@ -35,13 +40,13 @@ check_root "SOURCE_DATE_EPOCH,SRCDEST,SRCPKGDEST,PKGDEST,LOGDEST,NPROC,MAKEFLAGS
# 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 -e -c '
mount --bind "$0" /usr/share/devtools/pacman.conf.d
exec "$@"
' "$(readlink -f "$pacman_config_dir")" "${BASH_SOURCE[0]}" "$@"
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 "$1" "${@:2}"
' "${repository}-${architecture}-build" "archbuild" "${@:$OPTIND}"
exec bash -c 'source "/usr/bin/archbuild" "$@"' \
"${repository}-${architecture}-build" "${@:$OPTIND}"
@@ -1,6 +1,7 @@
[settings]
; Relative path to directory with configuration files overrides. Overrides will be applied in alphabetic order.
include = ahriman.ini.d ${repository:root}/.config/ahriman/ahriman.ini.d
include[] = ahriman.ini.d
include[] = ${repository:root}/.config/ahriman/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.
@@ -1,140 +1,134 @@
# AUTOMATICALLY GENERATED by `shtab`
# 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
_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-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_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' '-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_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_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_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_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_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
@@ -157,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
@@ -223,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
@@ -291,7 +285,7 @@ _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
@@ -302,7 +296,7 @@ _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=+
@@ -349,7 +343,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
@@ -442,7 +436,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
@@ -453,10 +447,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
@@ -533,8 +527,6 @@ _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
@@ -547,12 +539,10 @@ _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_shell__v_nargs=0
_shtab_ahriman_shell___verbose_nargs=0
_shtab_ahriman_sign_pos_0_nargs=*
_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
@@ -560,12 +550,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
@@ -603,6 +593,17 @@ _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]
@@ -630,7 +631,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
@@ -680,7 +681,7 @@ _shtab_ahriman() {
local prefix=_shtab_ahriman
local word_index=0
local pos_only=0 # "--" delimeter not encountered yet
local pos_only=0 # "--" delimiter not encountered yet
_set_parser_defaults
word_index=1
@@ -690,13 +691,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
@@ -710,10 +711,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 # "--" delimeter encountered
pos_only=1 # "--" delimiter encountered
fi
let "word_index+=1"
@@ -721,23 +722,32 @@ _shtab_ahriman() {
# Generate the completions
if [[ $pos_only = 0 && "${completing_word}" == -* ]]; then
COMPREPLY=()
if [[ $pos_only = 0 && "$completing_word" == -* &&
( -z "$current_action_compgen" || "$current_action_is_positional" = true ) ]]; then
# optional argument started: use option strings
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
elif [[ "${previous_word}" == ">" || "${previous_word}" == ">>" ||
"${previous_word}" =~ ^[12]">" || "${previous_word}" =~ ^[12]">>" ]]; then
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(
compgen -W "${current_option_strings[*]}" -- "$completing_word")
elif [[ "$previous_word" =~ ^[0-9\&]*[\<\>]\>?$ ]]; then
# handle redirection operators
COMPREPLY=( $(compgen -f -- "${completing_word}") )
compopt -o filenames 2>/dev/null || : # bash>=4
while IFS= read -r line; do COMPREPLY+=("$line"); done < <(compgen -f -- "$completing_word")
else
# use choices & compgen
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}") )
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")
fi
return 0
}
complete -o filenames -F _shtab_ahriman ahriman
complete -F _shtab_ahriman ahriman
@@ -1,4 +1,4 @@
.TH AHRIMAN "1" "2026\-07\-21" "ahriman 2.21.1" "ArcH linux ReposItory MANager"
.TH AHRIMAN "1" "2026\-10\-20" "ahriman 2.23.0" "ArcH linux ReposItory MANager"
.SH NAME
ahriman \- ArcH linux ReposItory MANager
.SH SYNOPSIS
@@ -990,7 +990,7 @@ usage: ahriman service\-setup [\-h] [\-\-build\-as\-user BUILD_AS_USER] [\-\-fro
[\-\-sign\-key SIGN_KEY] [\-\-sign\-target {disabled,packages,repository}] [\-\-web\-port WEB_PORT]
[\-\-web\-unix\-socket WEB_UNIX_SOCKET]
create initial service configuration, requires root
create initial service configuration as the repository owner
.SH OPTIONS \fI\,'ahriman service\-setup'\/\fR
.TP
@@ -1,92 +1,97 @@
#compdef ahriman
# AUTOMATICALLY GENERATED by `shtab`
# 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
_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, 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-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, 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"
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'
)
_describe 'ahriman commands' _commands
}
@@ -99,7 +104,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:"
{--report,--no-report}"[force enable or disable reporting to web service (default\: True)]"
{-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]"
@@ -111,10 +116,10 @@ _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)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{-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:"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{-n,--now}"[run update function after (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:"
@@ -129,7 +134,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:"
{--info,--no-info}"[show additional package information (default\: False)]"
"--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:"
)
@@ -139,10 +144,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)]: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:"
{--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)]"
{-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:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-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):"
)
@@ -152,11 +157,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)]: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:"
{--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)]"
)
# guard to ensure default positional specs are added only once per session
@@ -164,8 +169,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)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -195,17 +200,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)]: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:"
{--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)]"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{--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:"
{--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)]"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
)
@@ -247,10 +252,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)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
{--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)]"
"--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:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
"--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:"
@@ -273,10 +278,10 @@ _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)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{-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:"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{-n,--now}"[run update function after (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:"
@@ -291,7 +296,7 @@ _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)]:info:"
{--info,--no-info}"[show additional package information (default\: False)]"
":package base:"
)
@@ -361,7 +366,7 @@ _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)]:hold:"
{--hold,--no-hold}"[hold package afterwards (default\: True)]"
{-u,--username}"[build as user (default\: None)]:username:"
":package base:"
":package version:"
@@ -374,7 +379,7 @@ _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:"
{--info,--no-info}"[show additional package information (default\: False)]"
{-s,--status}"[filter packages by status (default\: None)]:status:(unknown pending building failed success)"
"(*)::filter status by package base (default\: None):"
)
@@ -409,10 +414,10 @@ _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)]:changes:"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]:dependencies:"
{--changes,--no-changes}"[calculate changes from the latest known commit if available (default\: True)]"
{--dependencies,--no-dependencies}"[process missing package dependencies (default\: True)]"
{-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:"
{--increment,--no-increment}"[increment package release (pkgrel) version on duplicate (default\: True)]"
{-n,--now}"[run update function after (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:"
@@ -467,7 +472,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:"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{-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:"
@@ -502,10 +507,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)]: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:"
{--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)]"
{-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:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-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):"
)
@@ -515,11 +520,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)]: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:"
{--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)]"
)
# guard to ensure default positional specs are added only once per session
@@ -527,8 +532,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)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -561,17 +566,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)]: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:"
{--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)]"
"--dry-run[just perform check for updates, same as check command (default\: False)]"
{--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:"
{--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)]"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-y,--refresh}"[download fresh package databases from the mirror before actions, -yy to force refresh even if up to date (default\: False)]"
)
@@ -582,10 +587,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)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
{--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)]"
"--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:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
"--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:"
@@ -602,7 +607,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:"
{--increment,--no-increment}"[increment package release (pkgrel) on duplicate (default\: True)]"
{-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:"
@@ -639,10 +644,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)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
{--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)]"
"--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:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
"--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:"
@@ -709,17 +714,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)]: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:"
{--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)]"
"--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)]: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:"
{--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)]"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-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):"
)
@@ -745,7 +750,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:"
{--info,--no-info}"[show additional package information (default\: False)]"
"--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:"
)
@@ -755,11 +760,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)]: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:"
{--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)]"
)
# guard to ensure default positional specs are added only once per session
@@ -767,8 +772,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)]:info:"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]:secure:"
{--info,--no-info}"[show additional information, e.g. configuration files (default\: True)]"
{--secure,--no-secure}"[hide passwords and secrets from output (default\: True)]"
":filter settings by section (default\: None):"
":filter settings by key (default\: None):"
)
@@ -795,7 +800,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:"
{--id-only,--no-id-only}"[show machine readable identifier instead (default\: False)]"
)
# guard to ensure default positional specs are added only once per session
@@ -813,10 +818,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)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
{--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)]"
"--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:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
"--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:"
@@ -848,10 +853,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)]:generate_salt:"
{--makeflags-jobs,--no-makeflags-jobs}"[append MAKEFLAGS variable with parallelism set to number of cores (default\: True)]:makeflags_jobs:"
{--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)]"
"--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:"
{--multilib,--no-multilib}"[add or do not multilib repository (default\: True)]"
"--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:"
@@ -884,7 +889,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:"
{--info,--no-info}"[show additional package information (default\: False)]"
{-s,--status}"[filter packages by status (default\: None)]:status:(unknown pending building failed success)"
"(*)::filter status by package base (default\: None):"
)
@@ -910,17 +915,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)]: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:"
{--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)]"
"--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)]: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:"
{--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)]"
{-u,--username}"[build as user (default\: None)]:username:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]:vcs:"
{--vcs,--no-vcs}"[fetch actual version of VCS packages (default\: True)]"
"*"{-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):"
)
@@ -981,7 +986,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
+2
View File
@@ -12,6 +12,8 @@ dependencies = [
"inflection",
"pyelftools",
"requests",
"tree-sitter",
"tree-sitter-bash",
]
description = "ArcH linux ReposItory MANager, core package"
dynamic = [
+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.21.1"
__version__ = "2.23.0"
@@ -28,7 +28,6 @@ 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
@@ -75,7 +74,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=enum_values(LogHandler))
type=LogHandler, choices=tuple(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)
@@ -158,6 +158,8 @@ 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)
@@ -172,6 +174,8 @@ 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 enum_values, extract_user
from ahriman.core.utils import 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=enum_values(PackageSource), default=PackageSource.Auto)
type=PackageSource, choices=tuple(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 enum_values, extract_user
from ahriman.core.utils import 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=enum_values(BuildStatusEnum))
type=BuildStatusEnum, choices=tuple(BuildStatusEnum))
parser.add_argument("-u", "--username", help="build as user", default=extract_user())
return parser
@@ -29,7 +29,6 @@ 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.utils import enum_values
from ahriman.models.repository_id import RepositoryId
from ahriman.models.sign_settings import SignSettings
from ahriman.models.user import User
@@ -94,7 +93,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, requires root",
description="create initial service configuration as the repository owner",
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",
@@ -112,7 +111,7 @@ 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=enum_values(SignSettings))
type=SignSettings.from_option, choices=tuple(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)
@@ -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 enum_values, pretty_datetime
from ahriman.core.utils import 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=enum_values(EventType), default=EventType.PackageUpdated)
type=EventType, choices=tuple(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,7 +26,6 @@ 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
@@ -93,7 +92,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=enum_values(BuildStatusEnum))
type=BuildStatusEnum, choices=tuple(BuildStatusEnum))
parser.set_defaults(lock=None, quiet=True, report=False, unsafe=True)
return parser
@@ -22,7 +22,6 @@ 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
@@ -97,7 +96,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=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
type=BuildStatusEnum, choices=tuple(BuildStatusEnum), default=BuildStatusEnum.Success)
parser.set_defaults(action=Action.Update, lock=None, quiet=True, report=False, unsafe=True)
return parser
@@ -115,7 +114,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=enum_values(BuildStatusEnum), default=BuildStatusEnum.Success)
type=BuildStatusEnum, choices=tuple(BuildStatusEnum), default=BuildStatusEnum.Success)
parser.set_defaults(action=Action.Update, lock=None, package=[], quiet=True, report=False, unsafe=True)
return parser
@@ -25,7 +25,6 @@ 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
@@ -89,7 +88,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=enum_values(UserAccess), default=UserAccess.Read)
type=UserAccess, choices=tuple(UserAccess), default=UserAccess.Read)
parser.set_defaults(action=Action.Update, architecture="", exit_code=False, lock=None, quiet=True,
report=False, repository="")
return parser
@@ -110,8 +109,7 @@ 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=enum_values(UserAccess))
parser.add_argument("-R", "--role", help="filter users by role", type=UserAccess, choices=tuple(UserAccess))
parser.set_defaults(action=Action.List, architecture="", lock=None, quiet=True, report=False, repository="",
unsafe=True)
return parser
@@ -23,7 +23,6 @@ import sys
from collections.abc import Iterator
from importlib import metadata
from typing import ClassVar
from ahriman import __version__
from ahriman.application.handlers.handler import Handler, SubParserAction
@@ -35,13 +34,10 @@ from ahriman.models.repository_id import RepositoryId
class Versions(Handler):
"""
version handler
Attributes:
PEP423_PACKAGE_NAME(re.Pattern[str]): (class attribute) special regex for valid PEP423 package name
"""
ALLOW_MULTI_ARCHITECTURE_RUN = False # system-wide action
PEP423_PACKAGE_NAME: ClassVar[re.Pattern[str]] = re.compile(r"^[A-Za-z0-9._-]+")
_PEP423_PACKAGE_NAME = re.compile(r"^[A-Za-z0-9._-]+")
@classmethod
def run(cls, args: argparse.Namespace, repository_id: RepositoryId, configuration: Configuration, *,
@@ -57,7 +53,7 @@ class Versions(Handler):
"""
VersionPrinter(f"Module version {__version__}",
{"Python": sys.version})(verbose=False, separator=" ")
packages = Versions.package_dependencies("ahriman")
packages = Versions.package_dependencies("ahriman-core", "ahriman-triggers", "ahriman-web")
VersionPrinter("Installed packages", dict(packages))(verbose=False, separator=" ")
@staticmethod
@@ -77,15 +73,15 @@ class Versions(Handler):
return parser
@staticmethod
def package_dependencies(root: str) -> Iterator[tuple[str, str]]:
def package_dependencies(*roots: str) -> Iterator[tuple[str, str]]:
"""
extract list of ahriman package dependencies installed into system with their versions
extract installed root packages and their dependencies with their versions
Args:
root(str): root package name
*roots(str): root package names
Yields:
tuple[str, str]: map of installed dependency to its version
tuple[str, str]: map of installed package to its version
"""
def dependencies_by_key(key: str) -> Iterator[str]:
# in importlib it returns requires in the following format
@@ -95,10 +91,10 @@ class Versions(Handler):
except metadata.PackageNotFoundError:
return
for entry in requires or []:
yield from Versions.PEP423_PACKAGE_NAME.findall(entry)
yield from Versions._PEP423_PACKAGE_NAME.findall(entry)
keys: list[str] = []
portion = set(dependencies_by_key(root))
portion = set(roots)
while portion:
keys.extend(portion)
portion = {
@@ -17,355 +17,242 @@
# 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 typing import IO
from tree_sitter import Language, Node, Parser
from typing import IO, cast
from ahriman.core.exceptions import PkgbuildParserError
from ahriman.models.pkgbuild_patch import PkgbuildPatch
class PkgbuildToken(StrEnum):
class PkgbuildNodeType(StrEnum):
"""
well-known tokens dictionary
tree-sitter node types used by parser
Attributes:
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(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
"""
ArrayStarts = "("
ArrayEnds = ")"
Comma = ","
Comment = "#"
FunctionDeclaration = "()"
FunctionStarts = "{"
FunctionEnds = "}"
NewLine = "\n"
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"
class PkgbuildParser(shlex.shlex):
class PkgbuildNodeField(StrEnum):
"""
simple pkgbuild reader implementation in pure python, because others suck.
tree-sitter node fields used by parser
What is it:
Attributes:
Body(PkgbuildNodeField): function body field
Name(PkgbuildNodeField): variable or function name field
Value(PkgbuildNodeField): assignment value field
"""
#. 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).
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.
What it is not:
#. Fully functional shell parser.
#. Shell executor.
#. No parameter expansion.
#. A shell executor.
#. A shell interpreter. Variable and command substitutions are returned as written.
For more details what does it support, please, consult with the test cases.
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.
Examples:
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.::
Parse package assignments::
>>> parser = PkgbuildParser(StringIO("input string"))
>>> for patch in parser.parse():
>>> print(f"{patch.key} = {patch.value}")
>>> source = b"pkgname=example\\npkgver=1\\n"
>>> for patch in 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).
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)
"""
_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>.+)$")
_BRACE_EXPANSION = re.compile(r"(.*)\{([^{}]+)\}(.*)")
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 = ""
def __init__(self, stream: IO[bytes]) -> None:
""""""
self._content = stream.read()
@staticmethod
def _expand_array(array: list[str]) -> list[str]:
def _expand_array(value: str, *, expand: bool = True) -> list[str]:
"""
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)``
expand comma-separated brace expressions in a value
Args:
array(list[str]): input array
value(str): value that may contain a brace expression
expand(bool, optional): whether brace expansion is allowed (Default value = True)
Returns:
list[str]: either source array or expanded array if possible
Raises:
PkgbuildParserError: if there are errors in parser
list[str]: expanded values if applicable
"""
# 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
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]
result = []
buffer, prefix = [], None
prefix, values, suffix = match.groups()
return [f"{prefix}{item}{suffix}" for item in values.split(",")]
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:
@staticmethod
def _text(node: Node) -> str:
"""
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:
bool: ``True`` if the previous element of the stream is a quote or escaped and ``False`` otherwise
"""
current_position = self._io.tell()
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]:
"""
parse array from the PKGBUILD. This method will extract tokens from parser until it matches closing array,
modifying source parser state
Returns:
list[str]: extracted arrays elements
Raises:
PkgbuildParserError: if array is not closed
"""
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
yield token
if token != PkgbuildToken.ArrayEnds:
raise PkgbuildParserError("no closing array bracket found")
return self._expand_array(list(extract()))
def _parse_function(self) -> str:
"""
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
read the original source text represented by a syntax tree node
Args:
token(str): current token
node(Node): syntax tree node to read
Returns:
str: source text for the node
"""
return cast(bytes, node.text).decode("utf8", errors="backslashreplace")
def _assignment(self, node: Node) -> PkgbuildPatch:
"""
convert an assignment node
Args:
node(Node): assignment node to convert
Returns:
PkgbuildPatch: parsed assignment
"""
name = cast(Node, node.child_by_field_name(PkgbuildNodeField.Name))
value = cast(Node, node.child_by_field_name(PkgbuildNodeField.Value))
key = self._text(name)
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_array(item, expand=element.type == PkgbuildNodeType.Concatenation)
array_values.extend(values)
return PkgbuildPatch(key, array_values)
case _:
return PkgbuildPatch(key, self._value(value))
def _read(self, node: Node) -> Iterator[PkgbuildPatch]:
"""
find assignments and functions in a syntax tree node
Args:
node(Node): syntax tree node to inspect
Yields:
PkgbuildPatch: extracted a PKGBUILD node
PkgbuildPatch: parsed entries
"""
# simple assignment rule
if m := self._STRING_ASSIGNMENT.match(token):
key = m.group("key")
value = m.group("value")
yield PkgbuildPatch(key, value)
return
match node.type:
case PkgbuildNodeType.VariableAssignment if not any(child.type == PkgbuildNodeType.Append for child in node.children):
yield self._assignment(node)
if token.startswith(PkgbuildToken.Comment):
self._read_comment()
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))
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)
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)
# 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:
def _value(self, node: Node) -> str:
"""
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
extract a string value from a syntax tree node
Args:
initial_index(int | None, optional): initial index to start reading from. If none set, the previous position
will be used (Default value = None)
node(Node): syntax tree node to extract
Returns:
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
str: extracted string value
"""
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)
if node.type in (PkgbuildNodeType.Concatenation, PkgbuildNodeType.String):
return "".join(self._value(child) for child in node.named_children)
while (position := self._io.tell()) > 0:
try:
return position, self._io.read(1)
except UnicodeDecodeError:
self._io.seek(position - 1)
value = self._text(node)
match node.type:
case PkgbuildNodeType.StringContent:
value = f'"{value}"'
case PkgbuildNodeType.Number | PkgbuildNodeType.RawString | PkgbuildNodeType.Word:
pass
case _:
return value
raise PkgbuildParserError("reached starting position, no valid symbols found")
return "".join(shlex.split(value, comments=False, posix=True))
def parse(self) -> Iterator[PkgbuildPatch]:
"""
parse source stream and yield parsed entries
parse source and yield extracted entries
Yields:
PkgbuildPatch: extracted a PKGBUILD node
PkgbuildPatch: parsed entries
Raises:
PkgbuildParserError: source contains invalid shell syntax
"""
for token in self:
yield from self._parse_token(token)
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)
@@ -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)
instance.add(sources_dir, *files, force=True)
# ...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) -> None:
def add(self, sources_dir: Path, *pattern: str, intent_to_add: bool = False, force: bool = False) -> None:
"""
track found files via git
@@ -241,6 +241,7 @@ 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] = []
@@ -251,6 +252,8 @@ 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)
+11 -6
View File
@@ -83,6 +83,15 @@ 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
@@ -229,16 +238,12 @@ class PkgbuildParserError(ValueError):
exception raises in case of PKGBUILD parser errors
"""
def __init__(self, reason: str, source: Any = None) -> None:
def __init__(self, reason: str) -> None:
"""
Args:
reason(str): parser error reason
source(Any, optional): source line if available (Default value = None)
"""
message = f"Could not parse PKGBUILD: {reason}"
if source is not None:
message += f", source: `{source}`"
ValueError.__init__(self, message)
ValueError.__init__(self, f"Could not parse PKGBUILD: {reason}")
class PasswordError(ValueError):
@@ -87,7 +87,12 @@ class ArchiveRotationTrigger(Trigger):
if self.keep_built_packages == 0:
return
to_remove = repository.package_archives(package.base)
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
]
for single in to_remove[:-self.keep_built_packages]:
self.logger.info("removing version %s of package %s", single.version, single.base)
@@ -36,6 +36,17 @@ 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
@@ -58,9 +69,7 @@ class UpdateHandler(PackageInfo, Cleaner):
continue
raise UnknownPackageError(package.base)
ignore_list = self._ignore_list + [
package.base for package, status in self.reporter.package_get(None) if status.is_held
]
ignore_list = self._updates_ignored()
result: list[Package] = []
for local in self.packages(filter_packages):
@@ -106,8 +115,13 @@ 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
@@ -141,9 +155,13 @@ 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(
@@ -162,6 +180,9 @@ 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)
@@ -191,7 +212,6 @@ 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")
+6 -1
View File
@@ -22,7 +22,7 @@ from __future__ import annotations
from collections.abc import Iterable
from functools import partial
from ahriman.core.exceptions import PartitionError
from ahriman.core.exceptions import DependencyResolutionError, PartitionError
from ahriman.core.utils import minmax, partition
from ahriman.models.package import Package
@@ -226,6 +226,9 @@ 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]] = []
@@ -235,6 +238,8 @@ 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,7 +31,6 @@ 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
@@ -46,7 +45,6 @@ __all__ = [
"check_output",
"check_user",
"dataclass_view",
"enum_values",
"extract_user",
"filelock",
"filter_json",
@@ -242,19 +240,6 @@ 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
+11 -25
View File
@@ -19,12 +19,12 @@
#
from collections.abc import Iterator, Mapping
from dataclasses import dataclass
from io import StringIO
from io import BytesIO
from pathlib import Path
from typing import Any, ClassVar, IO, Self
from typing import Any, IO, Self
from urllib.parse import urlparse
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser, PkgbuildToken
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser
from ahriman.core.utils import srcinfo_property_list
from ahriman.models.pkgbuild_patch import PkgbuildPatch
@@ -35,14 +35,11 @@ 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]:
"""
@@ -59,37 +56,26 @@ class Pkgbuild(Mapping[str, Any]):
}
@classmethod
def from_file(cls, path: Path, encoding: str | None = None) -> Self:
def from_file(cls, path: Path) -> 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:
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)
return cls.from_io(input_file)
@classmethod
def from_io(cls, stream: IO[str]) -> Self:
def from_io(cls, stream: IO[bytes]) -> Self:
"""
parse PKGBUILD from input stream
Args:
stream(IO[str]): input stream containing PKGBUILD content
stream(IO[bytes]): input stream containing PKGBUILD content
Returns:
Self: constructed instance of self
@@ -162,10 +148,10 @@ class Pkgbuild(Mapping[str, Any]):
"""
packages = [self["pkgname"]] if isinstance(self["pkgname"], str) else self["pkgname"]
def io(package_name: str) -> IO[str]:
def io(package_name: str) -> IO[bytes]:
# try to read package specific function and fallback to default otherwise
content = self.get(f"package_{package_name}") or self.get("package") or ""
return StringIO(content)
return BytesIO(content.encode("utf8"))
return {package: self.from_io(io(package)) for package in packages}
@@ -185,8 +171,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(PkgbuildToken.FunctionDeclaration):
value = self.fields.get(f"{item}{PkgbuildToken.FunctionDeclaration}")
if value is None and not item.endswith("()"):
value = self.fields.get(f"{item}()")
# if we still didn't find anything, we can just raise the exception
if value is None:
@@ -188,6 +188,7 @@ 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()
@@ -207,12 +208,15 @@ 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",
@@ -224,6 +228,8 @@ 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:
@@ -17,7 +17,7 @@ def test_run(args: argparse.Namespace, configuration: Configuration, mocker: Moc
_, repository_id = configuration.check_loaded()
Versions.run(args, repository_id, configuration, report=False)
application_mock.assert_called_once_with("ahriman")
application_mock.assert_called_once_with("ahriman-core", "ahriman-triggers", "ahriman-web")
print_mock.assert_has_calls([
MockCall(verbose=False, log_fn=pytest.helpers.anyvar(int), separator=" "),
MockCall(verbose=False, log_fn=pytest.helpers.anyvar(int), separator=" "),
@@ -37,7 +37,7 @@ def test_package_dependencies_missing() -> None:
"""
must extract package dependencies even if some of them are missing
"""
packages = dict(Versions.package_dependencies("ahriman"))
packages = dict(Versions.package_dependencies("ahriman-core"))
assert packages
assert packages.get("pyalpm") is not None
assert packages.get("Sphinx") is None
@@ -1,6 +1,6 @@
import pytest
from io import StringIO
from io import BytesIO
from pathlib import Path
from ahriman.core.alpm.pkgbuild_parser import PkgbuildParser
@@ -12,60 +12,46 @@ 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"
]
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"])]
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()
parser = PkgbuildParser(BytesIO(b"""array=("prefix{first,second}suffix")"""))
assert list(parser.parse()) == [PkgbuildPatch("array", ["prefix{first,second}suffix"])]
def test_parse_array() -> None:
"""
must parse array
"""
parser = PkgbuildParser(StringIO("var=(first second)"))
parser = PkgbuildParser(BytesIO(b"var=(first second)"))
assert list(parser.parse()) == [PkgbuildPatch("var", ["first", "second"])]
def test_parse_array_escaped() -> 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(StringIO("""validpgpkeys=(
parser = PkgbuildParser(BytesIO(b"""validpgpkeys=(
'F3691687D867B81B51CE07D9BBE43771487328A9' # bpiotrowski@archlinux.org
'86CFFCA918CF3AF47147588051E8B148A9999C34' # evangelos@foutrelis.com
'13975A70E63C361C73AE69EF6EEB81F8981C74C7' # richard.guenther@gmail.com
@@ -79,28 +65,11 @@ 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(StringIO("var=(first second"))
parser = PkgbuildParser(BytesIO(b"var=(first second"))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
@@ -109,86 +78,75 @@ def test_parse_function() -> None:
"""
must parse function
"""
parser = PkgbuildParser(StringIO("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_eof() -> None:
"""
must parse function with "}" at the end of the file
"""
parser = PkgbuildParser(StringIO("var() { echo hello world }"))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world }")]
def test_parse_function_spaces() -> None:
"""
must parse function with spaces in declaration
"""
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(StringIO("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_escaped() -> None:
"""
must parse function with bracket in quotes
"""
parser = PkgbuildParser(StringIO("""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(StringIO("""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(StringIO("""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(StringIO("""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(StringIO("""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(StringIO("""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(StringIO("var() echo hello world } "))
parser = PkgbuildParser(BytesIO(b"var() echo hello world } "))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
parser = PkgbuildParser(StringIO("var() { echo hello world"))
parser = PkgbuildParser(BytesIO(b"var() { echo hello world"))
with pytest.raises(PkgbuildParserError):
assert list(parser.parse())
def test_parse_token_assignment() -> None:
def test_parse_function_inner_shell() -> None:
"""
must parse simple assignment
must parse function with inner shell
"""
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/-/_}")
parser = PkgbuildParser(BytesIO(b"var() { { echo hello world; }; } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ { echo hello world; }; }")]
def test_parse_function_spaces() -> None:
"""
must parse function with spaces before body
"""
parser = PkgbuildParser(BytesIO(b"var() { echo hello world; } "))
assert list(parser.parse()) == [PkgbuildPatch("var()", "{ echo hello world; }")]
def test_parse_token_comment() -> None:
"""
must correctly parse comment
"""
parser = PkgbuildParser(StringIO("""first=1 # comment
parser = PkgbuildParser(BytesIO(b"""first=1 # comment
# comment line
second=2
#third=3
@@ -199,58 +157,12 @@ 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(encoding="utf8") as content:
with pkgbuild.open("rb") as content:
parser = PkgbuildParser(content)
assert list(parser.parse()) == [
PkgbuildPatch("var", "value"),
@@ -277,53 +189,58 @@ def test_parse(resource_path_root: Path) -> None:
PkgbuildPatch("array", ["first", ")", "second"]),
PkgbuildPatch("array", ["first", "(", "second"]),
PkgbuildPatch("array", ["first", ")", "second"]),
PkgbuildPatch("function()", """{ single line }"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{ single line; }"""),
PkgbuildPatch("func()", """{
multi
line
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
c
multi
line
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
# comment
multi
line
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body
}"""),
PkgbuildPatch("function_with-package-name()", """{ body }"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("function_with-package-name()", """{ body; }"""),
PkgbuildPatch("func()", """{
first
{ inner shell }
{ inner shell; }
last
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body "{" argument
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body "}" argument
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body '{' argument
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
body '}' argument
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
# we don't care about unclosed quotation in comments
body # no, I said we really don't care
}"""),
PkgbuildPatch("function()", """{
PkgbuildPatch("func()", """{
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
}"""),
PkgbuildPatch("var", "value"),
PkgbuildPatch("array", ["first", "second", "third"]),
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)"
}"""),
]
@@ -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")
add_mock.assert_called_once_with(local, "PKGBUILD", ".SRCINFO", "local", force=True)
commit_mock.assert_called_once_with(local)
@@ -347,6 +347,17 @@ 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
@@ -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 remove older packages
must keep the current package and the configured amount of additional packages
"""
packages = []
for i in range(5):
for i in range(1, 7):
generated = replace(package_ahriman, version=str(i))
generated.packages = {
key: replace(value, filename=str(i))
@@ -33,14 +33,17 @@ 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", return_value=[Path(str(i)) for i in range(5)])
mocker.patch("pathlib.Path.glob", side_effect=lambda pattern: [Path(pattern.removesuffix("*"))])
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,6 +14,20 @@ 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:
"""
@@ -194,6 +208,18 @@ 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:
"""
@@ -249,6 +275,19 @@ 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:
"""
@@ -306,17 +345,32 @@ def test_updates_local_with_failures(update_handler: UpdateHandler, package_ahri
assert not update_handler.updates_local(vcs=True)
def test_updates_manual_clear(update_handler: UpdateHandler, mocker: MockerFixture) -> None:
def test_updates_local_held_metadata(update_handler: UpdateHandler, package_ahriman: Package,
mocker: MockerFixture) -> None:
"""
requesting manual updates must clear packages directory
must respect the held base even when the source directory has a different name
"""
mocker.patch("pathlib.Path.iterdir", return_value=[])
mocker.patch("ahriman.core.repository.update_handler.UpdateHandler.packages")
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)
update_handler.updates_manual()
assert update_handler.updates_local(vcs=True) == []
from ahriman.core.repository.cleaner import Cleaner
Cleaner.clear_queue.assert_called_once_with()
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]
def test_updates_manual_status_known(update_handler: UpdateHandler, package_ahriman: Package,
+12 -1
View File
@@ -1,6 +1,6 @@
import pytest
from ahriman.core.exceptions import PartitionError
from ahriman.core.exceptions import DependencyResolutionError, PartitionError
from ahriman.core.tree import Leaf, Tree
from ahriman.models.package import Package
from ahriman.models.package_description import PackageDescription
@@ -270,3 +270,14 @@ 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,15 +221,6 @@ 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, StringIO
from io import BytesIO
from pathlib import Path
from pytest_mock import MockerFixture
@@ -33,10 +33,11 @@ def test_from_file(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
def test_from_file_latin(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
"""
must correctly load from file with latin encoding
must correctly load bytes containing latin encoding
"""
open_mock = mocker.patch("pathlib.Path.open")
open_mock.return_value.__enter__.return_value = BytesIO("contént".encode("latin-1"))
mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_io", return_value=pkgbuild_ahriman)
load_mock = mocker.patch("ahriman.models.pkgbuild.Pkgbuild.from_io", return_value=pkgbuild_ahriman)
assert Pkgbuild.from_file(Path("local"))
@@ -50,7 +51,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(StringIO("mock")) == pkgbuild_ahriman
assert Pkgbuild.from_io(BytesIO(b"mock")) == pkgbuild_ahriman
load_mock.assert_called_once_with()
@@ -64,9 +65,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(StringIO("mock"))["pkgbase"] == pkgbuild_ahriman["pkgname"]
assert "pkgbase" not in Pkgbuild.from_io(StringIO("mock"))
assert Pkgbuild.from_io(StringIO("mock"))["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"
def test_from_io_empty(pkgbuild_ahriman: Pkgbuild, mocker: MockerFixture) -> None:
@@ -75,7 +76,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(StringIO("mock")) == pkgbuild_ahriman
assert Pkgbuild.from_io(BytesIO(b"mock")) == pkgbuild_ahriman
def test_local_files(mocker: MockerFixture, resource_path_root: Path) -> None:
@@ -567,7 +568,6 @@ 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",
@@ -87,7 +87,8 @@ class EventBusView(BaseView):
"""
while response.is_connected():
try:
event_type, data = await wait_for(queue.get(), timeout=response.ping_interval)
# pylint: disable=protected-access
event_type, data = await wait_for(queue.get(), timeout=response._ping_interval)
except TimeoutError:
continue
except QueueShutDown:
@@ -3,6 +3,7 @@ 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
@@ -95,21 +96,20 @@ def test_routes() -> None:
async def test_run_timeout() -> None:
"""
must handle timeout and continue loop
must recheck the connection after a queue timeout
"""
queue = Queue()
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]
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:
"""
+2 -2
View File
@@ -2,13 +2,13 @@
pkgbase='ahriman'
pkgname=('ahriman' 'ahriman-core' 'ahriman-triggers' 'ahriman-web')
pkgver=2.21.1
pkgver=2.23.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')
depends=('devtools>=1:1.0.0' 'git' 'pyalpm' 'python-bcrypt' 'python-filelock' 'python-inflection' 'python-pyelftools' 'python-requests' 'python-tree-sitter-bash')
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"
+2 -1
View File
@@ -1 +1,2 @@
ahriman ALL= NOPASSWD:SETENV: /usr/bin/ahriman-archbuild *
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 *
+4 -2
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" && \
@@ -60,7 +60,9 @@ RUN runuser -u build -- install-aur-package \
python-aiohttp-session \
python-aiohttp-security \
python-aiohttp-sse-git \
python-requests-unixsocket2
python-requests-unixsocket2 \
python-tree-sitter \
python-tree-sitter-bash
# install ahriman
## copy tree
+1412 -1418
View File
File diff suppressed because it is too large. Load diff
+10 -6
View File
@@ -257,6 +257,10 @@ 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
^^^^^^^^^^^^^^^
@@ -422,13 +426,13 @@ There are several supported synchronization providers, currently they are ``rsyn
PKGBUILD parsing
^^^^^^^^^^^^^^^^
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.
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.
#. 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.
#. 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.
All extracted fields are packed as ``ahriman.models.pkgbuild_patch.PkgbuildPatch`` and then can be used as ``ahriman.models.pkgbuild.Pkgbuild`` instance.
+1 -1
View File
@@ -207,7 +207,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 built packages with different versions, integer, required. ``0`` will effectively disable archives removal.
* ``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.
``keyring`` group
-----------------
+2
View File
@@ -52,3 +52,5 @@ The repository root inside the Docker image has changed from ``/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.
+18 -27
View File
@@ -10,41 +10,32 @@ Initial setup
.. code-block:: shell
sudo ahriman -a x86_64 -r aur service-setup ...
sudo -u ahriman -- ahriman -a x86_64 -r aur service-setup \
--packager "ahriman bot <ahriman@example.com>" ...
.. admonition:: Details
:collapsible: closed
``service-setup`` literally does the following steps:
``service-setup`` does the following steps:
#.
Create ``/var/lib/ahriman/.makepkg.conf`` with ``makepkg.conf`` overrides if required (at least you might want to set ``PACKAGER``):
.. code-block:: shell
echo 'PACKAGER="ahriman bot <ahriman@example.com>"' | sudo -u ahriman tee -a /var/lib/ahriman/.makepkg.conf
Create a repository-specific ahriman configuration below
``/var/lib/ahriman/.config/ahriman/ahriman.ini.d``. This configuration stores the
packager identity, ``MAKEFLAGS`` and other options supplied on the command line.
#.
Configure build tools (it is required for correct dependency management system):
Generate the devtools pacman configuration in
``/var/lib/ahriman/.config/ahriman/pacman.conf.d``. The file is based on the
configuration selected by ``--from-configuration`` and contains the requested mirror,
multilib settings and the ahriman repository path.
#.
Create configuration file ``{name}.conf`` or ``{name}-{arch}.conf``, where ``name`` is the repostory name and ``arch`` is the repository architecture, e.g.:
#.
Create the repository directories, initialize the package repository and synchronize
its pacman database.
.. code-block:: shell
cp /usr/share/devtools/pacman.conf.d/{extra,aur-x86_64}.conf
#.
Change configuration file, add your own repository, add multilib repository etc:
.. code-block:: shell
echo '[multilib]' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
echo 'Include = /etc/pacman.d/mirrorlist' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
echo '[aur]' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
echo 'SigLevel = Optional TrustAll' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
echo 'Server = file:///var/lib/ahriman/repository/$repo/$arch' | tee -a /usr/share/devtools/pacman.conf.d/aur-x86_64.conf
Both configuration locations are below the repository root and must be writable by the
user running ahriman. Existing system-wide overrides remain supported; see
:doc:`the 2.22.0 migration guide <migrations/2.22.0>` when upgrading.
This command supports several arguments, kindly refer to its help message.
@@ -53,14 +44,14 @@ Initial setup
.. code-block:: shell
systemctl enable --now ahriman@x86_64-aur.timer
sudo systemctl enable --now ahriman@x86_64-aur.timer
#.
Start and enable status page:
.. code-block:: shell
systemctl enable --now ahriman-web
sudo systemctl enable --now ahriman-web
#.
Add packages by using ``ahriman package-add {package}`` command:
+1 -1
View File
@@ -44,7 +44,7 @@ This trigger will be called right after build process (``on_result``). It will p
``ahriman.core.housekeeping.ArchiveRotationTrigger``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This trigger removes old package versions from the archive directory. It implements ``on_result`` and, after each build, compares available versions for updated packages and removes the older ones, keeping only the last N versions as configured by ``keep_built_packages`` option.
This trigger removes old package versions from the archive directory. It implements ``on_result`` and, after each build, compares available versions for updated packages and removes older ones, keeping the version currently published in the repository plus the last N other versions as configured by ``keep_built_packages`` option.
``ahriman.core.housekeeping.LogsRotationTrigger``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+15 -12
View File
@@ -2,34 +2,37 @@
"dependencies": {
"@emotion/react": ">=11.14.0 <11.15.0",
"@emotion/styled": ">=11.14.0 <11.15.0",
"@mui/icons-material": ">=9.2.0 <9.3.0",
"@mui/material": ">=9.2.0 <9.3.0",
"@mui/x-data-grid": ">=9.10.0 <9.11.0",
"@tanstack/react-query": ">=5.101.0 <5.102.0",
"@mui/icons-material": ">=9.5.0 <9.6.0",
"@mui/material": ">=9.5.0 <9.6.0",
"@mui/x-data-grid": ">=9.15.0 <9.16.0",
"@tanstack/react-query": ">=5.104.0 <5.105.0",
"chart.js": ">=4.5.0 <4.6.0",
"react": ">=19.2.0 <19.3.0",
"react": ">=19.3.0 <19.4.0",
"react-chartjs-2": ">=5.3.0 <5.4.0",
"react-dom": ">=19.2.0 <19.3.0",
"react-dom": ">=19.3.0 <19.4.0",
"react-error-boundary": ">=6.1.0 <6.2.0",
"react-syntax-highlighter": ">=16.1.0 <16.2.0"
},
"devDependencies": {
"@eslint/js": ">=9.39.0 <9.40.0",
"@stylistic/eslint-plugin": ">=5.10.0 <5.11.0",
"@types/react": ">=19.2.0 <19.3.0",
"@types/react-dom": ">=19.2.0 <19.3.0",
"@types/react": ">=19.3.0 <19.4.0",
"@types/react-dom": ">=19.3.0 <19.4.0",
"@types/react-syntax-highlighter": ">=15.5.0 <15.6.0",
"@vitejs/plugin-react": ">=6.0.0 <6.1.0",
"@vitejs/plugin-react": ">=6.1.0 <6.2.0",
"eslint": ">=9.39.0 <9.40.0",
"eslint-plugin-react": ">=7.37.0 <7.38.0",
"eslint-plugin-react-hooks": ">=7.1.0 <7.2.0",
"eslint-plugin-react-refresh": ">=0.5.0 <0.6.0",
"eslint-plugin-simple-import-sort": ">=14.0.0 <14.1.0",
"typescript": ">=6.0.0 <6.1.0",
"typescript-eslint": ">=8.64.0 <8.65.0",
"vite": ">=8.1.0 <8.2.0"
"typescript-eslint": ">=8.71.0 <8.72.0",
"vite": ">=8.3.0 <8.4.0"
},
"name": "ahriman",
"overrides": {
"@mui/x-internals": "$@mui/x-data-grid"
},
"private": true,
"scripts": {
"build": "tsc && vite build",
@@ -39,5 +42,5 @@
"preview": "vite preview"
},
"type": "module",
"version": "2.21.1"
"version": "2.23.0"
}
@@ -126,6 +126,7 @@ export default function PackageInfoDialog({
try {
const newHeldStatus = !(status?.is_held ?? false);
await client.service.servicePackageHold(localPackageBase, currentRepository, newHeldStatus);
showSuccess("Success", `Package ${newHeldStatus ? "held" : "unheld"}`);
void queryClient.invalidateQueries({ queryKey: QueryKeys.package(localPackageBase, currentRepository) });
} catch (exception) {
showError("Action failed", `Could not update hold status: ${ApiError.errorDetail(exception)}`);
+36 -6
View File
@@ -17,10 +17,13 @@
* 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 DeleteIcon from "@mui/icons-material/Delete";
import PlayArrowIcon from "@mui/icons-material/PlayArrow";
import { Box, Link } from "@mui/material";
import {
DataGrid,
GRID_CHECKBOX_SELECTION_COL_DEF,
GridActionsCellItem,
type GridColDef,
type GridFilterModel,
type GridRowId,
@@ -56,6 +59,7 @@ function createListColumn(
export default function PackageTable(): React.JSX.Element {
const table = usePackageTable();
const { handleRemove, handleUpdate, isAuthorized } = table;
const apiRef = useGridApiRef();
const debouncedSearch = useDebounce(table.searchText, 300);
@@ -96,8 +100,31 @@ export default function PackageTable(): React.JSX.Element {
<StatusCell isHeld={params.row.isHeld} status={params.row.status} />,
width: 120,
},
...isAuthorized ? [{
field: "actions",
type: "actions",
headerName: "actions",
width: 100,
disableExport: true,
getActions: ({ row }) => [
<GridActionsCellItem
key="update"
icon={<PlayArrowIcon />}
label={`Update ${row.base}`}
title={`Update ${row.base}`}
onClick={() => void handleUpdate([row.base])}
/>,
<GridActionsCellItem
key="remove"
icon={<DeleteIcon />}
label={`Remove ${row.base}`}
title={`Remove ${row.base}`}
onClick={() => void handleRemove([row.base])}
/>,
],
} satisfies GridColDef<PackageRow>] : [],
],
[],
[handleRemove, handleUpdate, isAuthorized],
);
return <Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
@@ -110,19 +137,22 @@ export default function PackageTable(): React.JSX.Element {
onRebuildClick: () => table.setDialogOpen("rebuild"),
onRefreshDatabaseClick: () => void table.handleRefreshDatabase(),
onReloadClick: table.handleReload,
onRemoveClick: () => void table.handleRemove(),
onUpdateClick: () => void table.handleUpdate(),
onRemoveClick: () => void table.handleRemove(table.selectionModel)
.then(() => table.setSelectionModel([])),
onUpdateClick: () => void table.handleUpdate(table.selectionModel)
.then(() => table.setSelectionModel([])),
}}
isAuthorized={table.isAuthorized}
hasSelection={table.selectionModel.length > 0}
onSearchChange={table.setSearchText}
searchText={table.searchText}
selectedPackageCount={table.selectionModel.length}
status={table.status}
/>
<DataGrid
apiRef={apiRef}
checkboxSelection
localeText={{ checkboxSelectionHeaderName: "selection" }}
columnVisibilityModel={table.columnVisibility}
columns={columns}
density="compact"
@@ -134,8 +164,8 @@ export default function PackageTable(): React.JSX.Element {
}}
loading={table.isLoading}
onCellClick={(params, event) => {
// Don't open info dialog when clicking checkbox or link
if (params.field === GRID_CHECKBOX_SELECTION_COL_DEF.field) {
// Don't open info dialog when clicking checkbox, actions, or link
if (params.field === GRID_CHECKBOX_SELECTION_COL_DEF.field || params.field === "actions") {
return;
}
if ((event.target as HTMLElement).closest("a")) {
@@ -48,19 +48,19 @@ export interface ToolbarActions {
interface PackageTableToolbarProps {
actions: ToolbarActions;
hasSelection: boolean;
isAuthorized: boolean;
onSearchChange: (text: string) => void;
searchText: string;
selectedPackageCount: number;
status?: BuildStatus;
}
export default function PackageTableToolbar({
actions,
hasSelection,
isAuthorized,
onSearchChange,
searchText,
selectedPackageCount,
status,
}: PackageTableToolbarProps): React.JSX.Element {
const [packagesAnchorEl, setPackagesAnchorEl] = useState<HTMLElement | null>(null);
@@ -103,7 +103,8 @@ export default function PackageTableToolbar({
<MenuItem onClick={() => {
setPackagesAnchorEl(null); actions.onUpdateClick();
}}>
<PlayArrowIcon fontSize="small" sx={{ mr: 1 }} /> update
<PlayArrowIcon fontSize="small" sx={{ mr: 1 }} />
{selectedPackageCount === 0 ? "update all packages" : `update selected packages (${selectedPackageCount})`}
</MenuItem>
<MenuItem onClick={() => {
setPackagesAnchorEl(null); actions.onRefreshDatabaseClick();
@@ -116,7 +117,7 @@ export default function PackageTableToolbar({
<ReplayIcon fontSize="small" sx={{ mr: 1 }} /> rebuild
</MenuItem>
<Divider />
<MenuItem disabled={!hasSelection} onClick={() => {
<MenuItem disabled={selectedPackageCount === 0} onClick={() => {
setPackagesAnchorEl(null); actions.onRemoveClick();
}}>
<DeleteIcon fontSize="small" sx={{ mr: 1 }} /> remove
+14 -11
View File
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import PauseCircleIcon from "@mui/icons-material/PauseCircle";
import { Chip } from "@mui/material";
import { Chip, Tooltip } from "@mui/material";
import type { BuildStatus } from "models/BuildStatus";
import type React from "react";
import { StatusColors } from "theme/StatusColors";
@@ -29,14 +29,17 @@ interface StatusCellProps {
}
export default function StatusCell({ isHeld, status }: StatusCellProps): React.JSX.Element {
return <Chip
icon={isHeld ? <PauseCircleIcon /> : undefined}
label={status}
size="small"
sx={{
backgroundColor: StatusColors[status],
color: "common.white",
fontWeight: 500,
}}
/>;
return <Tooltip title={isHeld ? "Held: automatic updates are skipped" : ""}>
<Chip
aria-label={isHeld ? `${status}; held: automatic updates are skipped` : status}
icon={isHeld ? <PauseCircleIcon /> : undefined}
label={status}
size="small"
sx={{
backgroundColor: StatusColors[status],
color: "common.white",
fontWeight: 500,
}}
/>
</Tooltip>;
}
+23 -24
View File
@@ -24,29 +24,27 @@ import { useClient } from "hooks/useClient";
import { useNotification } from "hooks/useNotification";
import { useRepository } from "hooks/useRepository";
import type { RepositoryId } from "models/RepositoryId";
import { useCallback } from "react";
export interface UsePackageActionsResult {
handleRefreshDatabase: () => Promise<void>;
handleReload: () => void;
handleRemove: () => Promise<void>;
handleUpdate: () => Promise<void>;
handleRemove: (packages: string[]) => Promise<void>;
handleUpdate: (packages: string[]) => Promise<void>;
}
export function usePackageActions(
selectionModel: string[],
setSelectionModel: (model: string[]) => void,
): UsePackageActionsResult {
export function usePackageActions(): UsePackageActionsResult {
const client = useClient();
const { currentRepository } = useRepository();
const { showSuccess, showError } = useNotification();
const queryClient = useQueryClient();
const invalidate = (repository: RepositoryId): void => {
const invalidate = useCallback((repository: RepositoryId): void => {
void queryClient.invalidateQueries({ queryKey: QueryKeys.packages(repository) });
void queryClient.invalidateQueries({ queryKey: QueryKeys.status(repository) });
};
}, [queryClient]);
const performAction = async (
const performAction = useCallback(async (
action: (repository: RepositoryId) => Promise<string>,
errorMessage: string,
): Promise<void> => {
@@ -57,11 +55,10 @@ export function usePackageActions(
const successMessage = await action(currentRepository);
showSuccess("Success", successMessage);
invalidate(currentRepository);
setSelectionModel([]);
} catch (exception) {
showError("Action failed", `${errorMessage}: ${ApiError.errorDetail(exception)}`);
}
};
}, [currentRepository, invalidate, showError, showSuccess]);
const handleReload = (): void => {
if (currentRepository !== null) {
@@ -69,14 +66,16 @@ export function usePackageActions(
}
};
const handleUpdate = (): Promise<void> => performAction(async (repository): Promise<string> => {
if (selectionModel.length === 0) {
await client.service.servicePackageUpdate(repository, { packages: [] });
return "Repository update has been run";
}
await client.service.servicePackageAdd(repository, { packages: selectionModel });
return `Run update for packages ${selectionModel.join(", ")}`;
}, "Packages update failed");
const handleUpdate = useCallback((packages: string[]): Promise<void> => {
return performAction(async (repository): Promise<string> => {
if (packages.length === 0) {
await client.service.servicePackageUpdate(repository, { packages: [] });
return "Repository update has been run";
}
await client.service.servicePackageAdd(repository, { packages });
return `Run update for packages ${packages.join(", ")}`;
}, "Packages update failed");
}, [client, performAction]);
const handleRefreshDatabase = (): Promise<void> => performAction(async (repository): Promise<string> => {
await client.service.servicePackageUpdate(repository, {
@@ -89,15 +88,15 @@ export function usePackageActions(
return "Pacman database update has been requested";
}, "Could not update pacman databases");
const handleRemove = (): Promise<void> => {
if (selectionModel.length === 0) {
const handleRemove = useCallback((packages: string[]): Promise<void> => {
if (packages.length === 0) {
return Promise.resolve();
}
return performAction(async (repository): Promise<string> => {
await client.service.servicePackageRemove(repository, selectionModel);
return `Packages ${selectionModel.join(", ")} have been removed`;
await client.service.servicePackageRemove(repository, packages);
return `Packages ${packages.join(", ")} have been removed`;
}, "Could not remove packages");
};
}, [client, performAction]);
return {
handleRefreshDatabase,
+3 -3
View File
@@ -30,8 +30,8 @@ export interface UsePackageTableResult {
filterModel: GridFilterModel;
handleRefreshDatabase: () => Promise<void>;
handleReload: () => void;
handleRemove: () => Promise<void>;
handleUpdate: () => Promise<void>;
handleRemove: (packages: string[]) => Promise<void>;
handleUpdate: (packages: string[]) => Promise<void>;
isAuthorized: boolean;
isLoading: boolean;
paginationModel: { page: number; pageSize: number };
@@ -52,7 +52,7 @@ export interface UsePackageTableResult {
export function usePackageTable(): UsePackageTableResult {
const { rows, isLoading, isAuthorized, status } = usePackageData();
const tableState = useTableState();
const actions = usePackageActions(tableState.selectionModel, tableState.setSelectionModel);
const actions = usePackageActions();
return {
isLoading,
+9
View File
@@ -18,6 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { createTheme, type Theme } from "@mui/material/styles";
import type {} from "@mui/x-data-grid/themeAugmentation";
export function createAppTheme(mode: "light" | "dark"): Theme {
return createTheme({
@@ -30,6 +31,14 @@ export function createAppTheme(mode: "light" | "dark"): Theme {
},
},
},
MuiDataGrid: {
styleOverrides: {
cell: {
alignItems: "center",
display: "flex",
},
},
},
MuiDialog: {
defaultProps: {
fullWidth: true,
+1 -1
View File
@@ -19,7 +19,7 @@ export default defineConfig({
build: {
chunkSizeWarningLimit: 10000,
emptyOutDir: false,
outDir: path.resolve(__dirname, "../ahriman-web/package/share/ahriman/templates"),
outDir: path.resolve(import.meta.dirname, "../ahriman-web/package/share/ahriman/templates"),
rolldownOptions: {
output: {
assetFileNames: "static/[name].[ext]",
-1
View File
@@ -70,7 +70,6 @@ exclude = [
"/conftest.py",
"/github-logo.png",
"/tox.toml",
"/toxfile.py",
"/web.png",
]
@@ -138,7 +138,7 @@ prepare() {
# apply patch level commits on top of annotated tag for pacman
if [[ -n ${_git_patch_level_commit} ]]; then
if [[ v${_git_tag} != $(git describe --tags --abbrev=0 "${_git_patch_level_commit}") ]] then
if [[ v${_git_tag} != $(git describe --tags --abbrev=0 "${_git_patch_level_commit}") ]]; then
error "patch level commit ${_git_patch_level_commit} is not a descendant of v${_git_tag}"
exit 1
fi
+21 -15
View File
@@ -41,55 +41,55 @@ array=(first '(' second)
array=(first ')' second)
# functions
function() { single line }
function() {
func() { single line; }
func() {
multi
line
}
function()
func()
{
c
multi
line
}
function() {
func() {
# comment
multi
line
}
function () {
func() {
body
}
function ( ){
func() {
body
}
function_with-package-name() { body }
function() {
function_with-package-name() { body; }
func() {
first
{ inner shell }
{ inner shell; }
last
}
function() {
func() {
body "{" argument
}
function() {
func() {
body "}" argument
}
function() {
func() {
body '{' argument
}
function() {
func() {
body '}' argument
}
# special case with quotes in comments
function() {
func() {
# we don't care about unclosed quotation in comments
body # no, I said we really don't care
}
# some random unicode symbols
function() {
func() {
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
}
@@ -107,3 +107,9 @@ array=(
second #comment-without-whitespace
third
)
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)"
}
File renamed without changes.
+18
View File
@@ -0,0 +1,18 @@
[build-system]
requires = [
"hatchling",
]
build-backend = "hatchling.build"
[project]
name = "ahriman-tox-plugins"
classifiers = [
"Framework :: tox",
]
version = "1"
[project.entry-points.tox]
dynamic-version = "dynamic_version"
[tool.hatch.build.targets.wheel]
packages = ["dynamic_version"]
+2
View File
@@ -3,6 +3,7 @@ env_list = [
"tests",
]
requires = [
"ahriman-tox-plugins @ file://{tox_root}/tools/tox_plugins",
"tox-uv",
]
labels.release = [
@@ -266,6 +267,7 @@ description = "Build frontend HTML and JS"
allowlist_externals = [
"npm",
]
skip_install = true
commands = [
{ replace = "ref", of = ["commands", "npm_install"], extend = true },
[