Skip to content

Commit

Permalink
Merge pull request #9377 from cabalism/test/force-reinstalls
Browse files Browse the repository at this point in the history
Add reinstall test to LinkerOptions/NonignoredConfigs
  • Loading branch information
mergify[bot] authored Nov 8, 2023
2 parents 813fd5f + 6801926 commit aadcc25
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic0.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
Expand All @@ -8,6 +9,16 @@ Configuring library for basic-0.1...
Preprocessing library for basic-0.1...
Building library for basic-0.1...
Installing library in <PATH>
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic0.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Error: [Cabal-7145]
Packages requested to install already exist in environment file at <ROOT>/cabal.dist/basic0.env. Overwriting them may break other packages. Use --force-reinstalls to proceed anyway. Packages: basic
# install options: --force-reinstalls --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic0.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic1.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
Expand All @@ -18,9 +29,38 @@ Configuring library for basic-0.1...
Preprocessing library for basic-0.1...
Building library for basic-0.1...
Installing library in <PATH>
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic1.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Error: [Cabal-7145]
Packages requested to install already exist in environment file at <ROOT>/cabal.dist/basic1.env. Overwriting them may break other packages. Use --force-reinstalls to proceed anyway. Packages: basic
# install options: --force-reinstalls --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic1.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic2.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic2.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Error: [Cabal-7145]
Packages requested to install already exist in environment file at <ROOT>/cabal.dist/basic2.env. Overwriting them may break other packages. Use --force-reinstalls to proceed anyway. Packages: basic
# install options: --force-reinstalls --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic2.env basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic3.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
# install options: --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic3.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Error: [Cabal-7145]
Packages requested to install already exist in environment file at <ROOT>/cabal.dist/basic3.env. Overwriting them may break other packages. Use --force-reinstalls to proceed anyway. Packages: basic
# install options: --force-reinstalls --disable-deterministic --lib --package-env=<ROOT>/cabal.dist/basic3.env --enable-shared --enable-executable-dynamic --disable-library-vanilla basic
# cabal v2-install
Wrote tarball sdist to <ROOT>/cabal.dist/work/./basic/../dist/sdist/basic-0.1.tar.gz
Resolving dependencies...
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ main = cabalTest $ do
-- (see 'testCurrentDir').)
withDirectory ".." $ do
packageEnv <- (</> ("basic" ++ show idx ++ ".env")) . testWorkDir <$> getTestEnv
cabal "v2-install" $ ["--disable-deterministic", "--lib", "--package-env=" ++ packageEnv] ++ linkConfigFlags linking ++ ["basic"]
let installOptions = ["--disable-deterministic", "--lib", "--package-env=" ++ packageEnv] ++ linkConfigFlags linking ++ ["basic"]
recordMode RecordMarked $ do
recordHeader $ "install options:" : installOptions
cabal "v2-install" installOptions
recordHeader $ "install options:" : installOptions
fails $ cabal "v2-install" installOptions
recordHeader $ "install options:" : "--force-reinstalls" : installOptions
cabal "v2-install" $ "--force-reinstalls" : installOptions
let exIPID s = takeWhile (/= '\n') . head . filter (\t -> any (`isPrefixOf` t) ["basic-0.1-", "bsc-0.1-"]) $ tails s
hashedIpid <- exIPID <$> liftIO (readFile packageEnv)
return $ ((idx, linking), hashedIpid)
Expand Down

0 comments on commit aadcc25

Please sign in to comment.