ArchLinux: ignore unrelated warnings from pacman

It seems that `pacman -Q` may output warning lines if you have a
file with the same name as the package, like so:

    $ mkdir cmake
    $ pacman -Q cmake
    error: package 'cmake' was not found
    warning: 'cmake' is a file, you might want to use -p/--file.

This confuses bindep's output parsing when looking simply for lines
ending in "was not found" so match more strictly instead on lines
containing something like:

    error: package 'cmake' was not found

See the original patch supplied by Jakob Lykke Andersen in this
mailing list post:

http://lists.openstack.org/pipermail/openstack-discuss/2020-December/019404.html

Change-Id: I70287418ce034690a7fd34f4127a24fe8d7a33d2
Co-Authored-By: Jakob Lykke Andersen <jlandersen@imada.sdu.dk>
This commit is contained in:
Jeremy Stanley 2021-01-16 16:14:35 +00:00
parent 5e75b1b99b
commit 7c7ea77e8b
1 changed files with 2 additions and 1 deletions

View File

@ -558,7 +558,8 @@ class Pacman(Platform):
stderr=subprocess.STDOUT).decode(getpreferredencoding(False))
except subprocess.CalledProcessError as e:
eoutput = e.output.decode(getpreferredencoding(False))
if e.returncode == 1 and eoutput.strip().endswith('was not found'):
s = "error: package '{}' was not found".format(pkg_name)
if e.returncode == 1 and s in eoutput:
return None
raise
# output looks like