Skip to content

Commit

Permalink
Fix -Ilib and friends not overriding installed dependencies
Browse files Browse the repository at this point in the history
When checking the dependencies of a precomp file, we did not take development
version of modules in FileSystem repositories into account. I.e. with A
depending on B putting a new version of B into the lib directory and running
perl6 -Ilib -MA you would still get the precompiled version of A that uses the
installed version of B.

Fixed by having the identity of a FileSystem repository reflect its complete
content. So by changing the content we detect a change in the repository chain
and know to re-resolve dependencies.
  • Loading branch information
niner committed Aug 17, 2016
1 parent 739d1a3 commit 848add9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/core/CompUnit/Repository/FileSystem.pm
@@ -1,6 +1,7 @@
class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does CompUnit::Repository {
has %!loaded;
has $!precomp;
has $!id;

my %extensions =
Perl6 => <pm6 pm>,
Expand Down Expand Up @@ -57,6 +58,25 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C
nqp::sha1($name ~ self.id);
}

method id() {
unless ($!id) {
my @dirs = self.prefix;
$!id = "";
while @dirs {
for @dirs.pop.dir -> $file {
if $file.d {
push @dirs, $file unless $file.basename eq ".precomp";
}
else {
$!id = nqp::sha1($!id ~ nqp::sha1($file.slurp(:enc<latin1>)));
}
}
}
$!id = nqp::sha1($!id ~ self.next-repo.id) if self.next-repo;
}
$!id
}

method resolve(CompUnit::DependencySpecification $spec) returns CompUnit {
my ($base, $file) = self!matching-file($spec);

Expand Down

0 comments on commit 848add9

Please sign in to comment.