Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge master, fixing minor conflict in 'panda list' code

  • Loading branch information...
commit aefb75b0fc7359020db34f55b1af6a8ceaf5ebb9 2 parents d0553e2 + a2c9fa8
@japhb japhb authored
View
19 TODO
@@ -1,2 +1,21 @@
+* Fix DESTDIR to know the difference between absolute and relative paths
+* Support DESTDIR as way to build deployable package
+ - don't modify statefile when DESTDIR is set unless DESTDIR is ~/.perl6/
+ - envvar to use a different statefile?
+* Finish verbose-list branch
+ - save 'git describe --always --dirty' result in saved-meta
+ - make 'panda list' output narrower by default
+ . with a --verbose option for more?
+ - show both installed and available version in 'panda list' or 'panda info'
+ - merge branch back
+* Open GitHub issues:
+ - #4: Fix fetcher.t to silence (expected) Git error message
+ - #12: Error checking for Ecosystem::update
+ - #16: Fuzzy match misspelled modules (wrong case, small edit distance, etc.)
+ . Always try exact match first
* Keep track of the installed files so they can be removed later
- it's tricky if they're installed to some DESTDIR
+* Retain --notests and --nodeps setting in statefile, so that rebootstrap
+ can survive rebuilding projects that require these settings
+* Merge with panda-niecza?
+* Update README.md to represent current reality
View
10 bin/panda
@@ -13,7 +13,7 @@ sub listprojects($panda, :$installed) {
for @projects -> $x {
my $s = do given $es.project-get-state($x) {
when 'installed' { '[installed]' }
- when 'installed-dep' { '[installed as a dependency]' }
+ when 'installed-dep' { '-dependency-' }
default { '' }
}
@@ -21,7 +21,7 @@ sub listprojects($panda, :$installed) {
my $url = $meta<source-url> // $meta<repo-url> // 'UNKNOWN';
my $ver = $meta<version>;
- printf "%-{$max-name}s %-{$max-ver}s %-27s %s\n",
+ printf "%-{$max-name}s %-{$max-ver}s %-12s %s\n",
$x.name, $ver, $s, $url;
}
}
@@ -76,12 +76,12 @@ my $panda;
my $pandadir = "$home/.panda";
mkpath $pandadir unless $pandadir.IO ~~ :d;
- my $projectsfile = "$pandadir/projects.json";
+ my $destdir = %*ENV<DESTDIR> || "$home/.perl6";
+ $destdir = "{cwd}/$destdir" unless $destdir ~~ /^ '/' /;
$panda = Panda.new(
srcdir => "$pandadir/src",
- destdir => %*ENV<DESTDIR> ?? "{cwd}/%*ENV<DESTDIR>"
- !! "$home/.perl6",
+ destdir => $destdir,
statefile => "$pandadir/state",
projectsfile => "$pandadir/projects.json"
);
View
27 bootstrap.pl 100644 → 100755
@@ -1,33 +1,32 @@
+#!/usr/bin/env perl6
use v6;
+say '==> Bootstrapping Panda';
+
my $home = $*OS eq 'MSWin32' ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;
-mkdir $home unless $home.IO.d;
+mkdir $home unless $home.IO.d;
mkdir "$home/.panda" unless "$home/.panda".IO.d;
-my $projects = slurp 'projects.json.bootstrap';
-$projects ~~ s:g/_BASEDIR_/{cwd}\/ext/;
+
+my $projects = slurp 'projects.json.bootstrap';
+ $projects ~~ s:g/_BASEDIR_/{cwd}\/ext/;
+ $projects .= subst('\\', '/', :g) if $*OS eq 'MSWin32';
+
given open "$home/.panda/projects.json", :w {
.say: $projects;
.close;
}
-my $oldenv = %*ENV<PERL6LIB> // '';
my $env_sep = $*VM<config><osname> eq 'MSWin32' ?? ';' !! ':';
+my $destdir = %*ENV<DESTDIR> || "$home/.perl6";
+ $destdir = "{cwd}/$destdir" unless $destdir ~~ /^ '/' /;
-
-if %*ENV<DESTDIR> {
- %*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/{%*ENV<DESTDIR>}/lib"
-}
-
+%*ENV<PERL6LIB> ~= "{$env_sep}$destdir/lib";
%*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/ext/File__Tools/lib";
%*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/ext/JSON__Tiny/lib";
%*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/ext/Test__Mock/lib";
%*ENV<PERL6LIB> ~= "{$env_sep}{cwd}/lib";
-shell "perl6 bin/panda install File::Tools JSON::Tiny Test::Mock";
-
-%*ENV<PERL6LIB> = join $env_sep, $oldenv, cwd() ~ '/lib';
-
-shell "perl6 bin/panda install .";
+shell "perl6 bin/panda install File::Tools JSON::Tiny Test::Mock {cwd}";
unlink "$home/.panda/projects.json";
View
11 ext/File__Tools/lib/Shell/Command.pm
@@ -1,4 +1,5 @@
module Shell::Command;
+use File::Find;
sub cat(*@files) is export {
for @files -> $f {
@@ -17,12 +18,18 @@ sub eqtime($source, $dest) is export {
sub rm_f(*@files) is export {
for @files -> $f {
- unlink $f if $f.IO ~~ :e;
+ unlink $f if $f.IO.e;
}
}
sub rm_rf(*@files) is export {
- ???
+ for @files -> $path {
+ next unless $path.IO.e;
+ for find(dir => $path).map({ .Str }).reverse -> $f {
+ $f.IO.d ?? rmdir($f) !! unlink($f);
+ }
+ rmdir $path;
+ }
}
sub touch(*@files) is export {
View
2  lib/Panda/Installer.pm
@@ -26,7 +26,7 @@ class Panda::Installer does Pies::Installer {
for find(dir => 'bin', type => 'file').list -> $bin {
mkpath "$!destdir/{$bin.dir}";
$bin.IO.copy("$!destdir/$bin");
- "$!destdir/$bin".IO.chmod(0o755);
+ "$!destdir/$bin".IO.chmod(0o755) unless $*OS eq 'MSWin32';
}
}
if 'doc'.IO ~~ :d {
View
10 rebootstrap.pl
@@ -1,5 +1,7 @@
#!/usr/bin/env perl6
use v6;
+use lib 'ext/File__Tools/lib';
+use Shell::Command;
# Find old state file
my $home = $*OS eq 'MSWin32' ?? %*ENV<HOMEDRIVE> ~ %*ENV<HOMEPATH> !! %*ENV<HOME>;
@@ -7,7 +9,8 @@
if not $state-file.IO.e {
say "No need to rebootstrap, running normal bootstrap";
- run 'perl6 bootstrap.pl';
+ shell 'perl6 bootstrap.pl';
+ exit 0;
}
# Save a copy of the old state file to be written *after* bootstrapping again
@@ -29,9 +32,8 @@
# Clean old directories, boostrap a fresh panda,
# and reinstall all manually-installed modules
-# TODO: Make me cross-platform
-shell 'rm -rf ~/.perl6/lib';
-shell 'rm -rf ~/.panda';
+rm_rf "$home/.perl6/lib";
+rm_rf "$home/.panda";
shell 'perl6 bootstrap.pl';
shell "panda install @modules[]";
View
3  t/panda/builder.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Builder;
use Panda::Resources;
+use Shell::Command;
plan 5;
@@ -19,6 +20,6 @@ ok "$srcdir/dummymodule/blib/lib/foo.pm".IO ~~ :f, 'and opied to blib';
ok "$srcdir/dummymodule/blib/lib/manual.pod".IO ~~ :f, 'pod copied too';
ok "$srcdir/dummymodule/blib/lib/bar.pir".IO !~~ :f, 'pod not compiled';
-shell "rm -rf $srcdir/dummymodule/blib";
+rm_rf "$srcdir/dummymodule/blib";
# vim: ft=perl6
View
4 t/panda/ecosystem.t
@@ -4,7 +4,7 @@ plan 10;
't/panda/fakestate'.IO.copy('REMOVEME');
my $a = Panda::Ecosystem.new(
- statefile => 'REMOVEME',
+ statefile => "{cwd}/REMOVEME",
projectsfile => 't/panda/fakeprojects'
) but role {
method flush-states { }
@@ -31,6 +31,6 @@ is $b.dependencies[0], 'some', 'dependencies 1';
is $b.dependencies[1], 'thing', 'dependencies 2';
is $b.dependencies[2], 'else', 'dependencies 3';
-unlink 'REMOVEME';
+unlink "{cwd}/REMOVEME";
# vim: ft=perl6
View
3  t/panda/fetcher.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Fetcher;
use Panda::Resources;
+use Shell::Command;
plan 4;
@@ -30,6 +31,6 @@ $p.metainfo<source-url> = 'testmodules/dummymodule';
lives_ok { $f.fetch($p) }, 'can fetch a local project';
ok "$srcdir/foobar/lib/foo.pm".IO ~~ :f, 'fetch ok';
-shell "rm -r $srcdir";
+rm_rf $srcdir;
# vim: ft=perl6
View
3  t/panda/installer.t
@@ -1,6 +1,7 @@
use Test;
use Panda::Installer;
use Panda::Resources;
+use Shell::Command;
plan 7;
@@ -27,6 +28,6 @@ file_exists_ok "$destdir/compiled/module/doc/foofile",
file_exists_ok "$destdir/compiled/module/doc/bardir/barfile",
'docs installed 2';
-shell "rm -rf $destdir";
+rm_rf $destdir;
# vim: ft=perl6
Please sign in to comment.
Something went wrong with that request. Please try again.