diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799a/CHANGELOG.md new file mode 100644 index 00000000000..97e807c9c3c --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for T9799 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/Setup.hs b/cabal-testsuite/PackageTests/Freeze/T9799a/Setup.hs new file mode 100644 index 00000000000..b051c0c79cf --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/Setup.hs @@ -0,0 +1,2 @@ +{-# LANGUAGE NoImplicitPrelude #-} +main = _ diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/T9799.cabal b/cabal-testsuite/PackageTests/Freeze/T9799a/T9799.cabal new file mode 100644 index 00000000000..32925050695 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/T9799.cabal @@ -0,0 +1,15 @@ +cabal-version: 3.0 +name: T9799 +version: 0.1.0.0 +license: NONE +build-type: Custom +extra-doc-files: CHANGELOG.md + +custom-setup + setup-depends: libA == 0.2.0.0 + +library + exposed-modules: MyLib + build-depends: libA == 0.1.0.0 + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/cabal.test.hs b/cabal-testsuite/PackageTests/Freeze/T9799a/cabal.test.hs new file mode 100644 index 00000000000..715a6e184ee --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/cabal.test.hs @@ -0,0 +1,9 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + expectBroken 9799 $ withRepo "repo" $ do + cabal "v2-freeze" [] + cwd <- fmap testCurrentDir getTestEnv + -- Guarantee that freeze writes scope-qualified constraints, not 'any' + -- qualified constraints. + assertFileDoesNotContain (cwd "cabal.project.freeze") "any.libA" + assertFileDoesContain (cwd "cabal.project.freeze") "setup.libA == 0.2.0.0" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/CHANGELOG.md new file mode 100644 index 00000000000..1268bdc1944 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for libA0100 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/libA.cabal b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/libA.cabal new file mode 100644 index 00000000000..8b2e750ee55 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/libA.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.0 +name: libA +version: 0.1.0.0 +license: NONE +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + exposed-modules: MyLib + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/src/MyLib.hs b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.1.0.0/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/CHANGELOG.md new file mode 100644 index 00000000000..1268bdc1944 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for libA0100 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/libA.cabal b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/libA.cabal new file mode 100644 index 00000000000..aa837a3bc89 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/libA.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.0 +name: libA +version: 0.2.0.0 +license: NONE +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + exposed-modules: MyLib + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/src/MyLib.hs b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/repo/libA-0.2.0.0/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799a/src/MyLib.hs b/cabal-testsuite/PackageTests/Freeze/T9799a/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799a/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799b/CHANGELOG.md new file mode 100644 index 00000000000..97e807c9c3c --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for T9799 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/Setup.hs b/cabal-testsuite/PackageTests/Freeze/T9799b/Setup.hs new file mode 100644 index 00000000000..25c3e594db8 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/Setup.hs @@ -0,0 +1,5 @@ +import MyLib +import Distribution.Simple +main = do + putStrLn $ "Setup: " ++ vers + defaultMain diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/T9799.cabal b/cabal-testsuite/PackageTests/Freeze/T9799b/T9799.cabal new file mode 100644 index 00000000000..b660d96f873 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/T9799.cabal @@ -0,0 +1,15 @@ +cabal-version: 3.0 +name: T9799 +version: 0.1.0.0 +license: NONE +build-type: Custom +extra-doc-files: CHANGELOG.md + +custom-setup + setup-depends: libA, base, Cabal + +library + exposed-modules: None + build-depends: libA, base, template-haskell + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/cabal.test.hs b/cabal-testsuite/PackageTests/Freeze/T9799b/cabal.test.hs new file mode 100644 index 00000000000..5ddc212f688 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/cabal.test.hs @@ -0,0 +1,19 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + expectBroken 9799 $ withRepo "repo" $ do + + -- Show how using 'any' qualifiers always with relaxed bounds can violate that + -- cabal freeze --constraint=... && cabal build + -- should be equal to + -- cabal build --constraint=... + -- + -- Therefore, the packages in a cabal.project.freeze file must be properly qualified + + out1 <- cabal' "v2-build" ["--constraint='setup.libA == 0.1.0.0'"] + assertOutputContains "Setup: libA-0.1.0.0" out1 + assertOutputContains "Build: libA-0.2.0.0" out1 + + cabal "v2-freeze" ["--constraint=setup.libA == 0.1.0.0'"] + out2 <- cabal' "v2-build" [] + assertOutputContains "Setup: libA-0.1.0.0" out2 + assertOutputContains "Building: libA-0.2.0.0" out2 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/CHANGELOG.md new file mode 100644 index 00000000000..1268bdc1944 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for libA0100 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/libA.cabal b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/libA.cabal new file mode 100644 index 00000000000..6baf3866909 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/libA.cabal @@ -0,0 +1,12 @@ +cabal-version: 3.0 +name: libA +version: 0.1.0.0 +license: NONE +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/src/MyLib.hs b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/src/MyLib.hs new file mode 100644 index 00000000000..bef50f2bb00 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.1.0.0/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib where + +vers :: String +vers = "libA-0.1.0.0" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/CHANGELOG.md b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/CHANGELOG.md new file mode 100644 index 00000000000..1268bdc1944 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for libA0100 + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/libA.cabal b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/libA.cabal new file mode 100644 index 00000000000..25526818b2a --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/libA.cabal @@ -0,0 +1,12 @@ +cabal-version: 3.0 +name: libA +version: 0.2.0.0 +license: NONE +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/src/MyLib.hs b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/src/MyLib.hs new file mode 100644 index 00000000000..0ff3e21284d --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/repo/libA-0.2.0.0/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib where + +renamedVers :: String +renamedVers = "libA-0.2.0.0" diff --git a/cabal-testsuite/PackageTests/Freeze/T9799b/src/None.hs b/cabal-testsuite/PackageTests/Freeze/T9799b/src/None.hs new file mode 100644 index 00000000000..f4c629a9329 --- /dev/null +++ b/cabal-testsuite/PackageTests/Freeze/T9799b/src/None.hs @@ -0,0 +1,10 @@ +{-# LANGUAGE TemplateHaskell #-} +module None where + +import MyLib +import Language.Haskell.TH + +$(do + runIO $ putStrLn $ "Building: " ++ renamedVers + [d| x = () |] + ) diff --git a/cabal-testsuite/PackageTests/Freeze/disable-benchmarks.out b/cabal-testsuite/PackageTests/FreezeV1/disable-benchmarks.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/disable-benchmarks.out rename to cabal-testsuite/PackageTests/FreezeV1/disable-benchmarks.out diff --git a/cabal-testsuite/PackageTests/Freeze/disable-benchmarks.test.hs b/cabal-testsuite/PackageTests/FreezeV1/disable-benchmarks.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/disable-benchmarks.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/disable-benchmarks.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/disable-tests.out b/cabal-testsuite/PackageTests/FreezeV1/disable-tests.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/disable-tests.out rename to cabal-testsuite/PackageTests/FreezeV1/disable-tests.out diff --git a/cabal-testsuite/PackageTests/Freeze/disable-tests.test.hs b/cabal-testsuite/PackageTests/FreezeV1/disable-tests.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/disable-tests.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/disable-tests.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/dry-run.out b/cabal-testsuite/PackageTests/FreezeV1/dry-run.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/dry-run.out rename to cabal-testsuite/PackageTests/FreezeV1/dry-run.out diff --git a/cabal-testsuite/PackageTests/Freeze/dry-run.test.hs b/cabal-testsuite/PackageTests/FreezeV1/dry-run.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/dry-run.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/dry-run.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/enable-benchmarks.out b/cabal-testsuite/PackageTests/FreezeV1/enable-benchmarks.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/enable-benchmarks.out rename to cabal-testsuite/PackageTests/FreezeV1/enable-benchmarks.out diff --git a/cabal-testsuite/PackageTests/Freeze/enable-benchmarks.test.hs b/cabal-testsuite/PackageTests/FreezeV1/enable-benchmarks.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/enable-benchmarks.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/enable-benchmarks.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/enable-tests.out b/cabal-testsuite/PackageTests/FreezeV1/enable-tests.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/enable-tests.out rename to cabal-testsuite/PackageTests/FreezeV1/enable-tests.out diff --git a/cabal-testsuite/PackageTests/Freeze/enable-tests.test.hs b/cabal-testsuite/PackageTests/FreezeV1/enable-tests.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/enable-tests.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/enable-tests.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/freeze.out b/cabal-testsuite/PackageTests/FreezeV1/freeze.out similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/freeze.out rename to cabal-testsuite/PackageTests/FreezeV1/freeze.out diff --git a/cabal-testsuite/PackageTests/Freeze/freeze.test.hs b/cabal-testsuite/PackageTests/FreezeV1/freeze.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/freeze.test.hs rename to cabal-testsuite/PackageTests/FreezeV1/freeze.test.hs diff --git a/cabal-testsuite/PackageTests/Freeze/my.cabal b/cabal-testsuite/PackageTests/FreezeV1/my.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/my.cabal rename to cabal-testsuite/PackageTests/FreezeV1/my.cabal diff --git a/cabal-testsuite/PackageTests/Freeze/repo/criterion-1.1.4.0/criterion.cabal b/cabal-testsuite/PackageTests/FreezeV1/repo/criterion-1.1.4.0/criterion.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/repo/criterion-1.1.4.0/criterion.cabal rename to cabal-testsuite/PackageTests/FreezeV1/repo/criterion-1.1.4.0/criterion.cabal diff --git a/cabal-testsuite/PackageTests/Freeze/repo/test-framework-0.8.1.1/test-framework.cabal b/cabal-testsuite/PackageTests/FreezeV1/repo/test-framework-0.8.1.1/test-framework.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Freeze/repo/test-framework-0.8.1.1/test-framework.cabal rename to cabal-testsuite/PackageTests/FreezeV1/repo/test-framework-0.8.1.1/test-framework.cabal