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 $camdbinit;
my $camdbinit; # closure to return path
if ($opt_nobuild) {
$camlistored = find_bin("./server/camlistored");
$camdbinit = find_bin("./cmd/camdbinit");
$camdbinit = sub { scalar find_bin("./cmd/camdbinit") };
} else {
$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/";
@ -113,7 +113,7 @@ if ($opt_memory) {
} elsif ($opt_postgres) {
$ENV{"CAMLI_POSTGRES_ENABLED"} = "true";
$ENV{"CAMLI_INDEXER_PATH"} = "/index-postgres/";
system("$camdbinit",
system($camdbinit->(),
"-postgres",
"-user=postgres",
"-password=postgres",
@ -123,7 +123,7 @@ if ($opt_memory) {
} else {
$ENV{"CAMLI_MYSQL_ENABLED"} = "true";
$ENV{"CAMLI_INDEXER_PATH"} = "/index-mysql/";
system("$camdbinit",
system($camdbinit->(),
"-user=root",
"-password=root",
"-host=localhost",

View File

@ -5,7 +5,8 @@ use FindBin qw($Bin);
sub build_bin {
my $target = shift;
$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!.+/!!;
my $bin = "$ENV{GOBIN}/$target";
unless (-e $bin) {