How to remove a cabal package from the local system?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

How to remove a cabal package from the local system?

Volker Wysk-5
Hi!

I have installed/registered a new version of a package with cabal by accident.
How can I remove it again?

There is something in ~/.cabal/packages/hackage.haskell.org, but the defective
version isn't included.

bye
V.W.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Evan Laforge
I use a shell script.  It's really useful, surely there's some
official way to do this?

#!/bin/zsh

package=$1

if ! ghc-pkg describe $package >/dev/null; then
    echo no such package: $package
    exit 1
fi

ghcdir=$(ghc --print-libdir)

function field() {
    ghc-pkg field $package $1 | cut -d' ' -f2-
    return $?
}

libdir=$(field library-dirs)
hidir=$(field import-dirs)
html=$(dirname $(field haddock-html))

echo rm -rf $libdir $hidir $html
echo -n 'remove? '
read response
if [[ $response = y ]]; then
    # ghc-pkg unregister will complain if this will break other packages
    if ! ghc-pkg unregister $package; then
        exit 1
    fi
    rm -rf $libdir $hidir $html
fi

On Wed, Jan 21, 2015 at 11:36 PM, Volker Wysk <[hidden email]> wrote:

> Hi!
>
> I have installed/registered a new version of a package with cabal by accident.
> How can I remove it again?
>
> There is something in ~/.cabal/packages/hackage.haskell.org, but the defective
> version isn't included.
>
> bye
> V.W.
> _______________________________________________
> Glasgow-haskell-users mailing list
> [hidden email]
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Volker Wysk-5
Am Mittwoch, 21. Januar 2015, 23:56:53 schrieben Sie:
> I use a shell script.  It's really useful, surely there's some
> official way to do this?

It looks like a "remove" command to "cabal" has been forgotten... This would
be a feature request.

I'm also missing a command to set the "Default available version".

Thanks for the script!

Volker

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Brandon Allbery
On Wed, Jan 21, 2015 at 11:19 AM, Volker Wysk <[hidden email]> wrote:
I'm also missing a command to set the "Default available version".

You don't set that; it's specified in the downloaded package index in the package repo.

--
brandon s allbery kf8nh                               sine nomine associates
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Herbert Valerio Riedel
In reply to this post by Volker Wysk-5
On 2015-01-21 at 16:36:08 +0100, Volker Wysk wrote:
> I have installed/registered a new version of a package with cabal by accident.
> How can I remove it again?

Not sure if this is what you want, but the `cab` tool has an `uninstall`
sub-command to unregister and remove installed packages.

 [1]: http://hackage.haskell.org/package/cab

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Volker Wysk-5
Am Mittwoch, 21. Januar 2015, 19:39:50 schrieben Sie:
> On 2015-01-21 at 16:36:08 +0100, Volker Wysk wrote:
> > I have installed/registered a new version of a package with cabal by
> > accident. How can I remove it again?
>
> Not sure if this is what you want, but the `cab` tool has an `uninstall`
> sub-command to unregister and remove installed packages.
>
>  [1]: http://hackage.haskell.org/package/cab

Yes, this is what I want. But Evan's script works fine. I think I will stick to
it.

Greeting
Volker
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Herbert Valerio Riedel
On 2015-01-22 at 09:04:30 +0100, Volker Wysk wrote:

>> > I have installed/registered a new version of a package with cabal by
>> > accident. How can I remove it again?
>>
>> Not sure if this is what you want, but the `cab` tool has an `uninstall`
>> sub-command to unregister and remove installed packages.
>>
>>  [1]: http://hackage.haskell.org/package/cab
>
> Yes, this is what I want. But Evan's script works fine. I think I will stick to
> it.

There's one thing though that Evan's script doesn't handle afaics:
recursive de-installation of packages that depend upon the package
version you're uninstalling...

Hopefully at some point `cabal` will provide a `uninstall` command out
of the box, you can subscribe to the respective GitHub issue if you want
to follow that discussion:

  https://github.com/haskell/cabal/issues/227

Cheers,
  hvr
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Albert Y. C. Lai
In reply to this post by Volker Wysk-5
On 2015-01-21 10:36 AM, Volker Wysk wrote:
> I have installed/registered a new version of a package with cabal by accident.
> How can I remove it again?

See my http://www.vex.net/~trebla/haskell/sicp.xhtml#remove . In fact,
read the whole thing.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: How to remove a cabal package from the local system?

Volker Wysk-5
Am Donnerstag, 22. Januar 2015, 11:19:37 schrieb Albert Y. C. Lai:
> On 2015-01-21 10:36 AM, Volker Wysk wrote:
> > I have installed/registered a new version of a package with cabal by
> > accident. How can I remove it again?
>
> See my http://www.vex.net/~trebla/haskell/sicp.xhtml#remove . In fact,
> read the whole thing.

This describes what Evan is doing in his script.

Bye
Volker
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users