hythm7 / Pakku

Package Manager for the Raku Programming Language
Artistic License 2.0
26 stars 3 forks source link

%?RESOURCES is not available when dist is installed to inst#/my/custom/repo #1

Closed hythm7 closed 4 years ago

hythm7 commented 5 years ago

Installing dist A to /my/custom/repo and:

dist A depends on dist B, dist B uses %?RESOURCES, then dist A tests might fail if the test file uses dist B, because %?RESOURCES< exisitng-file > of dist B returns Nil.

The error: (where License::SPDX resources returns Nil when loaded from inst#/my/custom/repo)

πŸ”” Type check failed in binding to parameter '$json'; expected Str but got Nil (Nil) 
πŸ””   in method from-json at repo#sources/C0029D661A8CA443DB83A67FE58F3E10D590C1A0 (JSON::Class) line 90 
πŸ””   in method new at repo#sources/4E66FDBA4785D40812EC4D781E0EB1263E3D4196 (License::SPDX) line 138 
πŸ””   in sub check-license at /tmp/Test-META-0.0.16/lib/Test/META.pm (Test::META) line 179 
πŸ””   in block <unit> at t/020-internals.t line 55 
πŸ””  
πŸ’€ TST: ο½’Test::META:ver<0.0.16>:auth<github:jonathanstowe>:api<1.0>ο½£ 
Nofun

The below command will fail testing phase because %?RESOURCES of License::SPDX is not available during testing Test::META

pakku install verbose trace add to /my/custom/repo Test::META

Same command work fine if installed to any of Raku's repos home site vendor pakku install verbose trace add Test::META # works and installed to repo home by default

Offending code is here: the issue disappears when removing $*repo (in this case inst#/my/custom/repo ) from include path and test pass, I think because License::SPDX is loaded from another repo home, site or vendor where it is able to find its %?RESOURCES

hythm7 commented 4 years ago

Fixed in this commit

Looks like CompUnit::RepositoryRegistry.register-name is causing the issue to %?RESOURCES.

(This issue may exist in Raku's default repos as well home site vendor, I haven't tested them yet).

Will look into CompUnit::RepositoryRegistry.register-name in Rakudo to better understand the issue and create an issue in Rakudo

hythm7 commented 3 years ago

When registering a name for CURI via CompUnit::RepositoryRegistry, the same name need to be registered everytime a new process of Raku runs.