From cbcc244b6f9478006114fd0e3770ecc73bd83bd4 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Sun, 3 Nov 2024 09:01:52 -0500 Subject: [PATCH 1/3] Add Y-forking import project --- .../PackageTests/ConditionalAndImport/yops-0.project | 7 +++++++ .../PackageTests/ConditionalAndImport/yops-2.config | 1 + .../PackageTests/ConditionalAndImport/yops-4.config | 1 + .../PackageTests/ConditionalAndImport/yops-6.config | 1 + .../PackageTests/ConditionalAndImport/yops-8.config | 1 + .../PackageTests/ConditionalAndImport/yops/yops-1.config | 1 + .../PackageTests/ConditionalAndImport/yops/yops-3.config | 1 + .../PackageTests/ConditionalAndImport/yops/yops-5.config | 1 + .../PackageTests/ConditionalAndImport/yops/yops-7.config | 1 + .../PackageTests/ConditionalAndImport/yops/yops-9.config | 1 + 10 files changed, 16 insertions(+) create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config create mode 100644 cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project new file mode 100644 index 00000000000..28f582bab91 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project @@ -0,0 +1,7 @@ +packages: . + +import: yops/yops-1.config +import: yops/yops-3.config +import: yops/yops-5.config +import: yops/yops-7.config +import: yops/yops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config new file mode 100644 index 00000000000..c8535704f13 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config @@ -0,0 +1 @@ +import: yops/yops-3.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config new file mode 100644 index 00000000000..024d1c94d1e --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config @@ -0,0 +1 @@ +import: yops/yops-5.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config new file mode 100644 index 00000000000..4df25a90a59 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config @@ -0,0 +1 @@ +import: yops/yops-7.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config new file mode 100644 index 00000000000..a2d27ab2b16 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config @@ -0,0 +1 @@ +import: yops/yops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config new file mode 100644 index 00000000000..5ad1fe73bd3 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config @@ -0,0 +1 @@ +import: ../yops-2.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config new file mode 100644 index 00000000000..6cbaeb3fa87 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config @@ -0,0 +1 @@ +import: ../yops-4.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config new file mode 100644 index 00000000000..ae0901cedd6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config @@ -0,0 +1 @@ +import: ../yops-6.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config new file mode 100644 index 00000000000..18edcb74c20 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config @@ -0,0 +1 @@ +import: ../yops-8.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config new file mode 100644 index 00000000000..61813df4e2c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config @@ -0,0 +1 @@ +-- No imports here From aa5f8c33f0ab4f60cae0fcac6cab077b62eeebc6 Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 4 Nov 2024 06:46:13 -0500 Subject: [PATCH 2/3] Add a check of the current behaviour importing duplicates - We don't check if the same config is imported multiple times --- .../ConditionalAndImport/cabal.out | 3 ++ .../ConditionalAndImport/cabal.test.hs | 33 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index be9a79bbc22..534e0301bec 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -277,6 +277,9 @@ Could not resolve dependencies: (constraint from oops-0.project requires ==1.4.3.0) [__1] fail (backjumping, conflict set: hashable, oops) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), oops (2) +# checking if we detect when the same config is imported via many different paths (we don't) +# cabal v2-build +Up to date # checking bad conditional # cabal v2-build Error: [Cabal-7090] diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index b5429e39776..67118d362c0 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -225,6 +225,39 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do \ imported by: oops-0.project") oopsing + -- The project is named yops as it is like hops but with y's for forks. + -- +-- yops-0.project + -- +-- yops/yops-1.config + -- +-- yops-2.config + -- +-- yops/yops-3.config + -- +-- yops-4.config + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-3.config + -- +-- yops-4.config + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-9.config (no further imports) + -- + -- We don't check and don't error or warn on the same config being imported + -- via many different paths. + log "checking if we detect when the same config is imported via many different paths (we don't)" + yopping <- cabal' "v2-build" [ "--project-file=yops-0.project" ] + log "checking bad conditional" badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ] assertOutputContains "Cannot set compiler in a conditional clause of a cabal project file" badIf From 563be0452dac47ab7517726ff4b9c1e6057cf79f Mon Sep 17 00:00:00 2001 From: Phil de Joux Date: Mon, 11 Nov 2024 10:08:33 -0500 Subject: [PATCH 3/3] Regen expected output after #10507. --- .../ConditionalAndImport/cabal.out | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index 534e0301bec..b517934c7d4 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -279,6 +279,153 @@ Could not resolve dependencies: After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), oops (2) # checking if we detect when the same config is imported via many different paths (we don't) # cabal v2-build +Configuration is affected by the following files: +- yops-0.project +Configuration is affected by the following files: +- yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-5.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-7.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-9.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +Configuration is affected by the following files: +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project Up to date # checking bad conditional # cabal v2-build