Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

bootstrap.sh ignores PREFIX environment variable #534

Closed
bos opened this Issue · 3 comments

1 participant

@bos
Owner

(Imported from Trac #541, reported by nr on 2009-04-19)

bootstrap.sh breaks if PREFIX is not $HOME/.cabal.
Patch (from git diff) below:

diff --git a/bootstrap.sh b/bootstrap.sh
index 79729af..29f2b65 100755
--- a/bootstrap.sh
+++ b/bootstrap.sh
@@ -132,7 +132,7 @@ install_pkg () {
     || die "Compiling the Setup script failed"
   [ -x Setup ] || die "The Setup script does not exist or cannot be run"
-  ./Setup configure --user "--prefix=${HOME}/.cabal" \
+  ./Setup configure --user "--prefix=$PREFIX" \
     --with-compiler=${GHC} --with-hc-pkg=${GHC_PKG} \
     ${EXTRA_CONFIGURE_OPTS} ${VERBOSE} \
     || die "Configuring the ${PKG} package failed"
@bos
Owner

(Imported comment by nr on 2009-04-19)

Followup: even with this patch, using $PREFIX does not work: a directory structure gets created in $PREFIX, but there is no config file, which results in this pain:

: nr@homedog 5523 ; cabal install -v graphmod
/usr/bin/ghc --numeric-version
looking for package tool: ghc-pkg near compiler in /usr/bin
found package tool in /usr/bin/ghc-pkg
/usr/bin/ghc-pkg --version
/usr/bin/ghc --supported-languages
Reading installed packages...
/usr/bin/ghc-pkg list
Warning: No remote package servers have been specified. Usually you would have
one specified in the config file.
cabal: There is no package named graphmod
: nr@homedog 5524 ;
@bos
Owner

(Imported comment by @dcoutts on 2009-04-19)

Thanks. It turns out this has been fixed in the dev version already:

Sun Mar 15 12:54:07 GMT 2009  Duncan Coutts <duncan@haskell.org>

  • Clarify the instructions in the README and bootstrap.sh Addresses the complaint in ticket #523.
See #523 for the improved wording of the README about doing update before the config file gets created.

Also, the PREFIX/HOME mistake was fixed in the same patch:

    hunk ./bootstrap.sh 135
- ./Setup configure --user "--prefix=${HOME}/.cabal" \
+ ./Setup configure --user "--prefix=${PREFIX}" \
However I do not understand the problem about no config file existing. When I remove the config file and the cached package index and try to install something I get:

$ cabal install graphmod
Config file /home/duncan/.cabal/config not found.
Writing default configuration to /home/duncan/.cabal/config
Warning: The package list for 'hackage.haskell.org' does not exist. Run
'cabal update' to download it.
cabal: There is no package named graphmod
It sounds like you've got a partial config file rather than none at all.

We cannot create the config file at install time because global installs cannot create per-user config files. The best we can do is to improve things so that the config file is always created on the first run and explained appropriately.

@bos
Owner

(Imported comment by nr on 2009-04-21)

I had a partial config file because I created one, since I was encouraged to by the output from some command or other.

I'm sympathetic to the problem of one install per system vs one config file per user. In that case I hope the Right Thing to do is that every time cabal (cabal-install) runs, it checks to see if ~/.cabal/config exists and if not, creates it. Unless that operation fails (with a suitable error messages), all other references to the file with then make sense. Even running

  cabal -h
should create the file.

A cabal-config man page in section 5 would be a bonus.

@bos bos closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.