Skip to content

Commit

Permalink
Fixes for installing from outside a dists directory
Browse files Browse the repository at this point in the history
Use the stable names instead of local file paths when generating file
ids. This way those ids no longer depend on the current working
directory. Previously we used  the path like "./lib/Foo.pm6" for
generating the id and would end up with a different id if installing the
file by using e.g. "modules/Foo/lib/Foo.pm6".

Only affects newly installed dists.
  • Loading branch information
niner committed Feb 14, 2016
1 parent d71f42f commit 8ca26ce
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/core/CompUnit/Repository/Installation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {
# "provides" or just "files".
for %sources.kv -> $name, $file is copy {
$file = $is-win ?? ~$file.subst('\\', '/', :g) !! ~$file;
my $id = self!file-id($file, $dist-id);
# $name is "Inline::Perl5" while $file is "lib/Inline/Perl5.pm6"
my $id = self!file-id($name, $dist-id);
my $destination = $sources-dir.child($id);
self!add-short-name($name, $dist);
$dist.provides{ $name } = {
Expand Down Expand Up @@ -171,7 +172,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) {

for %resources.kv -> $name, $file is copy {
$file = $is-win ?? ~$file.subst('\\', '/', :g) !! ~$file;
my $id = self!file-id($file, $dist-id) ~ '.' ~ $file.IO.extension;
# $name is 'libraries/p5helper' while $file is 'resources/libraries/libp5helper.so'
my $id = self!file-id($name, $dist-id) ~ '.' ~ $file.IO.extension;
my $destination = $resources-dir.child($id);
$dist.files{$name} = $id;
copy($file, $destination);
Expand Down

0 comments on commit 8ca26ce

Please sign in to comment.