From f1546cc0731c78a88f987132644d7297e0523323 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Fri, 3 Nov 2023 16:30:40 +0800 Subject: [PATCH] cabal-install-solver: fix pkgconf 1.9 --modversion regression Check that the numbers of *versions* output is equal to the number of pkgconf's fixes #8923 The pkgconf behavior was reverted upstream in 2.0 (this should cover the case too of checking that equal pkgList lines are output also) --- .../src/Distribution/Solver/Types/PkgConfigDb.hs | 7 ++++--- changelog.d/pr-9391 | 4 ++++ 2 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 changelog.d/pr-9391 diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs index 00bc38c28c3..ee2f22032ca 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs @@ -67,11 +67,12 @@ readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do -- The output of @pkg-config --list-all@ also includes a description -- for each package, which we do not need. let pkgNames = map (takeWhile (not . isSpace)) pkgList - (pkgVersions, _errs, exitCode) <- + (outs, _errs, exitCode) <- getProgramInvocationOutputAndErrors verbosity (programInvocation pkgConfig ("--modversion" : pkgNames)) - if exitCode == ExitSuccess && length pkgNames == length pkgList - then (return . pkgConfigDbFromList . zip pkgNames) (lines pkgVersions) + let pkgVersions = lines outs + if exitCode == ExitSuccess && length pkgVersions == length pkgNames + then (return . pkgConfigDbFromList . zip pkgNames) pkgVersions else -- if there's a single broken pc file the above fails, so we fall back -- into calling it individually diff --git a/changelog.d/pr-9391 b/changelog.d/pr-9391 new file mode 100644 index 00000000000..517c94ed127 --- /dev/null +++ b/changelog.d/pr-9391 @@ -0,0 +1,4 @@ +synopsis: fix pkgconfig-depends for pkgconf-1.9 +packages: cabal-install-solver +prs: #9391 +issues: #8923