Skip to content

Commit

Permalink
Rename all occurences of DESTDIR to PREFIX, so it's now named accordi…
Browse files Browse the repository at this point in the history
…ngly to its semantics
  • Loading branch information
Tadeusz Sośnierz committed Aug 27, 2015
1 parent 7e66512 commit 43525de
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
21 changes: 10 additions & 11 deletions bootstrap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
my $is_win = $DISTRO.is-win;

my $panda-base;
my $destdir = %ENV<DESTDIR>;
$destdir = "$CWD/$destdir" if defined($destdir) && $is_win && $destdir !~~ /^ '/' /;
for grep(*.defined, $destdir, %*CUSTOM_LIB<site home>) -> $prefix {
$destdir = $prefix;
$panda-base = "$prefix/panda";
try mkdir $destdir;
my $prefix = %ENV<PREFIX>;
$prefix = "$CWD/$prefix" if defined($prefix) && $is_win && $prefix !~~ /^ '/' /;
for grep(*.defined, $prefix, %*CUSTOM_LIB<site home>) -> $target {
$prefix = $target;
$panda-base = "$target/panda";
try mkdir $prefix;
try mkpath $panda-base unless $panda-base.IO ~~ :d;
last if $panda-base.IO.w
}
Expand All @@ -41,22 +41,21 @@

my $env_sep = $DISTRO.?cur-sep // $DISTRO.path-sep;

#%ENV<RAKUDOLIB> = "$destdir.^name()=$destdir" if $destdir.^can('install'); # WAT?
%ENV<PERL6LIB> = join( $env_sep,
"$destdir/lib",
"$prefix/lib",
"$CWD/ext/File__Find/lib",
"$CWD/ext/Shell__Command/lib",
"$CWD/ext/JSON__Fast/lib",
"$CWD/lib",
);

shell "$*EXECUTABLE bin/panda install $*CWD";
if "$destdir/panda/src".IO ~~ :d {
rm_rf "$destdir/panda/src"; # XXX This shouldn't be necessary, I think
if "$prefix/panda/src".IO ~~ :d {
rm_rf "$prefix/panda/src"; # XXX This shouldn't be necessary, I think
# that src should not be kept at all, but
# I figure out how to do that nicely, let's
# at least free boostrap from it
}
say "==> Please make sure that $destdir/bin is in your PATH";
say "==> Please make sure that $prefix/bin is in your PATH";

unlink "$panda-base/projects.json";
22 changes: 11 additions & 11 deletions lib/Panda/App.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ use Panda::Project;
# initialize the Panda object
sub make-default-ecosystem is export {
my $pandadir;
my $destdir = %*ENV<DESTDIR>;
$destdir = "$*CWD/$destdir" if defined($destdir) && !$*DISTRO.is-win && $destdir !~~ /^ '/' /;
for grep(*.defined, $destdir, %*CUSTOM_LIB<site home>) -> $prefix {
$destdir = $prefix;
$pandadir = "$prefix/panda".IO;
my $prefix = %*ENV<PREFIX>;
$prefix = "$*CWD/$prefix" if defined($prefix) && !$*DISTRO.is-win && $prefix !~~ /^ '/' /;
for grep(*.defined, $prefix, %*CUSTOM_LIB<site home>) -> $target {
$prefix = $target;
$pandadir = "$target/panda".IO;
try mkpath $pandadir unless $pandadir ~~ :d;
last if $pandadir.w;
}
Expand All @@ -19,22 +19,22 @@ sub make-default-ecosystem is export {
}

my @extra-statefiles;
unless $destdir eq %*CUSTOM_LIB<site> {
for grep(*.defined, $destdir, %*CUSTOM_LIB<site home>) -> $prefix {
unless $destdir eq $prefix {
@extra-statefiles.push("$prefix/panda/state");
unless $prefix eq %*CUSTOM_LIB<site> {
for grep(*.defined, $prefix, %*CUSTOM_LIB<site home>) -> $target {
unless $prefix eq $target {
@extra-statefiles.push("$target/panda/state");
}
}
}

# Add the path we're installing to @*INC
#
# If we're installing to a custom destdir or we're installing to a standard
# If we're installing to a custom prefix or we're installing to a standard
# dir that did not exist, it isn't in @*INC (which will make Build.pm
# files that depend on the modules we just installed break).
#
# If this is already in @*INC, it doesn't harm anything to re-add it.
@*INC.push("file#" ~ $destdir ~ '/lib'); # TEMPORARY !!!
@*INC.push("file#" ~ $prefix ~ '/lib'); # TEMPORARY !!!

return Panda::Ecosystem.new(
statefile => "$pandadir/state",
Expand Down
10 changes: 5 additions & 5 deletions lib/Panda/Installer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use Panda::Project;
use File::Find;
use Shell::Command;

has $.destdir = self.default-destdir();
has $.prefix = self.default-prefix();

method sort-lib-contents(@lib) {
my @generated = @lib.grep({ $_ ~~ / \. <{compsuffix}> $/});
Expand All @@ -13,8 +13,8 @@ method sort-lib-contents(@lib) {
}

# default install location
method default-destdir {
my $ret = %*ENV<DESTDIR>;
method default-prefix {
my $ret = %*ENV<PREFIX>;
if defined($ret) && !$*DISTRO.is-win && $ret !~~ /^ '/' / {
$ret = "$*CWD/$ret" ;
}
Expand All @@ -36,10 +36,10 @@ sub copy($src, $dest) {

method install($from, $to? is copy, Panda::Project :$bone) {
unless $to {
$to = $.destdir
$to = $.prefix;
}
indir $from, {
# check if $.destdir is under control of a CompUnitRepo
# check if $.prefix is under control of a CompUnitRepo
if $to.can('install') {
my @files;
if 'blib'.IO ~~ :d {
Expand Down
2 changes: 1 addition & 1 deletion rebootstrap.pl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# Find old state file
my ($prefix, $state-file, $reports-file);
for grep(*.defined, %*ENV<DESTDIR>, %*CUSTOM_LIB<site home>) {
for grep(*.defined, %*ENV<PREFIX>, %*CUSTOM_LIB<site home>) {
if "$_/panda/state".IO.e {
$prefix = $_;
$state-file = "$_/panda/state";
Expand Down

0 comments on commit 43525de

Please sign in to comment.