diff --git a/src/core/CompUnit/Repository/FileSystem.pm b/src/core/CompUnit/Repository/FileSystem.pm index 7d8ec8f1ac3..2af2fa0dc97 100644 --- a/src/core/CompUnit/Repository/FileSystem.pm +++ b/src/core/CompUnit/Repository/FileSystem.pm @@ -144,7 +144,10 @@ class CompUnit::Repository::FileSystem does CompUnit::Repository::Locally does C } method resource($dist-id, $key) { - $.prefix.parent.child('resources').child($key); + # 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\//, "")); } method precomp-store() returns CompUnit::PrecompilationStore { diff --git a/src/core/CompUnit/Repository/Installable.pm b/src/core/CompUnit/Repository/Installable.pm index e599d4a5032..b909069d100 100644 --- a/src/core/CompUnit/Repository/Installable.pm +++ b/src/core/CompUnit/Repository/Installable.pm @@ -1,17 +1,6 @@ role CompUnit::Repository::Installable does CompUnit::Repository { # Installs a distribution into the repository. - method install( - # A Distribution object - Distribution $dist, - # A hash mapping entries in `provides` to a disk location that - # holds the source files; they will be copied (and may also be - # precompiled by some CompUnit::Repository implementations). - %sources, - %scripts?, - # A hash mapping entries in the `resources` to a disk location - # that holds the files; again, these will be copied and stored. - %resources?) - { ... } + method install(Distribution $dist) { ... } # Returns True if we can install modules (this will typically do a # .w check on the module database). diff --git a/src/core/CompUnit/Repository/Installation.pm b/src/core/CompUnit/Repository/Installation.pm index d2297616e06..8e413b4421f 100644 --- a/src/core/CompUnit/Repository/Installation.pm +++ b/src/core/CompUnit/Repository/Installation.pm @@ -101,7 +101,11 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my $id = nqp::sha1($name); my $lookup = $short-dir.child($id); $lookup.mkdir; - $lookup.child($dist.id).spurt("{$dist.ver // ''}\n{$dist.auth // ''}\n{$dist.api // ''}\n"); + $lookup.child($dist.id).spurt( + "{$dist.meta // ''}\n" + ~ "{$dist.meta // ''}\n" + ~ "{$dist.meta // ''}\n" + ); } method !remove-dist-from-short-name-lookup-files($dist) { @@ -143,17 +147,17 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { $!version = $version-file.slurp.Int } - method !upgrade-repository(Int $version) { + method upgrade-repository() { + my $version = self!repository-version; my $short-dir = $.prefix.child('short'); mkdir $short-dir unless $short-dir.e; my $precomp-dir = $.prefix.child('precomp'); mkdir $precomp-dir unless $precomp-dir.e; self!sources-dir; - self!resources-dir; - self!dist-dir; + my $resources-dir = self!resources-dir; + my $dist-dir = self!dist-dir; self!bin-dir; if ($version < 1) { - $.prefix.child('version').spurt('1'); for $short-dir.dir -> $file { my @ids = $file.lines.unique; $file.unlink; @@ -164,10 +168,49 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { } } } - $!version = 1; + if ($version < 2) { + for $dist-dir.dir -> $dist-file { + my %meta = Rakudo::Internals::JSON.from-json($dist-file.slurp); + my $files = %meta //= []; + for eager $files.keys -> $file { + $files{"resources/$file"} = $files{$file}:delete + if $resources-dir.child($files{$file}).e; + } + $dist-file.spurt: Rakudo::Internals::JSON.to-json(%meta); + } + } + $.prefix.child('version').spurt('2'); + $!version = 2; } - method install(Distribution $dist, %sources, %scripts?, %resources?, :$force) { + proto method install(|) {*} + multi method install($dist, %sources, %scripts?, %resources?, :$force) { + # XXX: Deprecation shim + my %files = |%scripts, |%resources; + my %meta6 = %( + name => $dist.?name, + ver => $dist.?ver // $dist.?version, + auth => $dist.?auth // $dist.?authority, + provides => %sources, + files => %files, + ); + + my $new-dist = class { + also does Distribution; + method meta { %meta6 } + method content($address is copy) { + my $handle = IO::Handle.new: path => IO::Path.new($address.IO.absolute); + $handle // $handle.throw; + } + } + samewith($new-dist, :$force); + } + multi method install(Distribution $distribution, Bool :$force) { + my $dist = CompUnit::Repository::Distribution.new($distribution); + my %files = $dist.meta.grep(*.defined).map: -> $link { + $link ~~ Str ?? ($link => $link) !! ($link.keys[0] => $link.values[0]) + } + $!lock.protect( { my @*MODULES; my $path = self!writeable-path or die "No writeable path found, $.prefix not writeable"; @@ -175,7 +218,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { $lock.lock(2); my $version = self!repository-version; - self!upgrade-repository($version) unless $version == 1; + self.upgrade-repository unless $version == 2; my $dist-id = $dist.id; my $dist-dir = self!dist-dir; @@ -189,58 +232,75 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my $bin-dir = self!bin-dir; my $is-win = Rakudo::Internals.IS-WIN; - self!add-short-name($dist.name, $dist); # so scripts can find their dist + self!add-short-name($dist.meta, $dist); # so scripts can find their dist + + my %links; # map name-path to new content address + my %provides; # meta data gets added, but the format needs to change to + # only extend the structure, not change it - # Walk the to be installed files, decide whether we put them into - # "provides" or just "files". - for %sources.kv -> $name, $file is copy { - $file = $is-win ?? ~$file.subst('\\', '/', :g) !! ~$file; + # the following 3 `for` loops should be a single loop, but has been + # left this way due to impeding precomp changes + + # lib/ source files + for $dist.meta.kv -> $name, $file is copy { # $name is "Inline::Perl5" while $file is "lib/Inline/Perl5.pm6" - my $id = self!file-id($name, $dist-id); + my $id = self!file-id(~$name, $dist-id); my $destination = $sources-dir.child($id); self!add-short-name($name, $dist); - $dist.provides{ $name } = { - pm => { - :file($id), - :time(try $file.IO.modified.Num), - :$!cver - } + %provides{ $name } = ~$file => { + :file($id), + :time(try $file.IO.modified.Num), + :$!cver }; - note("Installing {$name} for {$dist.name}") if $verbose and $name ne $dist.name; - copy($file, $destination); + note("Installing {$name} for {$dist.meta}") if $verbose and $name ne $dist.meta; + my $handle = $dist.content($file); + my $content = $handle.open.slurp-rest(:bin); + $destination.spurt($content); + $handle.close; } - for %scripts.kv -> $basename, $file is copy { - $file = $is-win ?? ~$file.subst('\\', '/', :g) !! ~$file; - my $id = self!file-id($file, $dist-id); - my $destination = $resources-dir.child($id); - my $withoutext = $basename.subst(/\.[exe|bat]$/, ''); + # bin/ scripts + for %files.kv -> $name-path, $file is copy { + next unless $name-path.starts-with('bin/'); + my $id = self!file-id(~$file, $dist-id); + my $destination = $resources-dir.child($id); # wrappers are put in bin/; originals in resources/ + my $withoutext = $name-path.subst(/\.[exe|bat]$/, ''); for '', '-j', '-m' -> $be { - "$path/bin/$withoutext$be".IO.spurt: - $perl_wrapper.subst('#name#', $basename, :g).subst('#perl#', "perl6$be").subst('#dist-name#', $dist.name); + $.prefix.child("$withoutext$be").IO.spurt: + $perl_wrapper.subst('#name#', $name-path.IO.basename, :g).subst('#perl#', "perl6$be").subst('#dist-name#', $dist.meta); if $is-win { - "$path/bin/$withoutext$be.bat".IO.spurt: + $.prefix.child("$withoutext$be.bat").IO.spurt: $windows_wrapper.subst('#perl#', "perl6$be", :g); } else { - "$path/bin/$withoutext$be".IO.chmod(0o755); + $.prefix.child("$withoutext$be").IO.chmod(0o755); } } - self!add-short-name($basename, $dist); - $dist.files{"bin/$basename"} = $id; - copy($file, $destination); + self!add-short-name($name-path, $dist); + %links{$name-path} = $id; + my $handle = $dist.content($file); + my $content = $handle.open.slurp-rest(:bin); + $destination.spurt($content); + $handle.close; } - for %resources.kv -> $name, $file is copy { - $file = $is-win ?? ~$file.subst('\\', '/', :g) !! ~$file; - # $name is 'libraries/p5helper' while $file is 'resources/libraries/libp5helper.so' - my $id = self!file-id($name, $dist-id) ~ '.' ~ $file.IO.extension; + # resources/ + for %files.kv -> $name-path, $file is copy { + next unless $name-path.starts-with('resources/'); + # $name-path is 'resources/libraries/p5helper' while $file is 'resources/libraries/libp5helper.so' + my $id = self!file-id(~$name-path, $dist-id) ~ '.' ~ $file.IO.extension; my $destination = $resources-dir.child($id); - $dist.files{$name} = $id; - copy($file, $destination); + %links{$name-path} = $id; + my $handle = $dist.content($file); + my $content = $handle.open.slurp-rest(:bin); + $destination.spurt($content); + $handle.close; } - $dist-dir.child($dist-id).spurt: Rakudo::Internals::JSON.to-json($dist.Hash); + my %meta = %($dist.meta); + %meta = %links; # add our new name-path => conent-id mapping + %meta = %provides; # new meta data added to provides + $dist-dir.child($dist-id).spurt: Rakudo::Internals::JSON.to-json(%meta); # reset cached id so it's generated again on next access. # identity changes with every installation of a dist. @@ -253,12 +313,15 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my $repo-prefix = self!repo-prefix; my $*RESOURCES = Distribution::Resources.new(:repo(self), :$dist-id); my %done; - my @provides = $dist.provides.kv.map(-> $source-name, $ext {($source-name, $ext.values[0])}); + my $compiler-id = $*PERL.compiler.id; - for @provides -> ($source-name, $id) { + for %provides.kv -> $source-name, $source-meta { + my $id = $source-meta.values[0]; $precomp.store.delete($compiler-id, $id); } - for @provides -> ($source-name, $id) { + + for %provides.kv -> $source-name, $source-meta { + my $id = $source-meta.values[0]; my $source = $sources-dir.child($id); my $source-file = $repo-prefix ?? $repo-prefix ~ $source.relative($.prefix) !! $source; @@ -280,19 +343,45 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { $lock.unlock; } ) } - method uninstall(Distribution $dist) { - my %provides = $dist.provides; - my %files = $dist.files; + method uninstall(Distribution $distribution) { + my $repo-version = self!repository-version; + self.upgrade-repository unless $repo-version == 2; + + # xxx: currently needs to be passed in a distribution object that + # has meta pointing at content-ids, so you cannot yet just + # pass in the original meta data and have it discovered and deleted + # (i.e. update resolve to return such a ::Installation::Distribution) + my $dist = CompUnit::Repository::Distribution.new($distribution); + my %provides = $dist.meta; + my %files = $dist.meta; my $sources-dir = self.prefix.child('sources'); my $resources-dir = self.prefix.child('resources'); my $bin-dir = self.prefix.child('bin'); my $dist-dir = self.prefix.child('dist'); self!remove-dist-from-short-name-lookup-files($dist); - $bin-dir.child($_.value).unlink for %files.grep: {$_.key ~~ /^bin\//}; - $sources-dir.child($_).unlink for %provides.map(*.value); - $resources-dir.child($_).unlink for %files.values; - $dist-dir.child($dist.id).unlink; + my sub unlink-if-exists($path) { unlink($path) if $path.IO.e } + + # delete special directory files + for %files.kv -> $name-path, $file { + given $name-path { + when /^bin\/(.*)/ { + # wrappers are located in $bin-dir + unlink-if-exists( $bin-dir.child("$0$_") ) for '', '-m', '-j'; + # original bin scripts are in $resources-dir + unlink-if-exists( $resources-dir.child($file) ) + } + when /^resources\// { + unlink-if-exists( $resources-dir.child($file) ) + } + } + } + + # delete sources + unlink-if-exists( $sources-dir.child($_) ) for %provides.values.flatmap(*.values.map(*.)); + + # delete the meta file + unlink( $dist-dir.child($dist.id) ) } method files($file, :$name!, :$auth, :$ver) { @@ -300,8 +389,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my $prefix = self.prefix; my $lookup = $prefix.child('short').child(nqp::sha1($name)); if $lookup.e { - my $version = self!repository-version; - my @dists = $version < 1 + my $repo-version = self!repository-version; + my @dists = $repo-version < 1 ?? $lookup.lines.unique.map({ self!read-dist($_) }) @@ -310,11 +399,10 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { (id => $_.basename, ver => Version.new( $ver || 0 ), auth => $auth, api => $api).hash }); for @dists.grep({$_ ~~ $auth and $_ ~~ $ver}) -> $dist is copy { - $dist = self!read-dist($dist) if $version >= 1; + $dist = self!read-dist($dist) if $repo-version >= 1; with $dist{$file} { - my $candi = %$dist; - $candi{$file} = $prefix.abspath ~ '/resources/' ~ $candi{$file} - unless $candi{$file} ~~ /^$prefix/; + my $candi = %$dist; + $candi{$file} = self!resources-dir.child($candi{$file}); @candi.push: $candi; } } @@ -324,11 +412,11 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { method !matching-dist(CompUnit::DependencySpecification $spec) { if $spec.from eq 'Perl6' { - my $version = self!repository-version; + my $repo-version = self!repository-version; my $lookup = $.prefix.child('short').child(nqp::sha1($spec.short-name)); if $lookup.e { my @dists = ( - $version < 1 + $repo-version < 1 ?? $lookup.lines.unique.map({ $_ => self!read-dist($_) }) @@ -341,7 +429,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { and $_.value ~~ $spec.version-matcher }); for @dists.sort(*.value).reverse.map(*.kv) -> ($dist-id, $dist) { - return ($dist-id, $version < 1 ?? $dist !! self!read-dist($dist-id)); + return ($dist-id, $repo-version < 1 ?? $dist !! self!read-dist($dist-id)); } } } @@ -356,9 +444,11 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my ($dist-id, $dist) = self!matching-dist($spec); if $dist-id { my $loader = $.prefix.child('sources').child( - $dist{$spec.short-name}.first(*.so) + $dist{$spec.short-name}.values[0] ); my $id = $loader.basename; + + # xxx: replace :distribution with meta6 return CompUnit.new( :handle(CompUnit::Handle), :short-name($spec.short-name), @@ -366,7 +456,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { :auth($dist // Str), :repo(self), :repo-id($id), - :distribution(Distribution.new(|$dist)), + :distribution(Distribution::Hash.new($dist.hash, :$.prefix)), ); } return self.next-repo.resolve($spec) if self.next-repo; @@ -383,9 +473,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my ($dist-id, $dist) = self!matching-dist($spec); if $dist-id { return %!loaded{$spec.short-name} if %!loaded{$spec.short-name}:exists; - my $loader = $.prefix.child('sources').child( - $dist{$spec.short-name}.first(*.so) + $dist{$spec.short-name}.values[0] ); my $*RESOURCES = Distribution::Resources.new(:repo(self), :$dist-id); my $id = $loader.basename; @@ -402,6 +491,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { my $precompiled = defined $handle; $handle //= CompUnit::Loader.load-source-file($loader); + # xxx: replace :distribution with meta6 my $compunit = CompUnit.new( :$handle, :short-name($spec.short-name), @@ -410,7 +500,7 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { :repo(self), :repo-id($id), :$precompiled, - :distribution(Distribution.new(|$dist)), + :distribution(Distribution::Hash.new($dist.hash, :$.prefix)), ); return %!loaded{$compunit.short-name} = $compunit; } @@ -420,7 +510,8 @@ sub MAIN(:$name is copy, :$auth, :$ver, *@, *%) { method resource($dist-id, $key) { my $dist = Rakudo::Internals::JSON.from-json(self!dist-dir.child($dist-id).slurp); - self!resources-dir.child($dist{$key}) + # need to strip the leading resources/ on old repositories + self!resources-dir.child($dist{$key.substr(self!repository-version < 2 ?? 10 !! 0)}) } method id() { diff --git a/src/core/Distribution.pm b/src/core/Distribution.pm index dc8780852d8..4056256d47b 100644 --- a/src/core/Distribution.pm +++ b/src/core/Distribution.pm @@ -1,38 +1,93 @@ -class Distribution { - has $.name; - has $.auth; - has $.author; - has $.authority; - has $.api; - has $.ver; - has $.version; - has $.description; - has @.depends; - has %.provides; - has %.files; - has $.source-url; - method auth { $!auth // $!author // $!authority } - method ver { $!ver // $!version } - method hash { - { - :$!name, - :$.auth, - :$.ver, - :$!description, - :@!depends, - :%!provides, - :%!files, - :$!source-url, - } +# API to obtain the data of any addressable content +role Distribution { + # `meta` provides an API to the meta data in META6 spec (s22) + # - A Distribution may be represented internally by some other + # spec (such as using the file system itself for prereqs), as + # long as it can also be represented as the META6 hash format + method meta(--> Hash) { ... } + + # `content($content-id)` provides an API to the data itself + # - Use `.meta` to determine the $address of a specific $content-id + # - IO::Handle is meant to be a data stream that may or may not be available; for now + # it would return an IO::Handle and have `.open.slurp-rest(:bin)` called on it. So if + # a socket wants to handle this role currently it would have to wrap `open` or `.slurp-rest` + # to handle any protocol negotiation as well as probably saving the data to a tmpfile and + # return an IO::Handle to that + method content($content-id --> IO::Handle) { ... } +} + +role Distribution::Locally { + has IO::Path $.prefix; + method content($address) { + my $handle = IO::Handle.new: path => IO::Path.new($address, :CWD($!prefix // $*CWD)); + $handle // $handle.throw; + } +} + +# A distribution passed to `CURI.install()` will get encapsulated in this +# class, which normalizes the meta6 data and adds identifiers/content-id +class CompUnit::Repository::Distribution { + has Distribution $!dist handles 'content'; + has $!meta; + submethod BUILD(:$!meta, :$!dist) { } + method new(Distribution $dist) { + my $meta = $dist.meta.hash; + $meta //= $meta; + $meta //= $meta // $meta; + self.bless(:$dist, :$meta); } + method meta { $!meta } + method Str() { - return "{$.name}:ver<{$.ver // ''}>:auth<{$.auth // ''}>:api<{$.api // ''}>"; + return "{$.meta}" + ~ ":ver<{$.meta // ''}>" + ~ ":auth<{$.meta // ''}>" + ~ ":api<{$.meta // ''}>"; + } + method id() { return nqp::sha1(self.Str); } } +class Distribution::Hash does Distribution does Distribution::Locally { + has $!meta; + submethod BUILD(:$!meta, :$!prefix) { } + method new($hash, :$prefix) { self.bless(:meta($hash), :$prefix) } + method meta { $!meta } +} + +class Distribution::Path does Distribution does Distribution::Locally { + has $!meta; + submethod BUILD(:$!meta, :$!prefix) { } + method new(IO::Path $prefix, IO::Path :$file is copy) { + my $path := ?$file ?? $file !! $prefix.child('META6.json'); + die "No meta file located at {$path.abspath}" unless $path.e; + my $meta = Rakudo::Internals::JSON.from-json(slurp($path)); + + my sub ls-files($prefix, $subdir) { + my @stack = dir($prefix.child($subdir)); + my @files = eager gather while ( @stack ) { + my IO::Path $current = @stack.pop; + my Str $relpath = $current.relative($prefix); + take $relpath and next if $current.f; + next if $current.basename eq '.precomp'; + @stack.append( |dir($current.absolute) ) if $current.d; + } + } + + # generate `files` (special directories) directly from the file system + my @bins = ls-files($prefix, 'bin'); + my @resources = ls-files($prefix, 'resources'); + my @files = grep *.defined, unique(|$meta, |@bins, |@resources); + $meta = @files; + + self.bless(:$meta, :$prefix); + } + method meta { $!meta } +} + role CompUnit::Repository { ... } class Distribution::Resources does Associative { has Str $.dist-id; @@ -57,7 +112,7 @@ class Distribution::Resources does Associative { } method AT-KEY($key) { - CompUnit::RepositoryRegistry.repository-for-spec($.repo).resource($.dist-id, $key) + CompUnit::RepositoryRegistry.repository-for-spec($.repo).resource($.dist-id, "resources/$key") } method Str() { diff --git a/tools/build/Makefile-JVM.in b/tools/build/Makefile-JVM.in index f49d2a695da..14fb40b4b5b 100644 --- a/tools/build/Makefile-JVM.in +++ b/tools/build/Makefile-JVM.in @@ -378,27 +378,11 @@ j-install: j-all tools/build/create-jvm-runner.pl tools/build/install-core-dist. $(CP) $(PERL6_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime $(CP) $(PERL6_DEBUG_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime $(CP) $(RUNTIME_JAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/version - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/vendor/version - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/site/version + .@slash@$(J_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR) + $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor + .@slash@$(J_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR)/vendor + $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site + .@slash@$(J_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR)/site .@slash@$(J_RUNNER) tools/build/install-core-dist.pl $(DESTDIR)$(PERL6_LANG_DIR) $(PERL5) tools/build/create-jvm-runner.pl install "$(DESTDIR)" $(PREFIX) $(NQP_PREFIX) $(NQP_JARS) $(PERL5) tools/build/create-jvm-runner.pl install-debug "$(DESTDIR)" $(PREFIX) $(NQP_PREFIX) $(NQP_JARS) diff --git a/tools/build/Makefile-Moar.in b/tools/build/Makefile-Moar.in index 95c037ef312..1e3d8001c57 100644 --- a/tools/build/Makefile-Moar.in +++ b/tools/build/Makefile-Moar.in @@ -266,28 +266,9 @@ m-install: m-all tools/build/create-moar-runner.pl tools/build/install-core-dist $(CP) $(PERL6_MOAR) $(PERL6_DEBUG_MOAR) $(DESTDIR)$(PERL6_LANG_DIR)/runtime $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/runtime/dynext $(CP) $(M_PERL6_OPS_DLL) $(DESTDIR)$(PERL6_LANG_DIR)/runtime/dynext - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/version - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/vendor/version - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/vendor/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/dist - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/sources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/resources - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/bin - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/short - $(MKPATH) $(DESTDIR)$(PERL6_LANG_DIR)/site/precomp - echo 1 > $(DESTDIR)$(PERL6_LANG_DIR)/site/version + .@slash@$(M_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR) + .@slash@$(M_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR)/vendor + .@slash@$(M_RUNNER) tools/build/upgrade-repository.pl $(DESTDIR)$(PERL6_LANG_DIR)/site .@slash@$(M_RUNNER) tools/build/install-core-dist.pl $(DESTDIR)$(PERL6_LANG_DIR) $(PERL5) tools/build/create-moar-runner.pl "$(MOAR)" perl6.moarvm $(DESTDIR)$(PREFIX)/bin/perl6-m "$(PERL6_LANG_DIR)/runtime" "" "$(M_LIBPATH)" "$(PERL6_LANG_DIR)/lib" "$(PERL6_LANG_DIR)/runtime" $(PERL5) tools/build/create-moar-runner.pl "$(MOAR)" perl6-debug.moarvm $(DESTDIR)$(PREFIX)/bin/perl6-debug-m "$(PERL6_LANG_DIR)/runtime" "" "$(M_LIBPATH)" "$(PERL6_LANG_DIR)/lib" "$(PERL6_LANG_DIR)/runtime" diff --git a/tools/build/install-core-dist.pl b/tools/build/install-core-dist.pl index 0904c1a7122..be8054f1229 100644 --- a/tools/build/install-core-dist.pl +++ b/tools/build/install-core-dist.pl @@ -15,16 +15,13 @@ "inst#@*ARGS[0]", :next-repo(CompUnit::RepositoryRegistry.repository-for-name('perl').next-repo), ); -$*REPO.install( - Distribution.new( - name => "CORE", - auth => "perl", - ver => $*PERL.version.Str, - provides => %provides, - ), - %provides, - :force, -); +my $dist = Distribution::Hash.new(%( + name => "CORE", + auth => "perl", + ver => $*PERL.version.Str, + provides => %provides, +), prefix => $*CWD); +$*REPO.install($dist, :force); note "installed!"; diff --git a/tools/build/upgrade-repository.pl b/tools/build/upgrade-repository.pl new file mode 100644 index 00000000000..84e4ff1f31e --- /dev/null +++ b/tools/build/upgrade-repository.pl @@ -0,0 +1,3 @@ +CompUnit::Repository::Installation.new(:prefix(@*ARGS[0])).upgrade-repository; + +# vim: ft=perl6 diff --git a/tools/install-dist.pl b/tools/install-dist.pl index 0be163208e8..6601a413e97 100644 --- a/tools/install-dist.pl +++ b/tools/install-dist.pl @@ -62,16 +62,13 @@ :next-repo(CompUnit::RepositoryRegistry.repository-for-name($for)), :name($for), ).install( - Distribution.new(|$dist-dir.meta), - $dist-dir.sources, - $dist-dir.scripts, - $dist-dir.resources, + Distribution::Hash.new($dist-dir.meta, :prefix($from)), ); $_.unlink for .map: {"$to/$_".IO}; } -multi sub MAIN($from is copy = '.', :$to = 'site') { +multi sub MAIN($from is copy = '.', :$to = 'site', Bool :$force) { $from = $from.IO; my $dist-dir = Distribution::Directory.new(path => $from); @@ -79,10 +76,8 @@ ?? CompUnit::RepositoryRegistry.repository-for-name($to) !! CompUnit::RepositoryRegistry.repository-for-spec($to); $repo.install( - Distribution.new(|$dist-dir.meta), - $dist-dir.sources, - $dist-dir.scripts, - $dist-dir.resources, + Distribution::Hash.new($dist-dir.meta, :prefix($from)), + :$force, ); }