2012-01-10 6 views
5

パッケージをインストールするときにcabalの動作が見つかりました。例えば、"cabal install ___"は、以前にインストールされたパッケージを破棄します。

cabal install funsat 

インストール旧arrayのバージョン、timerandomquickcheck、およびbitsetmonadiccphoogleheistsnapのようなパッケージを壊すなど

を実行すると、それは背中とcabal install monadiccp行くために働きますインストールされたパッケージを破壊するデフォルトの動作を避けるにはどうすればよいですか?​​またはzypperのような合理的なLinuxパッケージマネージャーはとなります。新しいパッケージをインストールするときに、すでにインストール済みのパッケージを中断したいかどうかを質問します。

誰か回避策スクリプトを作成しましたか?前もって感謝します。

+1

http://ivanmiljenovic.wordpress.com/2010/03/15/repeat-after-me-cabal-is-not-a-package-manager/ –

+0

@ MatveyB.Aksenov、どのようなI (a)cabal/= cabal-installだった、私はすでに知っていたが、あまり気にしない(b)システムパッケージマネージャを使用する(c)システムパッケージがない場合は、gentooに切り替えてください。残念ながら、(c)は本当に私の選択肢ではありません。 – gatoatigrado

答えて

8

私はcabal-devをお勧めします。これはあなたが作業するプロジェクトごとに別々のパッケージをインストールしています。これは一般的なcabal-installの悪い行為を解決するものではありませんが、そのような失敗は他の方法よりも孤立しており、簡単にcabal-dev clean && cabal-dev installを実行することで修正できます。

再現可能なビルドの利点もあります。

確かに、これはあなたの特定の問題の回避策ではありませんが、一般的なカバインストールの痛みを軽減します。


ダニエル・フィッシャーの答えのビルが、ここでは、パッケージを再インストールするかどうインストールを中止しますcabalのラッパーです:

cabal() { 
    if [ "$1" = "install" ]; then 
    local out=$(command cabal --dry-run -v2 "[email protected]" 2>&1) 
    if echo "$out" | egrep -c '\((reinstall|new version)\)' >/dev/null; then 
     echo "$out" 
     return 1 
    fi 
    fi 
    command cabal "[email protected]" 
} 

YMMV。私はこれを軽くテストしただけで、すべての依存関係を2回計算する必要があるため、起動時に迷惑な遅延が発生します。しかし、あなたが安全な側に滞在したい場合は、それはいくつかの退屈を緩和する必要があります。

+0

+1私はこれについて知りませんでした、ありがとう...私はこれがハスケルのPythonのvirtualenvのequivだと思います。 –

+0

zshの場合は、ローカルを削除してください(とにかくインストール方法 - http://pastebin.com/PGYWqdKA)。 funsatの例(インストールを中止する)ではうまくいくと思われ、何も破壊しなかった 'repa'のインストールを許可しました。ほんとありがと!! – gatoatigrado

+0

でも 'command'について知っておいて嬉しいですが、今度は他のシェル関数のいくつかを解くことができます。 – gatoatigrado

5

回避方法:常に--dry-runにチェックしてください。キャバルがパッケージを再インストールする場合は、注意してください。

2

これは既知の問題です(this slide deck、スライド22から始まります)。 cabal-installdarcs get http://darcs.haskell.org/cabal)のDarcsバージョンでは、パッケージをインストールするとシステムが壊れることがあるという警告が表示されるようになりました。例:

$ cabal --version 
cabal-install version 0.13.3 
using version 1.13.3 of the Cabal library 
$ cabal install monadiccp 
[...] 
$ cabal install funsat 
Resolving dependencies... 
In order, the following would be installed: 
mtl-1.1.1.1 (new version) 
syb-0.3.6 (new package) 
array-0.2.0.0 (new version) 
containers-0.2.0.1 (new version) 
bimap-0.2.4 (new package) 
deepseq-1.2.0.1 (reinstall) changes: array-0.3.0.2 -> 0.2.0.0 
fgl-5.4.2.2 (new package) 
text-0.11.1.12 (reinstall) changes: array-0.3.0.2 -> 0.2.0.0 
parsec-3.1.2 (reinstall) changes: mtl-2.0.1.0 -> 1.1.1.1 
parse-dimacs-1.2 (new package) 
time-1.1.4 (new version) 
random-1.0.0.3 (reinstall) changes: time-1.2.0.3 -> 1.1.4 
QuickCheck-1.2.0.1 -base3 (new package) 
bitset-0.6 (new package) 
funsat-0.6.1 (new package) 
cabal: The install plan contains reinstalls which can break your GHC 
installation. 
You can use the --avoid-reinstalls option to try to avoid this or try 
to ghc-pkg unregister the version of the package version to see its effect 
on reverse dependencies. If you know what you are doing you can use 
the --override-reinstall-check option to override this reinstall check.
関連する問題