EDIT: Updated the question because I was confusing .dist-id
with .id
;
I'm trying to uninstall dist, but when I pass the Distribution
to .uninstall
it looks like it calculates different .dist-id
and the Distribution
does not get uninstalled.
What am I doing wrong?
#!/usr/bin/env perl6
my $dist = $*REPO.candidates( 'Grid' ).head;
say $dist.WHAT, $dist.Str, $dist.dist-id;
say $*REPO.uninstall( $dist );
say $*REPO.uninstall( $dist ); # still there
# OUTPUT:
(LazyDistribution)Grid:ver<0.0.2>:auth<>:api<0>ADCD0F3EFF816F1212D5513F201B8143E2BDD6FF
["/home/hythm/.perl6/dist/157B7E1F2BB827C99A5EF3241D61853A85E57734".IO] # shouldn't this hash be the one above ↑ ?
["/home/hythm/.perl6/dist/157B7E1F2BB827C99A5EF3241D61853A85E57734".IO]
I can almost guarantee it is being uninstalled. Your assumption that uninstall
returning some path means it didn't work is incorrect. See: perl6 -e 'unlink("asdfaefawfk")'
, try adding a require ::("XXX")
between the uninstall
s, or try running your example two different times.
.dist-id
is not used for the directory -- this is easily verified by looking at the source for uninstall
-- https://github.com/rakudo/rakudo/blob/57f4a4c933e5f9c896051793722b33f254786695/src/core.c/CompUnit/Repository/Installation.pm6#L334
You are also using $*REPO
incorrectly. You almost always need to grep $*REPO.repo-chain
for the specific repository you require; don't assume the first repository is always what you think it is (because it suddenly isn't when you do e.g. -I lib
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With