Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distribution .dist-id

Tags:

raku

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]
like image 895
hythm Avatar asked Aug 27 '19 01:08

hythm


1 Answers

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 uninstalls, 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)

like image 187
ugexe Avatar answered Nov 14 '22 06:11

ugexe