From e3947354cff8e769e43b42f0682458c5f81536fd Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 14 May 2024 18:38:10 +0300 Subject: [PATCH] Make installed constraitns use any qualifier, restricting also setup-depends and build-tool-depends --- .github/workflows/haskell-ci.yml | 2 +- fixtures/all-versions.github | 2 +- fixtures/copy-fields-all.github | 2 +- fixtures/copy-fields-none.github | 2 +- fixtures/copy-fields-some.github | 2 +- fixtures/doctest-version.github | 2 +- fixtures/doctest.github | 2 +- fixtures/empty-line.github | 2 +- fixtures/enabled-jobs.github | 2 +- fixtures/fail-versions.github | 2 +- fixtures/irc-channels.github | 2 +- fixtures/messy.github | 2 +- fixtures/psql.github | 2 +- fixtures/travis-patch.github | 2 +- haskell-ci.cabal | 2 +- src/HaskellCI/GitHub.hs | 4 ++-- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 0ac81db5..b16b7d77 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -227,7 +227,7 @@ jobs: package bytestring tests: False EOF - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(Cabal|Cabal-syntax|cabal-install-parsers|haskell-ci|parsec)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(Cabal|Cabal-syntax|cabal-install-parsers|haskell-ci|parsec)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/all-versions.github b/fixtures/all-versions.github index 148d26f4..d46bc6dd 100644 --- a/fixtures/all-versions.github +++ b/fixtures/all-versions.github @@ -433,7 +433,7 @@ jobs: if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/copy-fields-all.github b/fixtures/copy-fields-all.github index 65f27a10..cd7d6a87 100644 --- a/fixtures/copy-fields-all.github +++ b/fixtures/copy-fields-all.github @@ -309,7 +309,7 @@ jobs: package servant tests: False EOF - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/copy-fields-none.github b/fixtures/copy-fields-none.github index db655f8f..a062a8e7 100644 --- a/fixtures/copy-fields-none.github +++ b/fixtures/copy-fields-none.github @@ -298,7 +298,7 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/copy-fields-some.github b/fixtures/copy-fields-some.github index 577d5593..ec648e62 100644 --- a/fixtures/copy-fields-some.github +++ b/fixtures/copy-fields-some.github @@ -301,7 +301,7 @@ jobs: allow-newer: servant-js:servant allow-newer: servant-js:servant-foreign EOF - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/doctest-version.github b/fixtures/doctest-version.github index 02174319..a813155e 100644 --- a/fixtures/doctest-version.github +++ b/fixtures/doctest-version.github @@ -448,7 +448,7 @@ jobs: if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/doctest.github b/fixtures/doctest.github index 63449c46..de3fb2fd 100644 --- a/fixtures/doctest.github +++ b/fixtures/doctest.github @@ -448,7 +448,7 @@ jobs: if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/empty-line.github b/fixtures/empty-line.github index 6d19cf15..b2dc087e 100644 --- a/fixtures/empty-line.github +++ b/fixtures/empty-line.github @@ -318,7 +318,7 @@ jobs: if $HEADHACKAGE; then echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project fi - $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant|servant-client|servant-docs|servant-server)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/enabled-jobs.github b/fixtures/enabled-jobs.github index c3c2df9f..44d033f3 100644 --- a/fixtures/enabled-jobs.github +++ b/fixtures/enabled-jobs.github @@ -433,7 +433,7 @@ jobs: if [ $((GHCJSARITH || ! GHCJSARITH && HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(splitmix)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/fail-versions.github b/fixtures/fail-versions.github index 3815fab5..e40e0818 100644 --- a/fixtures/fail-versions.github +++ b/fixtures/fail-versions.github @@ -310,7 +310,7 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant|servant-client|servant-client-core|servant-docs|servant-foreign|servant-server)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/irc-channels.github b/fixtures/irc-channels.github index bdd35bd9..37b2f967 100644 --- a/fixtures/irc-channels.github +++ b/fixtures/irc-channels.github @@ -307,7 +307,7 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/messy.github b/fixtures/messy.github index b81a2449..b85a489f 100644 --- a/fixtures/messy.github +++ b/fixtures/messy.github @@ -318,7 +318,7 @@ jobs: echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1,/g')" >> cabal.project fi cat >> cabal.project.local <= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/fixtures/travis-patch.github b/fixtures/travis-patch.github index 49b0f789..e2cf9f49 100644 --- a/fixtures/travis-patch.github +++ b/fixtures/travis-patch.github @@ -280,7 +280,7 @@ jobs: if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(servant)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan diff --git a/haskell-ci.cabal b/haskell-ci.cabal index 6a1b2634..7dd18ac7 100644 --- a/haskell-ci.cabal +++ b/haskell-ci.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: haskell-ci -version: 0.19.20240513 +version: 0.19.20240514 synopsis: Cabal package script generator for Travis-CI description: Script generator (@haskell-ci@) for diff --git a/src/HaskellCI/GitHub.hs b/src/HaskellCI/GitHub.hs index a3e60f7f..7c8c99e8 100644 --- a/src/HaskellCI/GitHub.hs +++ b/src/HaskellCI/GitHub.hs @@ -418,7 +418,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do case normaliseInstalled cfgInstalled of InstalledDiff pns -> sh $ unwords [ "$HCPKG list --simple-output --names-only" - , "| perl -ne 'for (split /\\s+/) { print \"constraints: $_ installed\\n\" unless /" ++ re ++ "/; }'" + , "| perl -ne 'for (split /\\s+/) { print \"constraints: any.$_ installed\\n\" unless /" ++ re ++ "/; }'" , ">> cabal.project.local" ] where @@ -426,7 +426,7 @@ makeGitHub _argv config@Config {..} gitconfig prj jobs@JobVersions {..} = do re = "^(" ++ intercalate "|" (S.toList pns') ++ ")$" InstalledOnly pns | not (null pns') -> cat "cabal.project.local" $ unlines - [ "constraints: " ++ pkg ++ " installed" + [ "constraints: any." ++ pkg ++ " installed" | pkg <- S.toList pns' ] where