Comments (6)
Thanks, the comment about looking where hlint is installed by stack really helped me understand. The issue seems to be that a library I rely on (hlint
) has hlint.yaml
declared as a data file and expects it to get copied. I assumed cabal would copy any required data files from dependencies but it seems it will not. The fix should be as simple as copy in data/hlint.yaml from that project and add a data-files
directive to the cabal file so it gets copied.
My personal laptop is in for repairs so I'm not sure when I'll have access to a machine to make the fix, but I'lll try to find a way.
from hfmt.
I honestly don't know how cabal copy
works or why this would be failing. Could you give more detailed steps to help me reproduce?
from hfmt.
The steps I use aren't the simplest, I think, but they should at least allow you to reproduce:
stack build --dependencies-only
stack \
exec ghc-pkg -- list | grep pkgdb | awk '{print "--package-db=" $0}' > db-paths
stack \
exec --no-ghc-package-path cabal -- configure \
$(cat db-paths) \
--prefix=/usr --docdir="/usr/share/doc/${pkgname}"
stack \
exec --no-ghc-package-path cabal -- build
stack \
exec --no-ghc-package-path cabal -- copy \
--destdir="${destdir}"
You end up with the result of the copy in destdir
, and it's those contents that's then package up into a distro package.
from hfmt.
I ran those commands and the resulting executable worked fine (at least on the same machine). Do you maybe have custom hlint config that is causing this? Does the normal hfmt
exe resulting from stack install
work when run from the same working directory?
from hfmt.
Here's how I manage to reproduce it on a clean system (a system with only stack
and cabal
installed)
mkdir hfmt-destdir
cabal get hfmt
cd hfmt-0.2.3.1
stack build --dependencies-only
stack exec ghc-pkg -- list | grep pkgdb | awk '{print "--package-db=" $0}' > db-paths
stack exec --no-ghc-package-path cabal -- configure $(cat db-paths) --prefix=/usr --docdir="/usr/share/doc/hfmt"
stack exec --no-ghc-package-path cabal -- build
stack exec --no-ghc-package-path cabal -- copy --destdir="../hfmt-destdir"
cd ..
rm -fr hfmt-0.2.3.1
rm -fr ~/.stack
echo 'main = putStrLn "Hello, World!"' > main.hs
./hfmt-destdir/usr/bin/hfmt main.hs
on my system this results in
hfmt: user error (Failed to find requested hint files:
/home/magnus/Private/tmp/hfmt-destdir/usr/bin/data/hlint.yaml
)
and if I move the binary to /usr/local/bin
I can see that it looks for the file relative to the location of the binary.
It also looks for the file in the location where stack
caches the hlint
library (under ~/.stack/snapshots/...
).
I think a good solution would be to:
- look for configuration files based on
--datadir
- include all needed configuration files when using
cabal copy
from hfmt.
Oh, take your time, I'm in no hurry :)
from hfmt.
Related Issues (20)
- hfmt chokes on stdin HOT 4
- Exit code semantics
- hfmt.EXE: app\Main.hs:(71,1)-(73,41): Non-exhaustive patterns in function sourceChangedOrHasSuggestions HOT 2
- Cant parse template haskell HOT 1
- Load config from source path
- stack-fmt exe
- Print suggestions even when overwriting sources
- Do not use `sourceList`
- Can't install with Stack HOT 1
- Use conditional includes to use `readGenericPackageDescription` only with newer cabal versions
- stack install hfmt fails on Windows with latest stack (stylish-haskell must match ==0.9.*) HOT 5
- Stack install hfmt fails on latest everything [Linux, v0.2.2] HOT 5
- Take Cabal default-extensions into account HOT 1
- stack install hfmt fails on OSX HOT 1
- hfmt misformats haddock comments in the export list
- hfmt misformats the `*` operator when qualified and parenthesized
- stack update to lts-14.6 and ghc 8.6.5 HOT 3
- Remove restrictive upper bounds on stylish-haskell and hlint dependencies HOT 1
- Support newer GHC versions?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hfmt.