Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the aura helper #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ The following helpers are supported and automatically selected, if present, in t
- [pacaur](https://github.com/E5ten/pacaur)
- [trizen](https://github.com/trizen/trizen)
- [pikaur](https://github.com/actionless/pikaur)
- [aura](https://github.com/fosskers/aura)
- [aurman](https://github.com/polygamma/aurman) (discontinued)

*makepkg* will be used if no helper was found or if it is explicitly specified:
Expand All @@ -70,12 +71,12 @@ The following helpers are supported and automatically selected, if present, in t
| state | **present**, latest | Desired state of the package, 'present' skips operations if the package is already installed. |
| upgrade | yes, **no** | Whether or not to upgrade whole system. |
| update_cache | yes, **no** | Whether or not to refresh the packages cache |
| use | **auto**, yay, paru, pacaur, trizen, pikaur, aurman, makepkg | The tool to use, 'auto' uses the first known helper found and makepkg as a fallback. |
| use | **auto**, yay, paru, pacaur, trizen, pikaur, aura, aurman, makepkg | The tool to use, 'auto' uses the first known helper found and makepkg as a fallback. |
| extra_args | **null** | A list of additional arguments to pass directly to the tool. Cannot be used in 'auto' mode. |
| aur_only | yes, **no** | Limit helper operation to the AUR. |
| aur_only | yes, **no** | Limit helper operation to the AUR. Ignored with the aura helper, AUR is always used. |
| local_pkgbuild | Local directory with PKGBUILD, **null** | Only valid with makepkg or pikaur. Don't download the package from AUR. Build the package using a local PKGBUILD and the other build files. |
| skip_pgp_check | yes, **no** | Only valid with makepkg. Skip PGP signatures verification of source file, useful when installing packages without GnuPG properly configured. |
| ignore_arch | yes, **no** | Only valid with makepkg. Ignore a missing or incomplete arch field, useful when the PKGBUILD does not have the arch=('yourarch') field. |
| skip_pgp_check | yes, **no** | Only valid with makepkg or aura. Skip PGP signatures verification of source file, useful when installing packages without GnuPG properly configured. |
| ignore_arch | yes, **no** | Only valid with makepkg or aura. Ignore a missing or incomplete arch field, useful when the PKGBUILD does not have the arch=('yourarch') field. |

#### Note

Expand All @@ -91,6 +92,8 @@ The following helpers are supported and automatically selected, if present, in t

#### Create the "aur_builder" user

This is not needed if the aura helper is used since it must run as root.

While Ansible expects to SSH as root, makepkg or AUR helpers do not allow executing operations as root, they fail with "you cannot perform this operation as root". It is therefore recommended to create a user, which is non-root but has no need for password with pacman in sudoers, let's call it *aur_builder*.

This user can be created in an Ansible task with the following actions:
Expand Down
20 changes: 11 additions & 9 deletions plugins/modules/aur.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
description:
- The tool to use, 'auto' uses the first known helper found and makepkg as a fallback.
default: auto
choices: [ auto, yay, paru, pacaur, trizen, pikaur, aurman, makepkg ]
choices: [ auto, yay, paru, pacaur, trizen, pikaur, aura, aurman, makepkg ]

extra_args:
description:
Expand All @@ -59,24 +59,25 @@

skip_pgp_check:
description:
- Only valid with makepkg.
- Only valid with makepkg and aura.
Skip PGP signatures verification of source file.
This is useful when installing packages without GnuPG (properly) configured.
Cannot be used unless use is set to 'makepkg'.
Cannot be used unless use is set to 'makepkg' or 'aura'.
type: bool
default: no

ignore_arch:
description:
- Only valid with makepkg.
- Only valid with makepkg and aura.
Ignore a missing or incomplete arch field, useful when the PKGBUILD does not have the arch=('yourarch') field.
Cannot be used unless use is set to 'makepkg'.
Cannot be used unless use is set to 'makepkg' or 'aura'.
type: bool
default: no

aur_only:
description:
- Limit helper operation to the AUR.
Ignored with the aura helper, AUR is always used.
type: bool
default: no

Expand Down Expand Up @@ -114,6 +115,7 @@
'pacaur': ['pacaur', '-S', '--noconfirm', '--noedit', '--needed'],
'trizen': ['trizen', '-S', '--noconfirm', '--noedit', '--needed'],
'pikaur': ['pikaur', '-S', '--noconfirm', '--noedit', '--needed'],
'aura': ['aura', '-A', '--noconfirm', '--needed', '--clean', '--delmakedeps'],
'aurman': ['aurman', '-S', '--noconfirm', '--noedit', '--needed', '--skip_news', '--pgp_fetch', '--skip_new_locations'],
'makepkg': ['makepkg', '--syncdeps', '--install', '--noconfirm', '--needed']
}
Expand Down Expand Up @@ -283,7 +285,7 @@ def install_packages(module, packages, use, extra_args, state, skip_pgp_check, i
command.append(package)
rc, out, err = module.run_command(command, check_rc=True)

changed_iter = changed_iter or not (out == '' or '-- skipping' in out or 'nothing to do' in out.lower())
changed_iter = changed_iter or not (out == '' or '-- skipping' in out or 'nothing to do' in out.lower() or 'no valid package' in out.lower())

message = 'installed package(s)' if changed_iter else 'package(s) already installed'

Expand Down Expand Up @@ -359,10 +361,10 @@ def make_module():
use = k
break

if use != 'makepkg' and (params['skip_pgp_check'] or params['ignore_arch']):
module.fail_json(msg="This option is only available with 'makepkg'.")
if use not in ('makepkg', 'aura') and (params['skip_pgp_check'] or params['ignore_arch']):
module.fail_json(msg="This option is only available with 'makepkg' and 'aura'.")

if not (use in use_cmd_local_pkgbuild) and params['local_pkgbuild']:
if use not in use_cmd_local_pkgbuild and params['local_pkgbuild']:
module.fail_json(msg="This option is not available with '%s'" % use)

if params['local_pkgbuild'] and not os.path.isdir(params['local_pkgbuild']):
Expand Down