¿Cómo puedo desinstalar una versión de un paquete Cabal?


Happstack Lite se está rompiendo en mí porque está recibiendo blaze-html versión 0.5 y quiere la versión 0.4. Cabal dice que ambas versiones 0.4.3.4 y 0.5.0.0 están instaladas. Quiero eliminar la 0.5.0.0 y usar solo la versión anterior. Pero cabal no tiene un comando de "desinstalación", y cuando lo intento ghc-pkg unregister --force blaze-html, ghc-pkg dice que mi orden ha sido ignorada.

¿Qué hago?

ACTUALIZAR: No lo creas . Aunque ghc-pkg afirma ignorar el comando, el el comando no es ignorado. Y con la respuesta aceptada de Don Stewart puede eliminar exactamente la versión que desea eliminar.

Author: Norman Ramsey, 2012-05-14

4 answers

Puedes ghc-pkg unregister una versión específica, así:

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

Eso debería ser suficiente.

 90
Author: Don Stewart,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-11 21:53:18

Si estás fuera de un sandbox:

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

Si estás dentro de una caja de arena de la cábala :

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

El primer -- es el separador de argumentos para hc-pkg. Esto se ejecuta ghc-pkg de una manera consciente de sandbox.

 23
Author: musically_ut,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-10-06 08:27:48

También está el paquete cabal-uninstall que proporciona un comando cabal-uninstall. Anula el registro del paquete y elimina la carpeta. Sin embargo, vale la pena mencionar que pasa --force a ghc-pkg unregister para que pueda romper otros paquetes.

 20
Author: Davorak,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-01-04 16:18:10

Aquí hay un script de shell que uso para desinstalar un paquete. Es compatible con múltiples versiones instaladas de GHC y también limpia los archivos relevantes (pero se proporciona sin garantía, no me culpes si manguera su instalación!)

#!/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
 6
Author: Ben Millwood,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-12-26 16:31:33