Skip to content

Commit

Permalink
Fix make test failing on an unwritable install path
Browse files Browse the repository at this point in the history
Even if a CompUnit::Repository::Installation was never used for loading
modules, it tried to mkdir its $.prefix and prefix/dist just to read the
listing of an empty directory when calculating its identity.

We're now a bit smarter and only read the directory if it actually
exists.
  • Loading branch information
niner committed Dec 28, 2015
1 parent 373adc0 commit 4cf630b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/CompUnit/Repository/Installation.pm
Expand Up @@ -107,7 +107,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
method install(Distribution $dist, %sources, %scripts?, %resources?, :$force) {
$!lock.protect( {
my @*MODULES;
my $path = self.writeable-path or die "No writeable path found";
my $path = self.writeable-path or die "No writeable path found, $.prefix not writeable";
my $lock //= $.prefix.child('repo.lock').open(:create, :w);
$lock.lock(2);

Expand Down Expand Up @@ -304,7 +304,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
method id() {
return $!id if $!id;
$!id = self.CompUnit::Repository::Locally::id();
$!id = nqp::sha1($!id ~ self!dist-dir.dir)
my $dist-dir = $.prefix.child('dist');
$!id = nqp::sha1($!id ~ ($dist-dir.e ?? $dist-dir.dir !! ''))
}

method short-id() { 'inst' }
Expand Down

0 comments on commit 4cf630b

Please sign in to comment.