From 6aeda9d870a1253535297cb50b01bebfc8c62910 Mon Sep 17 00:00:00 2001 From: jspam Date: Tue, 19 Nov 2024 17:55:58 +0100 Subject: [PATCH] msys2: Check if package exists before removing it (#25973) --- recipes/msys2/all/conanfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/recipes/msys2/all/conanfile.py b/recipes/msys2/all/conanfile.py index 752c04acf11c3..7c023fcf2b203 100644 --- a/recipes/msys2/all/conanfile.py +++ b/recipes/msys2/all/conanfile.py @@ -142,7 +142,8 @@ def _do_build(self): for package in packages: self.run(f'bash -l -c "pacman -S {package} --noconfirm"') for package in ['pkgconf']: - self.run(f'bash -l -c "pacman -Rs -d -d $(pacman -Qsq {package}) --noconfirm"') + if self.run(f'bash -l -c "pacman -Qq {package}"', ignore_errors=True, quiet=True) == 0: + self.run(f'bash -l -c "pacman -Rs -d -d {package} --noconfirm"') self._kill_pacman()