Search code examples
rakuzef

How to calculate a module's dist hash


I have Raku installed in ~/.rakudo-star/rakudo-star-2018.04, using LoneStar. When zef installs a module, it gets installed into a subdirectory of the Rakudo directory. In here is a directory named perl6/site/resources, which seem to hold all the installed files. How can I figure out which module is contained in which file, using Raku?


Solution

  • If I remember correctly, you shouldn't. It's zef the one that must take care of it. But if you positively have to, use the SHA1 signatures in the directory with zef locate

    zef --sha1 locate 5417D0588AE3C30CF7F84DA87D27D4521713522A
    

    will output (in my system)

    ===> From Distribution: zef:ver<0.4.4>:auth<github:ugexe>:api<>
    lib/Zef/Service/Shell/PowerShell/download.pm6 => /home/jmerelo/.rakudobrew/moar-2018.06/install/share/perl6/site/sources/5417D0588AE3C30CF7F84DA87D27D4521713522A
    

    From your question, it's not too clear if what you want to do is the opposite, that is, find out which SHA1 corresponds to which file; in that case, try and to this:

    zef locate bin/lwp-download.pl
    

    which will return

    ===> From Distribution: LWP::Simple:ver<0.103>:auth<Cosimo Streppone>:api<>
    bin/lwp-download.pl => /home/jmerelo/.rakudobrew/moar-2018.06/install/share/perl6/site/resources/059BD7DBF74D1598B0ACDB48574CC351A3AD16BC