From f632aea55e53dead21646ec36598fb2db6b20dca Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Wed, 19 Aug 2020 19:05:44 -0300 Subject: [PATCH] [arch] fix -> AUR: not installing the correct package built when several are generated --- CHANGELOG.md | 1 + bauh/gems/arch/controller.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1fadceba..6248d6ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -64,6 +64,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - info dialog of installed packages displays the latest PKGBUILD file instead of the one used for installation/upgrade/downgrade (the fix will only work for new installed packages) - multi-threaded download: not retrieving correctly some source files URLs (e.g: linux-xanmod-lts) - importing PGP keys (Generic error). Now the key server is specified: `gpg --keyserver SERVER --recv-key KEYID` (the server address is retrieved from [bauh-files](https://github.com/vinifmor/bauh-files/blob/master/arch/gpgservers.txt)) + - not installing the correct package built when several are generated (e.g: linux-xanmod-lts) - some environment variables are not available during the common operations (install, upgrade, downgrade, uninstall, makepkg) - Flatpak - downgrading crashing with version 1.8.X diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 09a4fb12..583be3fe 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -1680,7 +1680,21 @@ class ArchManager(SoftwareManager): context.watcher.print('Could not find the built package. Aborting...') return False - context.install_file = '{}/{}'.format(context.project_dir, gen_file[0]) + file_to_install = gen_file[0] + + if len(gen_file) > 1: + srcinfo = aur.map_srcinfo(makepkg.gen_srcinfo(context.project_dir)) + pkgver = '-{}'.format(srcinfo['pkgver']) if srcinfo.get('pkgver') else '' + pkgrel = '-{}'.format(srcinfo['pkgrel']) if srcinfo.get('pkgrel') else '' + arch = '-{}'.format(srcinfo['arch']) if srcinfo.get('arch') else '' + name_start = '{}{}{}{}'.format(context.name, pkgver, pkgrel, arch) + + perfect_match = [f for f in gen_file if f.startswith(name_start)] + + if perfect_match: + file_to_install = perfect_match[0] + + context.install_file = '{}/{}'.format(context.project_dir, file_to_install) if self._install(context=context): self._save_pkgbuild(context)