Skip to content

Commit

Permalink
Use $*SPEC.dir-sep for separators in CompUnit::RepositoryRegistry
Browse files Browse the repository at this point in the history
On Windows, keys to the $repos hash are constructed exclusively
with backslash separators, so keys look something like this:

    C:\rakudo\share\perl6\site

However, before this commit, we were using slash characters to construct
paths to look up in that $repos hash, so we were looking for
keys like this as a result:

    C:\rakudo\share\perl6/site

This lookup would fail, and so Windows would end up lacking certain
repositories, such as the "site" repository.

This patch makes sure that $*SPEC.dir-sep is used consistently
throughout RepositoryRegistry to restore these missing repositories to
Windows builds.
  • Loading branch information
hoelzro committed Aug 10, 2018
1 parent c6a1536 commit c3e1ec0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/core/CompUnit/RepositoryRegistry.pm6
Expand Up @@ -10,6 +10,7 @@ class CompUnit::Repository::JavaRuntime { ... }
#?endif

class CompUnit::RepositoryRegistry {
my $sep := $*SPEC.dir-sep;
my $lock = Lock.new;
my %include-spec2cur;

Expand Down Expand Up @@ -81,7 +82,7 @@ class CompUnit::RepositoryRegistry {
?? nqp::atkey($ENV,'RAKUDO_PREFIX')
!! nqp::concat(
nqp::atkey(nqp::getcomp('perl6').config,'libdir'),
'/perl6'
"{$sep}perl6"
);

# XXX Various issues with this stuff on JVM , TEMPORARY
Expand All @@ -96,14 +97,14 @@ class CompUnit::RepositoryRegistry {
(nqp::existskey($ENV,'HOMEPATH')
?? nqp::atkey($ENV,'HOMEPATH') !! '')
) -> $home-path {
$home = "$home-path/.perl6";
$home = "{$home-path}{$sep}.perl6";
$home-spec = "inst#$home";
}
}

# set up custom libs
my str $site = "inst#$prefix/site";
my str $vendor = "inst#$prefix/vendor";
my str $site = "inst#{$prefix}{$sep}site";
my str $vendor = "inst#{$prefix}{$sep}vendor";
my str $perl = "inst#$prefix";

# your basic repo chain
Expand Down Expand Up @@ -141,11 +142,11 @@ class CompUnit::RepositoryRegistry {
)) unless nqp::existskey($unique, $perl);
nqp::bindkey($custom-lib, 'vendor', $next-repo := self!register-repository(
$vendor,
CompUnit::Repository::Installation.new(:prefix("$prefix/vendor"), :$next-repo)
CompUnit::Repository::Installation.new(:prefix("{$prefix}{$sep}vendor"), :$next-repo)
)) unless nqp::existskey($unique, $vendor);
nqp::bindkey($custom-lib, 'site', $next-repo := self!register-repository(
$site,
CompUnit::Repository::Installation.new(:prefix("$prefix/site"), :$next-repo)
CompUnit::Repository::Installation.new(:prefix("{$prefix}{$sep}site"), :$next-repo)
)) unless nqp::existskey($unique, $site);
nqp::bindkey($custom-lib, 'home', $next-repo := self!register-repository(
$home-spec,
Expand Down Expand Up @@ -259,9 +260,9 @@ class CompUnit::RepositoryRegistry {
shift @*ARGS if $ver;
$name //= $dist-name;
my @installations = $*REPO.repo-chain.grep(CompUnit::Repository::Installation);
my @binaries = @installations.map({ .script("bin/$script", :$name, :$auth, :$ver) }).grep(*.defined);
my @binaries = @installations.map({ .script("bin{$sep}$script", :$name, :$auth, :$ver) }).grep(*.defined);
unless +@binaries {
@binaries = flat @installations.map: { .script("bin/$script", :$name) };
@binaries = flat @installations.map: { .script("bin{$sep}$script", :$name) };
if +@binaries {
note "===SORRY!===\n"
~ "No candidate found for '$script' that match your criteria.\n"
Expand Down

0 comments on commit c3e1ec0

Please sign in to comment.