Skip to content

Commit

Permalink
Fix ./setup install comand
Browse files Browse the repository at this point in the history
Running ./setup install will give you an error:

```
fromFlag NoFlag. Use fromFlagOrDefault
CallStack (from HasCallStack):
  error, called at src/Distribution/Simple/Flag.hs:110:19 in Cabal-3.15.0.0-inplace:Distribution.Simple.Flag
  fromFlag, called at src/Distribution/Simple/Register.hs:161:16 in Cabal-3.15.0.0-inplace:Distribution.Simple.Register
```

This seems to not be tested anywhere and most people will use ./setup
register in any case, but we should fix this for the next point release
in 3.14 series. # Please enter the commit message for your changes.
Lines starting

Fixes #10416

(cherry picked from commit 2a178f2)

# Conflicts:
#	Cabal/src/Distribution/Simple.hs
  • Loading branch information
mpickering authored and geekosaur committed Oct 8, 2024
1 parent 01d22f7 commit 1cb7876
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Cabal/src/Distribution/Simple.hs
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,11 @@ defaultInstallHook pkg_descr localbuildinfo _ flags = do
{ regDistPref = installDistPref flags
, regInPlace = installInPlace flags
, regPackageDB = installPackageDB flags
<<<<<<< HEAD
, regVerbosity = installVerbosity flags
=======
, registerCommonFlags = installCommonFlags flags
>>>>>>> 2a178f243 (Fix ./setup install comand)
}
when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Revision history for DistPrefInstall

## 0.1.0.0 -- YYYY-mm-dd

* First version. Released on an unsuspecting world.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
cabal-version: 3.12
name: DistPrefInstall
version: 0.1.0.0
license: NONE
author: Matthew Pickering
maintainer: matthewtpickering@gmail.com
build-type: Simple
extra-doc-files: CHANGELOG.md

common warnings
ghc-options: -Wall

library
import: warnings
exposed-modules: MyLib
build-depends: base
hs-source-dirs: src
default-language: Haskell2010
2 changes: 2 additions & 0 deletions cabal-testsuite/PackageTests/Install/DistPrefInstall/Setup.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Test.Cabal.Prelude

main = setupTest $ recordMode DoNotRecord $ withPackageDb $ do
setup "configure" []
setup "build" []
setup "copy" []
setup "install" []
setup "sdist" []
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module MyLib (someFunc) where

someFunc :: IO ()
someFunc = putStrLn "someFunc"
11 changes: 11 additions & 0 deletions changelog.d/t10416
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
synopsis: Fix ./setup install command
packages: Cabal
prs: #10417
issues: #10416
significance: significant

description: {

- `./setup install` was failing with a `fromFlag NoFlag` error. It is now fixed.

}

0 comments on commit 1cb7876

Please sign in to comment.