darcs patch: Select Configuration file via env var CABAL_CONFIG
Paolo Losi
paolo at hypersonic.it
Sun Feb 22 20:19:31 EST 2009
A patch for ticket:
http://hackage.haskell.org/trac/hackage/ticket/505
-------------- next part --------------
Mon Feb 23 01:52:51 CET 2009 Paolo Losi <paolo.losi at gmail.com>
* Select Configuration file via env var CABAL_CONFIG.
New patches:
[Select Configuration file via env var CABAL_CONFIG.
Paolo Losi <paolo.losi at gmail.com>**20090223005251
Ignore-this: 26e5ded85cb69cb3a19cd57680a8a362
] {
hunk ./Distribution/Client/Config.hs 77
import Data.Monoid
( Monoid(..) )
import Control.Monad
- ( when, foldM )
+ ( when, foldM, liftM )
import qualified Data.Map as Map
import qualified Distribution.Compat.ReadP as Parse
( option )
hunk ./Distribution/Client/Config.hs 91
( URI(..), URIAuth(..) )
import System.FilePath
( (</>), takeDirectory )
+import System.Environment
+ ( getEnvironment )
import System.IO.Error
( isDoesNotExistError )
hunk ./Distribution/Client/Config.hs 233
loadConfig :: Verbosity -> Flag FilePath -> Flag Bool -> IO SavedConfig
loadConfig verbosity configFileFlag userInstallFlag = addBaseConf $ do
- configFile <- maybe defaultConfigFile return (flagToMaybe configFileFlag)
+ let sources = [
+ ("commandline option", return . flagToMaybe $ configFileFlag),
+ ("env var CABAL_CONFIG", lookup "CABAL_CONFIG" `liftM` getEnvironment),
+ ("default config file", Just `liftM` defaultConfigFile) ]
hunk ./Distribution/Client/Config.hs 238
+ getSource [] = error "no config file path candidate found."
+ getSource ((msg,action): xs) =
+ action >>= maybe (getSource xs) (return . (,) msg)
+
+ (source, configFile) <- getSource sources
minp <- readConfigFile mempty configFile
case minp of
Nothing -> do
hunk ./Distribution/Client/Config.hs 246
+ notice verbosity $ "Config file path source is " ++ source ++ "."
notice verbosity $ "Config file " ++ configFile ++ " not found."
notice verbosity $ "Writing default configuration to " ++ configFile
commentConf <- commentSavedConfig
}
Context:
[TAG 0.6.2
Duncan Coutts <duncan at haskell.org>**20090219130720]
[Update the README
Duncan Coutts <duncan at haskell.org>**20090219130705]
[Add missing other-modules
Duncan Coutts <duncan at haskell.org>**20090218235206]
[Add extra assertion into the top down dep planner
Duncan Coutts <duncan at haskell.org>**20090218234650]
[Bump version to 0.6.2
Duncan Coutts <duncan at haskell.org>**20090218231016]
[Update changelog for 0.6.2 release
Duncan Coutts <duncan at haskell.org>**20090218230918]
[Tweaks to the bootstrap script
Duncan Coutts <duncan at haskell.org>**20090218223943
Update Cabal lib version to 1.6.0.2
Implement a couple shell script coding style recommendations.
]
[Disable the upgrade command for now.
Duncan Coutts <duncan at haskell.org>**20090218221752]
[Add warnings in the case that no remote servers have been specified
Duncan Coutts <duncan at haskell.org>**20090216181424
It's not strictly an error but it can be rather confusing.
]
[Put an explanation of the config file format at the top in comments.
Duncan Coutts <duncan at haskell.org>**20090215190817]
[Change the field order in the initial config file.
Duncan Coutts <duncan at haskell.org>**20090215190727
Also update the name of one excluded field.
]
[Put the default logging and reporting setting in the initial config file.
Duncan Coutts <duncan at haskell.org>**20090215190524]
[Complete the implementation of --build-summary=TEMPLATE
Duncan Coutts <duncan at haskell.org>**20090215190254
Actually respect the new flag. It's actually a list of template files
and all specified files get written to. This allows us to specify
a default build log file and also have the user write to extra ones.
The summary file template can contain $pkgid $compiler etc.
]
[Rearrange user interface for build logging
Duncan Coutts <duncan at haskell.org>**20090215185800
The new options (as described in ticket #501) are:
--build-summary=TEMPLATE
--build-log=TEMPLATE
--remote-build-reporting=LEVEL
where LELVEL `elem` [none,anonymous,detailed]
]
[always check environment variables for HTTP proxy first
Ganesh Sittampalam <ganesh.sittampalam at credit-suisse.com>**20090210230736]
[Improve the cabal update notice
Duncan Coutts <duncan at haskell.org>**20090209211844]
[Don't report that packages are cached at the default verbosity level
Duncan Coutts <duncan at haskell.org>**20090209201228
It's just not that useful. Report it at -v verobisty level, and
change the text and formatting.
]
[Fix #490, unpack now gives a proper error message.
Andrea Vezzosi <sanzhiyan at gmail.com>**20090208165240
Ignore-this: 358dd291624f8858a52ae2ff27a7e0c2
]
[Use the new withTempDirectory function
Duncan Coutts <duncan at haskell.org>**20090202012255
In particular it means that install will unpack packages into
different temp dirs on each invocation which means that running
install on the same package for different compilers at the same
time should not clash. This is quite useful for testing.
]
[Add compat withTempDirectory function
Duncan Coutts <duncan at haskell.org>**20090202011917
This is already in Cabal HEAD but we cannot use that yet
]
[Add homepage and bug-reports fields to .cabal file
Duncan Coutts <duncan at haskell.org>**20090201225021]
[Remove the prefernece and cabal lib version flags from the InstallFlags
Duncan Coutts <duncan at haskell.org>**20090126012412
They are now in the ConfigExFlags instead.
]
[Change the install and configure modules to use the extended config flags
Duncan Coutts <duncan at haskell.org>**20090126011942]
[Add ConfigExFlags into the configure, install and upgrade commands
Duncan Coutts <duncan at haskell.org>**20090126010918
Not yet passed all the way through.
]
[Add ConfigExFlags and related command
Duncan Coutts <duncan at haskell.org>**20090126010132
This is for configure flags that we use in the configure command in the
cabal command line tool that are not present in runghc Setup configure
command line interface. These are flags that we are moving from the
install command, so that we can also use them for the configure command.
Initially it's just the flags for specifying package version preferences
and the cabal library version. We'll add constraints later.
]
[Remove unnecessary qualified use of ConfigFlags
Duncan Coutts <duncan at haskell.org>**20090126003951]
[Make configure use the dependency resolver
Duncan Coutts <duncan at haskell.org>**20090125170951
This means it makes smarter decisions and also decions that are more
consistent with those taken by the install command.
]
[Update HTTP dep in the bootstrap script
Duncan Coutts <duncan at haskell.org>**20090123160700]
[Improve error message when ghc or ghc-pkg are mismatched or not found
Duncan Coutts <duncan at haskell.org>**20090123160550]
[Don't use grep -e, solaris does not like it
Duncan Coutts <duncan at haskell.org>**20090123160443]
[Fix some FIXMEs and do some TODOs in the list command
Duncan Coutts <duncan at haskell.org>**20090123004810
Now properly prints if the haddock docs are installed and if the
tarball is cached. It did print them before but it was lying.
]
[Add initial implementation of cabal info
Duncan Coutts <duncan at haskell.org>**20090119025202
It provides more detailed information on a particular package.
Still a few TODOs. Fixes #361, #449 and #456.
]
[Only print the config file location for the global --help
Duncan Coutts <duncan at haskell.org>**20090116175900]
[Update to using HTTP-4000.x
Duncan Coutts <duncan at haskell.org>**20090116135646
This should fix a long-standing bug with http proxies (ticket #352)
It should also make downloads faster, or at least use less memory.
]
[Parse compiler field from old config files correctly
Duncan Coutts <duncan at haskell.org>**20090116002851
Really old versions of cabal-install generated a default config
containing "compiler: GHC". Sadly the new way we generate the
config file parser from the command line parser means we end up
with a case-sensitive parser as it only matches the exact
command line flags. So we hack it and add in a traditional
parser for that field only. Really the command line and config
file infrastructure needs rewriting again. Sigh.
]
[Improve the printing of config file field parse error messages
Duncan Coutts <duncan at haskell.org>**20090116001421]
[Read install dirs correctly from old-style .cabal/config files
Duncan Coutts <duncan at haskell.org>**20090116001321
Should fix ticket #365
]
[Note in the README that zlib needs the zlib C lib package
Duncan Coutts <duncan at haskell.org>**20090116000541]
[Traditional /bin/sh portability fixes for bootstrap.sh
Duncan Coutts <duncan at haskell.org>**20090115113227]
[More improvments to the bootstrap.sh script
Duncan Coutts <duncan at haskell.org>**20090115110612]
[Rewrite the bootstrap.sh script
Duncan Coutts <duncan at haskell.org>**20090115102210
Hopefully more useful and more robust. In particular it does not
download and install packages where suitable versions are already
installed. It also checks for deps.
]
[Don't add installed constraints system packages that are not installed
Duncan Coutts <duncan at haskell.org>**20090114143540
In particular fixes a problem (ticket #439) where we required the
installed version of ghc-prim with compilers that do not have that
package such as ghc-6.8 and older, hugs, nhc, lhc etc.
]
[cabal update now reports if a newer version of cabal-install is available
Duncan Coutts <duncan at haskell.org>**20090114133220]
[Warn if a package index from a remote repo is 15 days or older
Duncan Coutts <duncan at haskell.org>**20090114124827
For example it will print:
Warning: The package list for 'hackage.haskell.org' is 16 days old.
Run 'cabal update' to get the latest list of available packages.
]
[Don't display the category in cabal list output
Duncan Coutts <duncan at haskell.org>**20090114003549
It is probably not sufficiently useful to justify the space it takes.
]
[In cabal list, always display available and installed versions
Duncan Coutts <duncan at haskell.org>**20090114003329
Previously we omitted the line if it was not installed, or was
not available. However that confused people because it was not
obvious that it would list both. Now it shows something like:
* foo
Latest version available: 1.0
Latest version installed: [ Not installed ]
]
[Print the location of the config file in the global --help
Duncan Coutts <duncan at haskell.org>**20090113192215
Ticket #413
]
[Improve the cabal --help output
Duncan Coutts <duncan at haskell.org>**20090113192058
Put the general info message at the top and make the explanation of
installing a hackage package somewhat clearer.
]
[Display examples in cabal install --help
Duncan Coutts <duncan at haskell.org>**20090113161426
Examples:
cabal install Package in the current directory
cabal install foo Package from the hackage server
cabal install foo-1.0 Specific version of a package
cabal install 'foo < 2' Constrained package version
]
[Print a newline after entering upload password
Duncan Coutts <duncan at haskell.org>**20090113142604
So we end up with:
Hackage password:
Uploading test.tar.gz...
rather than:
Hackage password: Uploading test.tar.gz...
]
[Respect the --package-db flag when compiling Setup.hs
Duncan Coutts <duncan at haskell.org>**20081221184755
Fixes ticket #394.
]
[Use a more precise package substitution test in improvePlan
Duncan Coutts <duncan at haskell.org>**20081219215922
This is where we take a valid plan and we "improve" it by swapping
installed packages for available packages wherever possible. This
change is to the condition we use in deciding if it is safe to use
the installed package in place of a reinstall. Previously we checked
that the dependencies of the installed version were exactly the same
as the dependencies we were planning to reinstall with. That was
valid but rather conservative. It caused problems in some situations
where the installed package did not exactly match the available
package (eg when using development versions of a package or of ghc).
What we do now is test if the extra constraints implied by selecting
the installed version are consistent with the existing set of
constraints. This involves threading the constraint set around. In
theory this should even cope with adding additional packages to the
plan as a result of selecting an installed package.
]
[Use installed constraints instead of hiding versions of the base package
Duncan Coutts <duncan at haskell.org>**20081219193740
We want to stop cabal-install from accidentally trying to upgrade
the base package since this doesn't work in most cases. We used to
achieve that by deleting the base package from the available package
index. We now do it by leaving the package index as is and instead
adding a constraint that we pick only an installed version of base.
This is a nicer hack and has the potential to give better error
messages.
]
[Extend the invariant on the Constraints ADT
Duncan Coutts <duncan at haskell.org>**20081219192309
It now carries around the original version of the database
purely so that it can do a much more extensive consistency
check. Packages are never gained or lost, just transfered
between pots in various slightly tricky ways.
]
[Fix constraint set handling for installed constraints
Duncan Coutts <duncan at haskell.org>**20081219182328
A rather subtle bug. The code was actually correct but the transitionsTo
assertion was not accounting for a transition between the case where
a package's available version had been excluded and then the whole thing
got excluded by a version constraint. It counted one side as a loss
without a corresponding gain on the other side.
]
[Add a install/upgrade --preference='foo < 2' flag
Duncan Coutts <duncan at haskell.org>**20081218213849
This behaves just like the preferred-versions file in the hackage index
but it can be specified on the command line or in a config file.
]
[Generalise the way preferences are specified to the resolver
Duncan Coutts <duncan at haskell.org>**20081218204917
We still provide a default global policy, but now we give a
list of per-package preferences which can be on the version
or installed state. Later preferences override earlier ones.
]
[Workaround for a url parsing bug that breaks http proxies that need auth
Duncan Coutts <duncan at haskell.org>**20081218165541
Diagnosis and patch from Valery V. Vorotyntsev.
]
[Implement cabal install --constraint=
Duncan Coutts <duncan at haskell.org>**20081216235032
Connect up the existing user interface with the new dep resolver api.
]
[Have the dep resolver take constraints and targets separately
Duncan Coutts <duncan at haskell.org>**20081216233446]
[Add PackageInstalledConstraint to the PackageConstraint type
Duncan Coutts <duncan at haskell.org>**20081215224538
This should be useful for things like preventing upgrading
the base package for ghc.
]
[A bit more renaming in the top down resolver
Duncan Coutts <duncan at haskell.org>**20081215224324]
[Take preferences into account in the bogus resolver
Duncan Coutts <duncan at haskell.org>**20081215221728]
[Mostly renaming and trivial refactoring
Duncan Coutts <duncan at haskell.org>**20081215221034]
[Change the dep resolver interface to pass constraints separately from targets
Duncan Coutts <duncan at haskell.org>**20081215215634
This lets us specify constraints for packages that are not targets.
]
[Rename and rearrange the PackagePreferences type
Duncan Coutts <duncan at haskell.org>**20081215204836]
[Don't re-export PackageName from Distribution.Client.Dependency
Duncan Coutts <duncan at haskell.org>**20081215203617
It used to be a type alias.
]
[Use the Platform type rather than passing around the OS and Arch separately
Duncan Coutts <duncan at haskell.org>**20081215202856]
[Bump version to 0.6.1
Duncan Coutts <duncan at haskell.org>**20081210224713]
[Tidy up the unpack code
Duncan Coutts <duncan at haskell.org>**20081210223633
Also fix a bug for tar files that contain entries for files
without preceding entries for the directories they are in.
]
[Clean up the code in Main
Duncan Coutts <duncan at haskell.org>**20081210223242
Make the names more regular and set up the various flags
in a more regular way.
]
[Use (\_ -> []) instead of mempty to avoid funky Monoid instance
Duncan Coutts <duncan at haskell.org>**20081210223106
This would let us build with ghc-6.4 or nhc if it were not for other issues.
]
[Fix warning aobut -fffi in OPTIONS pragma
Duncan Coutts <duncan at haskell.org>**20081203005449]
[Mention where files get downloaded to at verbosity level verbose
Duncan Coutts <duncan at haskell.org>**20081203004427]
[Implement 'cabal unpack' command as in #390
Andrea Vezzosi <sanzhiyan at gmail.com>**20081113185923]
[Remove use of tabs
Duncan Coutts <duncan at haskell.org>**20081122163527]
[Put explicit lower bound on version of base
Duncan Coutts <duncan at haskell.org>**20081122163151
It does not build with ghc-6.4.2, missing Functor instance for Either.
]
[Use a more general fix for "cabal install base"
Duncan Coutts <duncan at haskell.org>**20081122163026
It's not specific to LHC. Normally we prevent upgrading of base
since it's unlikely to work and would normally be accidental.
However when the user explicitly asks to upgrade base then we
let them do that and they can keep the pieces when it breaks.
]
[Warn about use of tabs
Duncan Coutts <duncan at haskell.org>**20081122154309]
[Only send the base file name when uploading tarballs
Duncan Coutts <duncan at haskell.org>**20080903230334
The server should ignore the dir part anyway but there's no
need to send it in the first place.
]
[Slightly better lhc support.
Lemmih <lemmih at gmail.com>**20081121034338
Ignore-this: 9f51f465aa87d1c6677ca492f877ecd6
]
[TAG 0.6.0
Duncan Coutts <duncan at haskell.org>**20081011195420]
[Bump version to 0.6.0
Duncan Coutts <duncan at haskell.org>**20081011195314]
[Improve the README, better install instructions
Duncan Coutts <duncan at haskell.org>**20081011185919
And slightly better intro guide to the main commands.
]
[Bump versions of deps in the bootstrap script
Duncan Coutts <duncan at haskell.org>**20081011184937]
[Add Eq for a couple types in the anon build reports
Duncan Coutts <duncan at haskell.org>**20081011184825]
[Drop silly export
Duncan Coutts <duncan at haskell.org>**20081011184805]
[Apparnetly builds with unix-2.0 which is what came with ghc-6.6
Duncan Coutts <duncan at haskell.org>**20081010234836]
[Fix the -i dir for compiling Setup.hs when it's the current dir
Duncan Coutts <duncan at haskell.org>**20081010234558
map "" to "."
]
[Tidy up the preferred-versions file parser
Duncan Coutts <duncan at haskell.org>**20081010070105]
[Bump version number and dependencies
Duncan Coutts <duncan at haskell.org>**20081010065854]
[Relax deps to build with ghc-6.10
Duncan Coutts <duncan at haskell.org>**20081007230701]
[Handle build reports with missing logs better
Duncan Coutts <duncan at haskell.org>**20081007230635]
[Add DownloadFailed as a possible failure for installation
Duncan Coutts <duncan at haskell.org>**20081007230418
Should now be caught during installing a bunch of packages
and not cause immediate overall failure. It should instead
be treated like any other package build failure and be
reported at the end and only affect other dependent builds.
]
[Fix search paths for compiling Setup.hs scrips
Duncan Coutts <duncan at haskell.org>**20081007213630
and in particular for bootstrapping the Cabal lib.
]
[Fix selecting paired packages
Duncan Coutts <duncan at haskell.org>**20081007062930
Previously when we selected base 4 (and as a consequence
slected base 3 too) we didn't properly trace the dependencies
of base 3 so if nothing actually required base 3 then we ended
up with base 3 in the solution but not with syb which it
depends on. Consequently the solution was invalid.
Now we select the paired package properly (hopefully).
]
[Take preferred versions into account in dependency planning
Duncan Coutts <duncan at haskell.org>**20081006055129
This means we can now globally prefer base 3 rather than 4.
However we need to be slightly careful or we end up deciding
to do silly things like rebuild haskell98 against base 3.
That would happen because the h98 package doesn't constrain
the choice to one or the other and we would prefer base 3.
So we have to add that we really prefer whatever it uses
currently (if any).
]
[Pass the package suggested version constraints through to the resolver
Duncan Coutts <duncan at haskell.org>**20081006042758
Not used yet.
]
[Fix selection of paired packages
Duncan Coutts <duncan at haskell.org>**20081006040616]
[Read preferred versions from the package index
Duncan Coutts <duncan at haskell.org>**20081006030259
From a file named 'preferred-versions' in the 00-index.tar.gz
If there are several they are combined. Contents is like:
base < 4
one suggested version constraint per line.
]
[Refactor and update the hackage index reading code
Duncan Coutts <duncan at haskell.org>**20081005202747]
[Print more details about what is to be installed with -v
Duncan Coutts <duncan at haskell.org>**20081005075556
Reports if installs are new or reinstalls and for reinstalls
prints what dependencies have changed.
]
[When finalising paired packages, cope with there being multiple choices
Duncan Coutts <duncan at haskell.org>**20081005053821
For ordinary packages we selected a single version which means
we added an equality constraint. As a consequence we used to
assume there was only one version left when finalising. For
paired packages there may be two versions left if the package
did not directly constrain the choice to just one. If there is
more than one version remaining then we have to pick between
them. At the moment we still pick the highest version, but
later we can take a global preference or polciy into account.
]
[When selecting paired packages, select both.
Duncan Coutts <duncan at haskell.org>**20081005053804]
[Handle constraints on paired packages
Duncan Coutts <duncan at haskell.org>**20081005051919
The trick is that when applying constraints to paired
packages, the constraint has to exclude both packages at
once. We exclude the pair together or not at all. If it
would only exclude one then we discard the constraint.
]
[Add the notion of paired packages to the Constraints ADT
Duncan Coutts <duncan at haskell.org>**20081005013141
Packages like base-3 and base-4 are paired. This means they are
supposed to be treated equivalently in some contexts. Paired
packages are installed packages with the same name where one
version depends on the other.
]
[Make InstalledPackage an instance of PackageFixedDeps
Duncan Coutts <duncan at haskell.org>**20081005012741]
[Add the glue code to actully report excluded packages
Duncan Coutts <duncan at haskell.org>**20081005001400
Now displayed in the output of install --dry-run -v
]
[Have Constraints.constrain report the excluded packages
Duncan Coutts <duncan at haskell.org>**20081004235006
Each time we apply a constraint we can end up excluding some
extra package. Report that list of packages because it is
quite interesting information to get insight into what the
resolver is actually doing.
]
[Separate the construction of the exclusion list from its use
Duncan Coutts <duncan at haskell.org>**20081004234421
Previously directly inserted packages into the excluded package
list. Now we generate a list of them and then add them. We want
the list of newly excluded packages separately because it is
interesting information to report to the user when -v is on.
]
[Generalise the logging of selected and discarded packages
Duncan Coutts <duncan at haskell.org>**20081004232555
Allow for selecting several packages in one go.
Currently when we select a package we only list the over versions
of the same package that that excludes, and not the other packages
we exclude by applying the dependency constraints of the selected
package. In future we would like to do that so we now report the
package name of discards not just the version. Though we do group
by the package name to avoid too much repition.
]
[Fix infinite loop in the TopDown dependency resolver
Andrea Vezzosi <sanzhiyan at gmail.com>**20080925181441
The loop occurred only if a package depended on another one
with the same name, e.g. base-3.0.3.0 <- base-4.0.0.0
]
[small improvements to bootstrap
Duncan Coutts <duncan at haskell.org>**20080926214828
patch sent in by brian0, ticket #357
]
[Update to the development version of the Cabal lib
Duncan Coutts <duncan at haskell.org>**20080831225243
The branch of cabal-install that tracks Cabal-1.4 now lives at
http://darcs.haskell.org/cabal-branches/cabal-install-0.5/
]
[Allow use of curl in bootstrap.sh
Duncan Coutts <duncan at haskell.org>**20080826233400
Patch from jsnx. Fixes ticket #343. Also, use "cd blah; cd .."
instead of "pushd blah; popd" as some shells lack pushd/popd
]
[Relax version constraint on unix package
Duncan Coutts <duncan at haskell.org>**20080826232851
Allows building with ghc-6.6.1
]
[Use mplus not mappend for combining tar filename checks
Duncan Coutts <duncan at haskell.org>**20080826232606
mappend would join the error messages in the case that both
checks failed. Also the monoid instance was new in base 3.
]
[TAG 0.5.2
Duncan Coutts <duncan at haskell.org>**20080826214238]
Patch bundle hash:
70c40d9a31b3a8bedec43eacacdf7c79bb11b86e
More information about the cabal-devel
mailing list