Patch for --global for bootstrap.sh

Dino Morelli dino at ui3.info
Sat Jun 13 11:30:23 EDT 2009


>   I'm not sure whether this will have the desired effect in all
>   cases; however, it works for me. I've long desired a
>   `--global` installation for cabal and this seems to at least
>   get the bootstrap right.
> 
> --
> Jason Dusek

I've taken this code, added to it and integrated it into cabal-install 0.7
And then tested it with this setup:

    Debian GNU/Linux squeeze (testing)
    GHC 6.10.3
    Cabal 1.7.2
    cabal-install 0.7

darcs patch attached with the changes below. Thanks Jason!


- Dino Morelli


-----
Sat Jun 13 11:09:58 EDT 2009  Dino Morelli <dino at ui3.info>
   * Now supporting explicit --user or --global switches in bootstrap.sh with usage feedback for bad args
   This change was adapted from work submitted to the cabal-devel mailing list by Jason Dusek.
     {
     hunk ./bootstrap.sh 21
     +SCOPE_OF_INSTALLATION="--user"
     +
     +
     +for arg in $*
     +do
     +  case "${arg}" in
     +    "--user")
     +      SCOPE_OF_INSTALLATION=${arg}
     +      shift;;
     +    "--global")
     +      SCOPE_OF_INSTALLATION=${arg}
     +      PREFIX="/usr/local"
     +      shift;;
     +    *)
     +      echo "Unknown argument or option, quitting: ${arg}"
     +      echo "usage: bootstrap.sh [OPTION]"
     +      echo
     +      echo "options:"
     +      echo "   --user    Install for the local user (default)"
     +      echo "   --global  Install systemwide"
     +      exit;;
     +  esac
     +done
     hunk ./bootstrap.sh 164
     -  ./Setup configure --user "--prefix=${PREFIX}" \
     +  ./Setup configure ${SCOPE_OF_INSTALLATION} "--prefix=${PREFIX}" \
     }
-----

-- 
Dino Morelli  email: dino at ui3.info  web: http://ui3.info/d/  irc: dino-
pubkey: http://ui3.info/d/dino-4AA4F02D-pub.gpg
-------------- next part --------------
Sat Jun 13 11:09:58 EDT 2009  Dino Morelli <dino at ui3.info>
  * Now supporting explicit --user or --global switches in bootstrap.sh with usage feedback for bad args
  This change was adapted from work submitted to the cabal-devel mailing list by Jason Dusek.

New patches:

[Now supporting explicit --user or --global switches in bootstrap.sh with usage feedback for bad args
Dino Morelli <dino at ui3.info>**20090613150958
 Ignore-this: 490a4fcdd5bc1940d6f32d71b0a042a5
 This change was adapted from work submitted to the cabal-devel mailing list by Jason Dusek.
] {
hunk ./bootstrap.sh 21
 CURL=${CURL:-curl}
 TAR=${TAR:-tar}
 GUNZIP=${GUNZIP:-gunzip}
+SCOPE_OF_INSTALLATION="--user"
+
+
+for arg in $*
+do
+  case "${arg}" in
+    "--user")
+      SCOPE_OF_INSTALLATION=${arg}
+      shift;;
+    "--global")
+      SCOPE_OF_INSTALLATION=${arg}
+      PREFIX="/usr/local"
+      shift;;
+    *)
+      echo "Unknown argument or option, quitting: ${arg}"
+      echo "usage: bootstrap.sh [OPTION]"
+      echo
+      echo "options:"
+      echo "   --user    Install for the local user (default)"
+      echo "   --global  Install systemwide"
+      exit;;
+  esac
+done
 
 
 # Versions of the packages to install.
hunk ./bootstrap.sh 164
     || die "Compiling the Setup script failed"
   [ -x Setup ] || die "The Setup script does not exist or cannot be run"
 
-  ./Setup configure --user "--prefix=${PREFIX}" \
+  ./Setup configure ${SCOPE_OF_INSTALLATION} "--prefix=${PREFIX}" \
     --with-compiler=${GHC} --with-hc-pkg=${GHC_PKG} \
     ${EXTRA_CONFIGURE_OPTS} ${VERBOSE} \
     || die "Configuring the ${PKG} package failed"
}

Context:

[Fix sdist
Duncan Coutts <duncan at haskell.org>**20090605023441
 Fix handling of base dir in tar file creation.
] 
[Fix use of deprecated version constructors
Duncan Coutts <duncan at haskell.org>**20090604180500] 
[Only report preferred new versions of cabal-install are available
Duncan Coutts <duncan at haskell.org>**20090604175726
 That is, use the "preferred-versions" mechanism when deciding
 whether there is a new version available. This would allow us to
 upload a new version without everyone immediately being told to
 get it and try it out.
] 
[Make cabal upload/check print out the error messages reported by the server
Duncan Coutts <duncan at haskell.org>**20090604124836
 The code to do it was already there but we were checking for the
 mime type text/plain using just (==) when in fact the server reports  
   text/plain; charset="ISO-8859-1"
 so we have to parse the field a bit better (still a bit of a hack).
] 
[Require latest Cabal lib version
Duncan Coutts <duncan at haskell.org>**20090603102312] 
[Improve formatting of cabal check output
Duncan Coutts <duncan at haskell.org>**20090603102254] 
[Only apply preferences to base if its version is unbounded above
Duncan Coutts <duncan at haskell.org>**20090603101623
 Fixes ticket #485. This means that for constraints like:
     build-depends: base >= 3 && < 5
 we will pick version 4. However we will continue to apply the
 version 3 preference for things like:
     build-depends: base >= 3
 Where there is no upper bound on the version. Note that we now
 also ignore preferences for base given on the command line.
 We should implement #483 to split prefs from shims.
] 
[Improve the parse error message for package name/deps
Duncan Coutts <duncan at haskell.org>**20090321154623
 Make it clear that it's the specification of the package name that
 is at fault rather than the package to which the name refers.
] 
[Debian in their wisdom decided to build network against parsec 3.
Duncan Coutts <duncan at haskell.org>**20090308142925
 So checking for parsec 2 fails. We don't strictly need parsec, it's
 just a dependency of network, so remove the check.
] 
[Simplify version ranges before printing in error messages
Duncan Coutts <duncan at haskell.org>**20090531191346
 Part of ticket #369
] 
[Use new top handler, should get better error messages
Duncan Coutts <duncan at haskell.org>**20090531190318] 
[Fix uses of deprecated stuff
Duncan Coutts <duncan at haskell.org>**20090531190239] 
[New development branch, version 0.7
Duncan Coutts <duncan at haskell.org>**20090531184336
 Update to development version of Cabal
] 
[Solaris 9 /bin/sh doesn't like the ! syntax in bootstrap.sh
Duncan Coutts <duncan at haskell.org>**20090318091730] 
[Clarify the instructions in the README and bootstrap.sh
Duncan Coutts <duncan at haskell.org>**20090315125407
 Addresses the complaint in ticket #523.
] 
[Select Configuration file via env var CABAL_CONFIG.
Paolo Losi <paolo.losi at gmail.com>**20090223005251
 Ignore-this: 26e5ded85cb69cb3a19cd57680a8a362
] 
[Update tar code based on new tar package
Duncan Coutts <duncan at haskell.org>**20090301174949] 
[Actually does compile with unix-1.0 that comes with ghc-6.6
Duncan Coutts <duncan at haskell.org>**20090221154605
 ghc-6.6.1 came with unix-2.1
] 
[TAG 0.6.2
Duncan Coutts <duncan at haskell.org>**20090219130720] 
Patch bundle hash:
9f8b08855ef7521bb1560cba7a557fb89870df9c


More information about the cabal-devel mailing list