vincenthz / cabal-db Goto Github PK
View Code? Open in Web Editor NEWVarious cabal query commands wrapped in a simple CLI tool
License: Other
Various cabal query commands wrapped in a simple CLI tool
License: Other
I am trying to reverse-engineer correct bounds for cabal-db
master
to build.
Seems we need:
optparse-applicative < 0.14
Cabal < 2
base < 4.9
I applied these upper bounds to all releases of cabal-db
on hackage, e.g. https://hackage.haskell.org/package/cabal-db-0.1.12/revisions/
Older versions might need even tighter bounds, but I will not research the bounds for old versions. The bounds that make 0.1.12
compile will also prevent the resolver to find older version.
Works:
$ cabal build -w ghc-7.10.3 --constraint='Cabal < 2' --constraint='optparse-applicative < 0.14'
PackageName
Old GHCs:
Src/Env.hs:8:37: error:
Data constructor not in scope: PackageName :: [Char] -> a
|
8 | platformPackages = S.fromList $ map PackageName $
| ^^^^^^^^^^^
$ cabal build -w ghc-8.4.4 --constraint='Cabal < 3'
$ cabal build -w ghc-8.4.4 --constraint='Cabal < 2.4'
$ cabal build -w ghc-7.10.3 --constraint='Cabal == 2.0.*' --constraint='optparse-applicative < 0.14'
New GHCs:
[1 of 8] Compiling Env ( Src/Env.hs, /Users/abel/bin/src/cabal-db/dist-newstyle/build/x86_64-osx/ghc-9.2.1/cabal-db-0.1.12/x/cabal-db/build/cabal-db/cabal-db-tmp/Env.o )
Src/Env.hs:8:37: error:
• Illegal term-level use of the type constructor ‘PackageName’
imported from ‘Distribution.Package’ at Src/Env.hs:5:30-44
(and originally defined in ‘Distribution.Types.PackageName’)
$ cabal build -w ghc-9.2.1
(<>)
[3 of 8] Compiling Options ( Src/Options.hs, /Users/abel/bin/src/cabal-db/dist-newstyle/build/x86_64-osx/ghc-8.0.2/cabal-db-0.1.12/x/cabal-db/build/cabal-db/cabal-db-tmp/Options.o )
Src/Options.hs:67:50: error:
• Variable not in scope: (<>) :: Mod f9 a9 -> Mod f8 a8 -> t3
$ cabal build -w ghc-7.10.3 --constraint='Cabal < 3'
$ cabal build -w ghc-8.0.2 --constraint='Cabal < 3'
$ cabal build -w ghc-7.10.3 --constraint='Cabal < 2' --constraint='optparse-applicative == 0.14.*'
$ cabal build -w ghc-8.0.2 --constraint='Cabal < 2' --constraint='optparse-applicative < 0.14'
$ cabal build -w ghc-8.2.2 --constraint='Cabal < 2' --constraint='optparse-applicative < 0.14'
On my mac, the hackage.haskell.org/00-index.tar
file is not located in ~/.cabal/packages
but in ~/Library/Haskell/repo-cach
.
Not sure if it's due to that it's running on a mac, or because it's a cabal-install 1.17.0 snapshot.
$ cabal-db info binary
cabal-db: /Users/kolmodin/.cabal/packages/hackage.haskell.org/00-index.tar: openBinaryFile: does not exist (No such file or directory)
$ ls ~/.cabal
config config.platform logs setup-exe-cache
$ ls -lah ~/Library/Haskell/repo-cache/hackage.haskell.org/00-index.tar
-rw------- 1 kolmodin staff 88M Apr 22 10:44 /Users/kolmodin/Library/Haskell/repo-cache/hackage.haskell.org/00-index.tar
Reading the ~/.cabal/config
gives some help in finding the tarball.
$ grep remote-repo-cache .cabal/config
remote-repo-cache: /Users/kolmodin/Library/Haskell/repo-cache
I don't know how is cabal-db
working, but as far as I can see it's not working for packages that are not on Hackage.
I have a library and executable that I develop using sandbox so every dependency is in the sandbox or in system-level dirs. Is there a way to make cabal-db
working in this case? Would it be too hard to add this feature?
It seems that your package is missing some CPP magic, or dependency version bounds:
$ cabal install cabal-db
Resolving dependencies...
Downloading cabal-db-0.1.8...
Configuring cabal-db-0.1.8...
Building cabal-db-0.1.8...
Preprocessing executable 'cabal-db' for cabal-db-0.1.8...
[1 of 4] Compiling Paths_cabal_db ( dist/build/autogen/Paths_cabal_db.hs, dist/build/cabal-db/cabal-db-tmp/Paths_cabal_db.o )
[2 of 4] Compiling Graph ( Src/Graph.hs, dist/build/cabal-db/cabal-db-tmp/Graph.o )
[3 of 4] Compiling Options ( Src/Options.hs, dist/build/cabal-db/cabal-db-tmp/Options.o )
[4 of 4] Compiling Main ( Src/Main.hs, dist/build/cabal-db/cabal-db-tmp/Main.o )
Src/Main.hs:342:20:
Not in scope: data constructor `AGPL'
Perhaps you meant one of these:
`GPL' (imported from Distribution.License),
`LGPL' (imported from Distribution.License)
Failed to install cabal-db-0.1.8
cabal: Error: some packages failed to install:
cabal-db-0.1.8 failed during the building phase. The exception was:
ExitFailure 1
(This is with Cabal-1.6)
I interrupted cabal-db diff
with Ctrl-C, and the source directories were not removed. (I hope they would have been removed if I didn't interrupt!) You probably have to add a bracket
in the relevant place.
Also, it would be cleaner if the packages were unpacked not in the current directory, but in a temporary one.
% cabal-db diff --help
error parsing arguments:
unrecognized option `--help'
Preprocessing executable 'cabal-db' for cabal-db-0.1.11...
[1 of 8] Compiling Printing ( Src/Printing.hs, dist/build/cabal-db/cabal-db-tmp/Printing.o )
[2 of 8] Compiling Ver ( Src/Ver.hs, dist/build/cabal-db/cabal-db-tmp/Ver.o )
[3 of 8] Compiling Database ( Src/Database.hs, dist/build/cabal-db/cabal-db-tmp/Database.o )
[4 of 8] Compiling Policy ( Src/Policy.hs, dist/build/cabal-db/cabal-db-tmp/Policy.o )
[5 of 8] Compiling Env ( Src/Env.hs, dist/build/cabal-db/cabal-db-tmp/Env.o )
[6 of 8] Compiling Graph ( Src/Graph.hs, dist/build/cabal-db/cabal-db-tmp/Graph.o )
[7 of 8] Compiling Options ( Src/Options.hs, dist/build/cabal-db/cabal-db-tmp/Options.o )
[8 of 8] Compiling Main ( Src/Main.hs, dist/build/cabal-db/cabal-db-tmp/Main.o )
Src/Main.hs:201:23:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:202:42:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:216:65:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:278:23:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:297:44:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:337:28:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Src/Main.hs:343:61:
Ambiguous occurrence ‘unPackageName’
It could refer to either ‘Main.unPackageName’,
defined at Src/Main.hs:41:1
or ‘Distribution.Package.unPackageName’,
imported from ‘Distribution.Package’ at Src/Main.hs:6:1-27
Failed to install cabal-db-0.1.11
cabal: Error: some packages failed to install:
cabal-db-0.1.11 failed during the building phase. The exception was:
ExitFailure 1
ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.8.4
cabal --version
cabal-install version 1.22.0.0
using version 1.22.0.0 of the Cabal library
I tried installing cabal-db but the compilation failed with the following (abbreviated) error message:
Src/Main.hs:94:32:
`Tar.Entries' is applied to too many type arguments
In the type signature for `listTar':
listTar :: Show e => Tar.Entries e -> [([FilePath], ByteString)]
Turned out that the tar package was installed at version 0.3.2.0. Changing cabal-db.cabal to restrict the version of tar to 0.4, i.e., tar == 0.4.*
, made the compilation complete successfully and the program now runs flawlessly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.