From 719da43e036bae48be01b72f2d1fe24342b19ffc Mon Sep 17 00:00:00 2001 From: TIBI Nicolas Date: Sat, 14 May 2022 00:18:21 +0200 Subject: [PATCH] arch-update: add yay support for aur packages (#444) --- arch-update/arch-update | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/arch-update/arch-update b/arch-update/arch-update index 8ee18f36..89f244c3 100755 --- a/arch-update/arch-update +++ b/arch-update/arch-update @@ -42,6 +42,14 @@ def create_argparse(): default = _default('AUR', 'False', strbool), help='Include AUR packages. Attn: Yaourt must be installed' ) + parser.add_argument( + '-y', + '--aur_yay', + action = 'store_const', + const = True, + default = _default('AUR_YAY', 'False', strbool), + help='Include AUR packages. Attn: Yay must be installed' + ) parser.add_argument( '-q', '--quiet', @@ -80,7 +88,7 @@ def get_updates(): return updates -def get_aur_updates(): +def get_aur_yaourt_updates(): output = '' try: output = check_output(['yaourt', '-Qua']).decode('utf-8') @@ -98,6 +106,15 @@ def get_aur_updates(): return aur_updates +def get_aur_yay_updates(): + output = check_output(['yay', '-Qua']).decode('utf-8') + if not output: + return [] + + aur_updates = [line.split(' ')[0] for line in output.split('\n') if line] + + return aur_updates + def matching_updates(updates, watch_list): matches = set() @@ -115,7 +132,9 @@ args = create_argparse() updates = get_updates() if args.aur: - updates += get_aur_updates() + updates += get_aur_yaourt_updates() +elif args.aur_yay: + updates += get_aur_yay_updates() update_count = len(updates) if update_count > 0: