Skip to content

Commit

Permalink
Merge branch 'nom' into uncurse
Browse files Browse the repository at this point in the history
  • Loading branch information
TimToady committed Apr 15, 2017
2 parents 762c63c + c95c4a7 commit 89fd91c
Show file tree
Hide file tree
Showing 17 changed files with 150 additions and 144 deletions.
2 changes: 1 addition & 1 deletion lib/CompUnit/Repository/Staging.pm
Expand Up @@ -12,7 +12,7 @@ class CompUnit::Repository::Staging is CompUnit::Repository::Installation {
self.^name ~ '#name(' ~ $!name ~ ')#' ~ $.prefix.absolute;
}
method source-file(Str $name --> IO::Path) {
my $file = self.prefix.child($name);
my $file = self.prefix.concat-with($name);
$file.e ?? $file !! self.next-repo.source-file($name)
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/core/CompUnit/PrecompilationStore/File.pm
Expand Up @@ -103,22 +103,22 @@ class CompUnit::PrecompilationStore::File does CompUnit::PrecompilationStore {
{
$!update-lock.protect: {
%!dir-cache{$compiler-id ~ $precomp-id} //=
(%!compiler-cache{$compiler-id} //= self.prefix.child($compiler-id.IO))
.child($precomp-id.substr(0, 2).IO)
(%!compiler-cache{$compiler-id} //= self.prefix.concat-with($compiler-id.IO))
.concat-with($precomp-id.substr(0, 2).IO)
}
}

method path(CompUnit::PrecompilationId $compiler-id,
CompUnit::PrecompilationId $precomp-id,
Str :$extension = '')
{
self!dir($compiler-id, $precomp-id).child(($precomp-id ~ $extension).IO)
self!dir($compiler-id, $precomp-id).concat-with(($precomp-id ~ $extension).IO)
}

method !lock(--> Nil) {
return if $*W && $*W.is_precompilation_mode();
my int $acquire-file-lock = $!update-lock.protect: {
$!lock //= $.prefix.child('.lock').open(:create, :rw);
$!lock //= $.prefix.concat-with('.lock').open(:create, :rw);
$!lock-count++
}
$!lock.lock(2) if $acquire-file-lock == 0;
Expand Down Expand Up @@ -176,11 +176,11 @@ class CompUnit::PrecompilationStore::File does CompUnit::PrecompilationStore {
Str :$extension = ''
--> IO::Path:D)
{
my $compiler-dir = self.prefix.child($compiler-id.IO);
my $compiler-dir = self.prefix.concat-with($compiler-id.IO);
$compiler-dir.mkdir unless $compiler-dir.e;
my $dest = self!dir($compiler-id, $precomp-id);
$dest.mkdir unless $dest.e;
$dest.child(($precomp-id ~ $extension).IO)
$dest.concat-with(($precomp-id ~ $extension).IO)
}

method store-file(CompUnit::PrecompilationId $compiler-id,
Expand Down Expand Up @@ -218,7 +218,7 @@ class CompUnit::PrecompilationStore::File does CompUnit::PrecompilationStore {

method delete-by-compiler(CompUnit::PrecompilationId $compiler-id)
{
my $compiler-dir = self.prefix.child($compiler-id.IO);
my $compiler-dir = self.prefix.concat-with($compiler-id.IO);
for $compiler-dir.dir -> $subdir {
$subdir.dir>>.unlink;
$subdir.rmdir;
Expand Down
12 changes: 6 additions & 6 deletions src/core/CompUnit/Repository/FileSystem.pm
Expand Up @@ -17,13 +17,13 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
my $name = $spec.short-name;
return %!loaded{$name} if %!loaded{$name}:exists;

my $base := $!prefix.child($name.subst(:g, "::", $*SPEC.dir-sep) ~ '.').Str;
my $base := $!prefix.concat-with($name.subst(:g, "::", $*SPEC.dir-sep) ~ '.').Str;
return $base if %seen{$base}:exists;
my $found;

# find source file
# pick a META6.json if it is there
if not %!meta and (my $meta = $!prefix.child('META6.json')) and $meta.f {
if not %!meta and (my $meta = $!prefix.concat-with('META6.json')) and $meta.f {
try {
%!meta = Rakudo::Internals::JSON.from-json: $meta.slurp;
CATCH {
Expand All @@ -35,7 +35,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
}
if %!meta {
if %!meta<provides>{$name} -> $file {
my $path = $file.IO.is-absolute ?? $file.IO !! $!prefix.child($file);
my $path = $file.IO.is-absolute ?? $file.IO !! $!prefix.concat-with($file);
$found = $path if $path.f;
}
}
Expand Down Expand Up @@ -159,7 +159,7 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
# We have a $file when we hit: require "PATH" or use/require Foo:file<PATH>;
my $precompiled =
$file.Str.ends-with(Rakudo::Internals.PRECOMP-EXT);
my $path = $!prefix.child($file);
my $path = $!prefix.concat-with($file);

if $path.f {
return %!loaded{$file.Str} //= %seen{$path.Str} = CompUnit.new(
Expand Down Expand Up @@ -197,12 +197,12 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
# We now save the 'resources/' part of a resource's path in files, i.e:
# "files" : [ "resources/libraries/xxx" => "resources/libraries/xxx.so" ]
# but we also want to root any path request to the CUR's resources directory
$.prefix.parent.child('resources').child($key.subst(/^resources\//, ""));
$.prefix.parent.concat-with('resources').concat-with($key.subst(/^resources\//, ""));
}

method precomp-store(--> CompUnit::PrecompilationStore:D) {
$!precomp-store //= CompUnit::PrecompilationStore::File.new(
:prefix(self.prefix.child('.precomp')),
:prefix(self.prefix.concat-with('.precomp')),
)
}

Expand Down

0 comments on commit 89fd91c

Please sign in to comment.