Difference between revisions of "PkgEnv"

From HaskellWiki
Jump to: navigation, search
(Deleting page that hasn't been edited for over 10 years)
m (Reverted edits by Tomjaguarpaw (talk) to last revision by Paolosi)
 
Line 1: Line 1:
  +
== PkgEnv ==
  +
  +
=== Session Example ===
  +
  +
We start creating a new package environment:
  +
  +
<pre>
  +
hypermac:trash paolo$ pkgenv binary.env
  +
Using GHC 6.10.1 (full path: /opt/local/bin/ghc-6.10.1)
  +
Using cabal-install 0.6.2 (full path: /Users/paolo/.cabal/bin/cabal)
  +
Installing package environment in /Users/paolo/trash/binary.env.
  +
Done!
  +
  +
Usage:
  +
  +
bash> source /Users/paolo/trash/binary.env/bin/activate
  +
(binary.env)bash> deactivate
  +
bash>
  +
hypermac:trash paolo$
  +
</pre>
  +
  +
We activate the new environment (the bash prompt is changed accordingly):
  +
  +
<pre>
  +
hypermac:trash paolo$ source binary.env/bin/activate
  +
(binary.env)hypermac:trash paolo$
  +
</pre>
  +
  +
All tools run now by default on the system package DB and the
  +
newly created/empty user package DB:
  +
  +
<pre>
  +
(binary.env)hypermac:trash paolo$ ghc-pkg list
  +
/opt/local/lib/ghc-6.10.1/./package.conf:
  +
Cabal-1.6.0.1, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
  +
base-3.0.3.0, base-4.0.0.0, bytestring-0.9.1.4, containers-0.2.0.0,
  +
directory-1.0.0.2, (dph-base-0.3), (dph-par-0.3),
  +
(dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
  +
(dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.1, (ghc-6.10.1),
  +
ghc-prim-0.1.0.0, haddock-2.3.0, haskell-src-1.0.1.3,
  +
haskell98-1.0.1.0, hpc-0.5.0.2, html-1.0.1.2, integer-0.1.0.0,
  +
mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1,
  +
packedstring-0.1.0.1, parallel-1.1.0.0, parsec-2.1.0.1,
  +
pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1,
  +
regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
  +
rts-1.0, stm-2.1.1.2, syb-0.1.0.0, template-haskell-2.3.0.0,
  +
time-1.1.2.2, unix-2.3.1.0, xhtml-3000.2.0.1
  +
/Users/paolo/trash/binary.env/ghc-packages.conf:
  +
</pre>
  +
  +
Let's install a package inside the new environment:
  +
  +
<pre>
  +
(binary.env)hypermac:trash paolo$ cabal install --verbose=0 binary
  +
Reading package info from "dist/installed-pkg-config" ... done.
  +
Writing new package config file... done.
  +
(binary.env)hypermac:trash paolo$ ghc-pkg list
  +
/opt/local/lib/ghc-6.10.1/./package.conf:
  +
Cabal-1.6.0.1, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
  +
base-3.0.3.0, base-4.0.0.0, bytestring-0.9.1.4, containers-0.2.0.0,
  +
directory-1.0.0.2, (dph-base-0.3), (dph-par-0.3),
  +
(dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
  +
(dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.1, (ghc-6.10.1),
  +
ghc-prim-0.1.0.0, haddock-2.3.0, haskell-src-1.0.1.3,
  +
haskell98-1.0.1.0, hpc-0.5.0.2, html-1.0.1.2, integer-0.1.0.0,
  +
mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1,
  +
packedstring-0.1.0.1, parallel-1.1.0.0, parsec-2.1.0.1,
  +
pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1,
  +
regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
  +
rts-1.0, stm-2.1.1.2, syb-0.1.0.0, template-haskell-2.3.0.0,
  +
time-1.1.2.2, unix-2.3.1.0, xhtml-3000.2.0.1
  +
/Users/paolo/trash/binary.env/ghc-packages.conf:
  +
binary-0.4.4
  +
</pre>
  +
  +
We can now use the new package:
  +
  +
<pre>
  +
(binary.env)hypermac:trash paolo$ ghci
  +
GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help
  +
Loading package ghc-prim ... linking ... done.
  +
Loading package integer ... linking ... done.
  +
Loading package base ... linking ... done.
  +
Prelude> import Data.Binary
  +
Prelude Data.Binary>
  +
</pre>
  +
  +
and leave the environment:
  +
  +
<pre>
  +
(binary.env)hypermac:trash paolo$ deactivate
  +
hypermac:trash paolo$
  +
</pre>
  +
  +
and when you're done with the environment, simply remove it:
  +
  +
<pre>
  +
hypermac:trash paolo$ rm -rf binary.env
  +
</pre>

Latest revision as of 15:19, 6 February 2021

PkgEnv

Session Example

We start creating a new package environment:

hypermac:trash paolo$ pkgenv binary.env
Using GHC 6.10.1 (full path: /opt/local/bin/ghc-6.10.1)
Using cabal-install 0.6.2 (full path: /Users/paolo/.cabal/bin/cabal)
Installing package environment in /Users/paolo/trash/binary.env.
Done!

Usage:

  bash> source /Users/paolo/trash/binary.env/bin/activate
  (binary.env)bash> deactivate
  bash>
hypermac:trash paolo$  

We activate the new environment (the bash prompt is changed accordingly):

hypermac:trash paolo$ source binary.env/bin/activate 
(binary.env)hypermac:trash paolo$

All tools run now by default on the system package DB and the newly created/empty user package DB:

(binary.env)hypermac:trash paolo$ ghc-pkg list
/opt/local/lib/ghc-6.10.1/./package.conf:
    Cabal-1.6.0.1, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
    base-3.0.3.0, base-4.0.0.0, bytestring-0.9.1.4, containers-0.2.0.0,
    directory-1.0.0.2, (dph-base-0.3), (dph-par-0.3),
    (dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
    (dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.1, (ghc-6.10.1),
    ghc-prim-0.1.0.0, haddock-2.3.0, haskell-src-1.0.1.3,
    haskell98-1.0.1.0, hpc-0.5.0.2, html-1.0.1.2, integer-0.1.0.0,
    mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1,
    packedstring-0.1.0.1, parallel-1.1.0.0, parsec-2.1.0.1,
    pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1,
    regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
    rts-1.0, stm-2.1.1.2, syb-0.1.0.0, template-haskell-2.3.0.0,
    time-1.1.2.2, unix-2.3.1.0, xhtml-3000.2.0.1
/Users/paolo/trash/binary.env/ghc-packages.conf:

Let's install a package inside the new environment:

(binary.env)hypermac:trash paolo$ cabal install --verbose=0 binary
Reading package info from "dist/installed-pkg-config" ... done.
Writing new package config file... done.
(binary.env)hypermac:trash paolo$ ghc-pkg list
/opt/local/lib/ghc-6.10.1/./package.conf:
    Cabal-1.6.0.1, HUnit-1.2.0.3, QuickCheck-1.2.0.0, array-0.2.0.0,
    base-3.0.3.0, base-4.0.0.0, bytestring-0.9.1.4, containers-0.2.0.0,
    directory-1.0.0.2, (dph-base-0.3), (dph-par-0.3),
    (dph-prim-interface-0.3), (dph-prim-par-0.3), (dph-prim-seq-0.3),
    (dph-seq-0.3), editline-0.2.1.0, filepath-1.1.0.1, (ghc-6.10.1),
    ghc-prim-0.1.0.0, haddock-2.3.0, haskell-src-1.0.1.3,
    haskell98-1.0.1.0, hpc-0.5.0.2, html-1.0.1.2, integer-0.1.0.0,
    mtl-1.1.0.2, network-2.2.0.1, old-locale-1.0.0.1, old-time-1.0.0.1,
    packedstring-0.1.0.1, parallel-1.1.0.0, parsec-2.1.0.1,
    pretty-1.0.1.0, process-1.0.1.0, random-1.0.0.1,
    regex-base-0.72.0.2, regex-compat-0.71.0.1, regex-posix-0.72.0.3,
    rts-1.0, stm-2.1.1.2, syb-0.1.0.0, template-haskell-2.3.0.0,
    time-1.1.2.2, unix-2.3.1.0, xhtml-3000.2.0.1
/Users/paolo/trash/binary.env/ghc-packages.conf:
    binary-0.4.4

We can now use the new package:

(binary.env)hypermac:trash paolo$ ghci
GHCi, version 6.10.1: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude> import Data.Binary
Prelude Data.Binary>

and leave the environment:

(binary.env)hypermac:trash paolo$ deactivate 
hypermac:trash paolo$ 

and when you're done with the environment, simply remove it:

hypermac:trash paolo$ rm -rf binary.env