dev-server: more verbose, build camdbinit lazily (speeds start-up)

Change-Id: I0a5dc255efd2cfcde7ff735a79ceeeb4b9965b08
This commit is contained in:
Brad Fitzpatrick 2013-01-20 12:33:35 -08:00
parent f696b164f4
commit fb24b240cc
2 changed files with 7 additions and 6 deletions

View File

@ -65,13 +65,13 @@ unless ($opt_fast) {
} }
my $camlistored; my $camlistored;
my $camdbinit; my $camdbinit; # closure to return path
if ($opt_nobuild) { if ($opt_nobuild) {
$camlistored = find_bin("./server/camlistored"); $camlistored = find_bin("./server/camlistored");
$camdbinit = find_bin("./cmd/camdbinit"); $camdbinit = sub { scalar find_bin("./cmd/camdbinit") };
} else { } else {
$camlistored = build_bin("./server/camlistored"); $camlistored = build_bin("./server/camlistored");
$camdbinit = build_bin("./cmd/camdbinit"); $camdbinit = sub { scalar build_bin("./cmd/camdbinit") };
} }
my $root = "/tmp/camliroot-$ENV{USER}/port$port/"; my $root = "/tmp/camliroot-$ENV{USER}/port$port/";
@ -113,7 +113,7 @@ if ($opt_memory) {
} elsif ($opt_postgres) { } elsif ($opt_postgres) {
$ENV{"CAMLI_POSTGRES_ENABLED"} = "true"; $ENV{"CAMLI_POSTGRES_ENABLED"} = "true";
$ENV{"CAMLI_INDEXER_PATH"} = "/index-postgres/"; $ENV{"CAMLI_INDEXER_PATH"} = "/index-postgres/";
system("$camdbinit", system($camdbinit->(),
"-postgres", "-postgres",
"-user=postgres", "-user=postgres",
"-password=postgres", "-password=postgres",
@ -123,7 +123,7 @@ if ($opt_memory) {
} else { } else {
$ENV{"CAMLI_MYSQL_ENABLED"} = "true"; $ENV{"CAMLI_MYSQL_ENABLED"} = "true";
$ENV{"CAMLI_INDEXER_PATH"} = "/index-mysql/"; $ENV{"CAMLI_INDEXER_PATH"} = "/index-mysql/";
system("$camdbinit", system($camdbinit->(),
"-user=root", "-user=root",
"-password=root", "-password=root",
"-host=localhost", "-host=localhost",

View File

@ -5,7 +5,8 @@ use FindBin qw($Bin);
sub build_bin { sub build_bin {
my $target = shift; my $target = shift;
$ENV{GOBIN} = find_gobin(); $ENV{GOBIN} = find_gobin();
system("go", "install", $target) and die "go install $target failed"; print STDERR "Building $target ...\n";
system("go", "install", "-v", $target) and die "go install $target failed";
$target =~ s!.+/!!; $target =~ s!.+/!!;
my $bin = "$ENV{GOBIN}/$target"; my $bin = "$ENV{GOBIN}/$target";
unless (-e $bin) { unless (-e $bin) {