IT박스

Cabal 패키지 버전을 제거하려면 어떻게해야합니까?

itboxs 2020. 9. 25. 07:40
반응형

Cabal 패키지 버전을 제거하려면 어떻게해야합니까?


Happstack Lite는 blaze-html 버전 0.5를 받고 있고 버전 0.4를 원하기 때문에 저를 깨고 있습니다. Cabal은 0.4.3.4 및 0.5.0.0 버전 모두 설치되어 있다고 말합니다 . 0.5.0.0을 제거하고 이전 버전 만 사용하고 싶습니다. 그러나 cabal에는 "uninstall"명령이 없으며을 시도 ghc-pkg unregister --force blaze-html하면 ghc-pkg명령이 무시되었다고합니다.

어떡하죠?

업데이트 : 그것을 믿지 마십시오 . ghc-pkg명령을 무시한다고 주장 하지만 명령 무시 되지 않습니다 . 그리고 Don Stewart의 대답으로 제거하려는 버전을 정확히 제거 할 수 있습니다.


다음 ghc-pkg unregister과 같이 특정 버전을 지정할 수 있습니다 .

$ ghc-pkg unregister --force regex-compat-0.95.1

충분합니다.


샌드 박스 외부에있는 경우 :

ghc-pkg unregister --force regex-compat-0.95.1

cabal 샌드 박스 안에있는 경우 :

cabal sandbox hc-pkg -- unregister attoparsec --force

첫 번째 --는에 대한 인수 구분 기호입니다 hc-pkg. 이것은 ghc-pkg샌드 박스 인식 방식으로 실행됩니다 .


명령 을 제공하는 cabal-uninstall 패키지 도 있습니다 cabal-uninstall. 패키지 등록을 취소하고 폴더를 삭제합니다. 그것이 통과가 있지만 그것은 언급 할 가치가있다 --force으로 ghc-pkg unregister는 다른 패키지를 중단 할 수 있습니다.


다음은 패키지를 제거하는 데 사용하는 셸 스크립트입니다. 설치된 여러 버전의 GHC를 지원하고 관련 파일도 삭제합니다 (그러나 보증없이 제공됩니다. 설치를 호스로 연결해도 저를 비난하지 마십시오!)

#!/bin/bash -eu
# Usage: ./uninstall.sh [--force | --no-unregister] pkgname-version

# if you set VER in the environment to e.g. "-7.0.1" you can use
# the ghc-pkg associated with a different GHC version
: ${VER:=}

if [ "$#" -lt 1 ]
then
        echo "Usage: $0 [--force | --no-unregister] pkgname-version"
        exit 1
fi

if [ "$1" == "--force" ]
then force=--force; shift; # passed to ghc-pkg unregister
else force=
fi

if [ "$1" == "--no-unregister" ]
then shift # skip unregistering and just delete files
else
        if [ "$(ghc-pkg$VER latest $1)" != "$1" ]
        then
                # full version not specified: list options and exit
                ghc-pkg$VER list $1; exit 1
        fi
        ghc-pkg$VER unregister $force $1
fi

# wipe library files
rm -rfv -- ~/.cabal/lib/$1/ghc-$(ghc$VER --numeric-version)/

# if the directory is left empty, i.e. not on any other GHC version
if rmdir -- ~/.cabal/lib/$1 
then rm -rfv -- ~/.cabal/share/{,doc/}$1 # then wipe the shared files as well
fi

참고 URL : https://stackoverflow.com/questions/10576868/how-can-i-uninstall-a-version-of-a-cabal-package

반응형