required fields in Cabal

Greetings. I want to have a very quick discussion about which fields are required in the Cabal. I intend to implement these in the little sanity checker, and they should be documented. If we have any time at all before GHC gets released, we don't have much so this can't be a very long discussion ;) BTW, Should we regularize the names of the fields at this late date? Sorry for not doing this earlier. We have libBuildInfo for libraries, but buildInfo for executables. We also have exeName. Does anything outside of cabal depend on these names (yet)?[1] * What's required: Library: exposedModules is required. If it's empty, and BuildInfo is non-empty, this is an error. Executable: exeName and modulePath are required. If exeName is empty, this is a parse error. All buildInfo fields are optional. Everything in BuildInfo is optional. So that leaves us with the PackageDescription type itself. Let's talk about what I think is absoluteluy required for building, and then the fields I think should be there in any useful package that someone wants someone else to use. Are there any fields that any of the layred tools absolutely require? (Hackage, etc)? * What's needed for building I won't swear to it, but I think all you generally need to build a library is: package :: PackageIdentifier, -- From the library field: exposedModules :: [String], and an executable: package :: PackageIdentifier, -- from the executables field: exeName :: String, modulePath :: FilePath, * What any good package should have: package (name and version) :: PackageIdentifier, license :: License, -- OR? licenseFile :: FilePath, copyright :: String, maintainer :: String, synopsis :: String, Personally, I think it should be an error if any of these fields are missing. I think I'll go implement that now. Stop me if you object. peace, isaac [1] As a reminder, here are the the relevant types. data PackageDescription = PackageDescription { -- the following are required by all packages: package :: PackageIdentifier, license :: License, licenseFile :: FilePath, copyright :: String, maintainer :: String, author :: String, stability :: String, testedWith :: [(CompilerFlavor,VersionRange)], homepage :: String, pkgUrl :: String, synopsis :: String, description :: String, category :: String, buildDepends :: [Dependency], -- components library :: Maybe Library, executables :: [Executable] } data Library = Library { exposedModules :: [String], libBuildInfo :: BuildInfo } data Executable = Executable { exeName :: String, modulePath :: FilePath, buildInfo :: BuildInfo } data BuildInfo = BuildInfo { buildable :: Bool, -- ^ component is buildable here ccOptions :: [String], -- ^ options for C compiler ldOptions :: [String], -- ^ options for linker frameworks :: [String], cSources :: [FilePath], hsSourceDir :: FilePath, otherModules :: [String], extensions :: [Extension], extraLibs :: [String], extraLibDirs :: [String], includeDirs :: [FilePath], includes :: [FilePath], options :: [(CompilerFlavor,[String])] }

On Mon, Feb 21, 2005 at 05:56:08PM -0800, Isaac Jones wrote:
* What any good package should have: package (name and version) :: PackageIdentifier, license :: License, -- OR? licenseFile :: FilePath, copyright :: String, maintainer :: String, synopsis :: String,
Personally, I think it should be an error if any of these fields are missing. I think I'll go implement that now. Stop me if you object.
I think license-file (for which you give a warning) is more important than copyright: it tells a user what they can use the package for. I'm not suggesting that license-file be required, just that copyright shouldn't be. Indeed public domain works have no copyright. And what about packages that are unmaintained?

On Mon, 21 Feb 2005 17:56:08 -0800, Isaac Jones
* What any good package should have: package (name and version) :: PackageIdentifier, license :: License, -- OR? licenseFile :: FilePath, copyright :: String, maintainer :: String, synopsis :: String,
The good package should have these fields but they aren't required if you only want to build some code with Cabal. This will be the typical case with VSHaskell. The developer will use Cabal in order to build his/her projects but may never fill these fields. These fields are important when the developer decide to distribute the package. I think that Cabal should check only for "package" field, but Hackage should check for all fields. Cheers, Krasimir

On Mon, 21 Feb 2005 17:56:08 -0800, Isaac Jones
license :: License, -- OR? licenseFile :: FilePath,
By the way I have half-baked tool that generates MSI installers from Cabal packages for Windows. Since the installer shows a dialog with license information and I Agree/I Disagree buttons, I have generate some license description text. I wonder whether it will be possible to generate the text from license field, some text template and maintainer, author, ... fields. I am not well acquainted with all supported licenses and I don't know whether I will have enough information in the package description. Any thoughts? Cheers, Krasimir

On Tue, Feb 22, 2005 at 03:50:44PM +0200, Krasimir Angelov wrote:
On Mon, 21 Feb 2005 17:56:08 -0800, Isaac Jones
wrote: license :: License, -- OR? licenseFile :: FilePath,
By the way I have half-baked tool that generates MSI installers from Cabal packages for Windows. Since the installer shows a dialog with license information and I Agree/I Disagree buttons, I have generate some license description text. I wonder whether it will be possible to generate the text from license field, some text template and maintainer, author, ... fields. I am not well acquainted with all supported licenses and I don't know whether I will have enough information in the package description. Any thoughts?
The contents of the file named in license-file should be what you want, no? Maybe copyright needs to be added as well.

On Tue, 22 Feb 2005 13:55:48 +0000, Ross Paterson
On Tue, Feb 22, 2005 at 03:50:44PM +0200, Krasimir Angelov wrote:
On Mon, 21 Feb 2005 17:56:08 -0800, Isaac Jones
wrote: license :: License, -- OR? licenseFile :: FilePath,
By the way I have half-baked tool that generates MSI installers from Cabal packages for Windows. Since the installer shows a dialog with license information and I Agree/I Disagree buttons, I have generate some license description text. I wonder whether it will be possible to generate the text from license field, some text template and maintainer, author, ... fields. I am not well acquainted with all supported licenses and I don't know whether I will have enough information in the package description. Any thoughts?
The contents of the file named in license-file should be what you want, no? Maybe copyright needs to be added as well.
Yes, if it is present. I wonder whether it will be possible if I have only license field.
participants (3)
-
Isaac Jones
-
Krasimir Angelov
-
Ross Paterson