Skip to content

Commit

Permalink
Revert "Add CUR::Staging.candidates method"
Browse files Browse the repository at this point in the history
This reverts commit 50025c1.
  • Loading branch information
niner committed Oct 1, 2022
1 parent 6937da1 commit 454752e
Showing 1 changed file with 3 additions and 53 deletions.
56 changes: 3 additions & 53 deletions lib/CompUnit/Repository/Staging.rakumod
@@ -1,36 +1,10 @@
use nqp; # we're using nqp::iscont() for convenience

class CompUnit::Repository::Staging is CompUnit::Repository::Installation {
has Str:D $.name is required;
has Bool:D $!replace is built(:bind) = False;
has Str $.name;
has CompUnit::Repository $!parent;
# repo to (re)set next-repo of, if $!replace is set, and this isn't
# then the $!parent was the first repo in the chain
has CompUnit::Repository $!prev-repo;

submethod TWEAK(--> Nil) {
$!parent = CompUnit::RepositoryRegistry.repository-for-name($!name);

if $!replace {
my $repo := $*REPO;
if $repo ~~ $!parent {
self.next-repo = $repo.next-repo;
nqp::iscont($repo)
?? ($repo = self)
!! (PROCESS::<$REPO> := self);
}
else {
$!prev-repo := $repo;
while ($repo := $repo.next-repo) && $repo !~~ $!parent {
$!prev-repo := $repo;
}
die "Repository '$!name' is not part of the REPO-chain"
unless $repo;

self.next-repo = $!prev-repo.next-repo;
$!prev-repo.next-repo = self;
}
}
CompUnit::RepositoryRegistry.register-name($!name, self);
}

method short-id(--> Str:D) { 'staging' }
Expand All @@ -39,24 +13,6 @@ class CompUnit::Repository::Staging is CompUnit::Repository::Installation {
self.^name ~ '#name(' ~ $!name ~ ')#' ~ self.prefix.absolute
}

# make sure we include any candidates of the repo being shadowed
method candidates(|c) {
if callsame() -> @staging_candidates {
if $!parent.candidates(|c) -> @installed_candidates {
(|@installed_candidates, |@staging_candidates)
.sort(*.meta<ver>)
.sort(*.meta<api>)
.reverse
}
else {
@staging_candidates
}
}
else {
$!parent.candidates(|c)
}
}

method source-file(CompUnit::Repository::Staging:D:
Str:D $name
--> IO::Path) {
Expand Down Expand Up @@ -89,6 +45,7 @@ class CompUnit::Repository::Staging is CompUnit::Repository::Installation {
.throw without $io.unlink; # throw actual failures
}
}

method remove-artifacts(CompUnit::Repository::Staging:D: --> Nil) {
my $io := self.prefix;
really-unlink($io.child("version"));
Expand All @@ -115,13 +72,6 @@ class CompUnit::Repository::Staging is CompUnit::Repository::Installation {
}
method self-destruct(CompUnit::Repository::Staging:D: --> Nil) {
self-destruct self.prefix;
if $!replace {
$!prev-repo
?? ($!prev-repo.next-repo = $!parent)
!! nqp::iscont($*REPO)
?? ($*REPO = $!parent)
!! (PROCESS::<$REPO> := $!parent);
}
}
}

Expand Down

0 comments on commit 454752e

Please sign in to comment.