Permalink
Browse files

Build script and test enhancements

Bundled libcouchbase version with consistent error reporting

Tests now more consistent with connection errors

Removed sasl dependency in favor of libcouchbase embedded isasl

Prompt for Java and whether to build dependencies

Fixed Makefile target for libcouchbase.so/EU::MM for non-gmake make
variants

Added dependency for proper version of ExtUtils::CBuilder which includes
env CFLAGS

Removed Log::Fu from src/Makefile.PL, one way to our step of removing
un-needed deps

Include Perl's @Config{qw(cflags ldflags} for ultimate target, stripping
defines, optimization and other compiler/linker directives
  • Loading branch information...
1 parent fdc0e6a commit c25036baca3a3888173b77da11f0c0fc719b6014 @mnunberg mnunberg committed Feb 25, 2012
Showing with 140 additions and 49 deletions.
  1. +1 −2 MANIFEST
  2. +0 −1 MANIFEST.in
  3. +25 −1 Makefile.PL
  4. +2 −2 PLCB_Config.pm
  5. +13 −12 build_libraries.pl
  6. +12 −0 couchbase-client.kpf
  7. +1 −1 lib/Couchbase/Client.pm
  8. +1 −1 lib/Couchbase/Client/Async.pm
  9. +13 −4 lib/Couchbase/Test/Settings.pm
  10. +72 −25 src/Makefile.PL
View
@@ -61,7 +61,6 @@ src/Makefile.PL
src/libcouchbase.pm
src/memcached-headers.tar.gz
-src/libcouchbase-1.0.0_70_ge8ad2ee.tar.gz
+src/libcouchbase-1.0.0_75_g5622928.tar.gz
src/libvbucket-1.8.0.2.tar.gz
src/libevent-2.0.17-stable.tar.gz
-src/libisasl-1.0.0_3_g35e33e3.tar.gz
View
@@ -64,4 +64,3 @@ src/memcached-headers.tar.gz
src/libcouchbase-__LIBCOUCHBASE_RELEASE__.tar.gz
src/libvbucket-__LIBVBUCKET_RELEASE__.tar.gz
src/libevent-__LIBEVENT_RELEASE__.tar.gz
-src/libisasl-__LIBISASL_RELEASE__.tar.gz
View
@@ -14,7 +14,6 @@ use lib 'inc';
use Devel::CheckLib;
use Data::Dumper;
-log_err(__DIR__ . "/Makefile.PL");
$ENV{LD_RUN_PATH} ||= "";
#$Verbose = 99;
@@ -35,6 +34,7 @@ EOD
our (@LIBS,$INC);
our $MM_TopLevel;
our $Constants_INC = "";
+our $HaveJava = 0;
push @LIBS, $U_LibPath if $U_LibPath;
$INC = $U_IncPath || "";
@@ -95,6 +95,26 @@ if($ENV{PLCB_BUILD_AUTHOR}) {
$MM_Options{OPTIMIZE} = '-Wdeclaration-after-statement -Werror -std=gnu89';
}
+################################################################################
+### Check for Java ###
+################################################################################
+print STDERR "Checking for working Java (for tests)\n. Running java -version\n";
+$HaveJava = (system("java -version") == 0);
+if(!$HaveJava) {
+ my $promptval = prompt(
+ "java was not found in your path. You must have java to properly\n".
+ "test Couchbase::Client. Java is not a runtime dependency and this\n".
+ "module will likely function properly without it, but will be untested\n".
+ "on your specific installation.\n\n".
+ "Abort installation?", "n");
+
+ if($promptval =~ /^y/i) {
+ print STDERR "You have request to abort the installation.\n".
+ "Makefile.PL will now exit\n";
+ exit(0);
+ }
+}
+
use Log::Fu;
$MM_Options{NEEDS_LINKING} = 1;
@@ -117,6 +137,10 @@ WriteMakefile(
BUILD_REQUIRES => {
'ExtUtils::H2PM' => 0.08,
+
+ #This is really a dependency of ExtUtils::H2PM, but we need a
+ #version which honors the CFLAGS environment variable.
+ 'ExtUtils::CBuilder' => 0.280203
},
PREREQ_PM => {
View
@@ -16,9 +16,9 @@ my $params = {
#version numbers for libcouchbase and libvbucket
LIBVBUCKET_RELEASE => '1.8.0.2',
- LIBCOUCHBASE_RELEASE => '1.0.0_70_ge8ad2ee',
+ LIBCOUCHBASE_RELEASE => '1.0.0_75_g5622928',
- LIBISASL_RELEASE => '1.0.0_3_g35e33e3',
+ #LIBISASL_RELEASE => '1.0.0_3_g35e33e3',
LIBEVENT_RELEASE => '2.0.17-stable',
};
View
@@ -17,6 +17,7 @@
'env-ldflags=s' => \my $ENV_LDFLAGS,
'env-libs=s' => \my $ENV_LIBS,
'rpath=s' => \my $RPATH,
+ 'have-java' => \my $HAVE_JAVA,
);
use lib __DIR__;
@@ -44,7 +45,7 @@
sub runcmd {
my $cmd = join(" ", @_);
- print STDERR "Running $cmd\n";
+ print STDERR "[EXECUTING]:\n\t$cmd\n";
unless(system($cmd . " $BUILD_SILENT") == 0) {
print STDERR "Command $cmd failed\n";
printf STDERR ("CPPFLAGS=%s\nLDFLAGS=%s\n", $ENV{CPPFLAGS}, $ENV{LDFLAGS});
@@ -74,7 +75,6 @@ sub tarball_2_dir {
################################################################################
my $LIBVBUCKET_TARBALL = lib_2_tarball('libvbucket');
my $LIBCOUCHBASE_TARBALL = lib_2_tarball('libcouchbase');
-my $LIBISASL_TARBALL = lib_2_tarball('libisasl');
my $LIBEVENT_TARBALL = lib_2_tarball('libevent');
my $MEMCACHED_H_TARBALL = "memcached-headers.tar.gz";
@@ -148,14 +148,16 @@ sub lib_is_built {
################################################################################
### ISASL ###
################################################################################
-if(should_build('ISASL')) {
- chdir $TOPLEVEL;
- chdir tarball_2_dir($LIBISASL_TARBALL);
- runcmd("./configure", @COMMON_OPTIONS) unless -e 'Makefile';
- log_info("Configuring libisasl");
- runcmd("$MAKEPROG install");
- log_info("Installed libisasl");
-}
+#my $LIBISASL_TARBALL = lib_2_tarball('libisasl');
+#disabled because we now bundle it with libcouchbase itself.
+#if(should_build('ISASL')) {
+# chdir $TOPLEVEL;
+# chdir tarball_2_dir($LIBISASL_TARBALL);
+# runcmd("./configure", @COMMON_OPTIONS) unless -e 'Makefile';
+# log_info("Configuring libisasl");
+# runcmd("$MAKEPROG install");
+# log_info("Installed libisasl");
+#}
################################################################################
### libevent ###
@@ -216,14 +218,13 @@ sub lib_is_built {
push @libcouchbase_options, '--disable-tools';
}
- my $have_java = eval { runcmd("java", "-version"); 1; };
my $mockpath = File::Spec->catfile(
__DIR__, 't', 'tmp', 'CouchbaseMock.jar');
if(!-e $mockpath) {
die("Can't find mock in $mockpath");
}
- if($have_java && -e $mockpath) {
+ if($HAVE_JAVA && -e $mockpath) {
push @libcouchbase_options, '--with-couchbasemock='.$mockpath;
} else {
push @libcouchbase_options, '--disable-couchbasemock';
View
@@ -2,9 +2,21 @@
<!-- Komodo Project File - DO NOT EDIT -->
<project id="32a0fd74-e11a-3743-94a7-9bb2f44a5377" kpf_version="4" name="couchbase-client.kpf">
<preference-set idref="32a0fd74-e11a-3743-94a7-9bb2f44a5377">
+ <string id="import_exclude_matches">*.*~;*.bak;*.tmp;CVS;.#*;*.pyo;*.pyc;.svn;*%*;tmp*.html;.DS_Store;*.o;*.swp*;*.json;Makefile;pm_to_blib;*.tar.gz;*.bs;*.xsc;log*</string>
+ <string id="import_include_matches"></string>
<boolean id="import_live">1</boolean>
+ <boolean id="import_recursive">0</boolean>
+ <string id="import_type">makeFlat</string>
+ <string id="lastTestPlanName_pref">New test plan #1</string>
<string relative="path" id="perlExtraPaths">lib:/home/mordy/src/Couchbase-Client/blib</string>
<boolean id="perl_lintOption_includeCurrentDirForLinter">1</boolean>
<string id="phpExtraPaths"></string>
+<preference-set id="testPlans">
+<preference-set id="New test plan #1">
+ <string id="command_line"></string>
+ <string relative="url" id="directory"></string>
+ <string id="language">Perl - TAP (*.t)</string>
+</preference-set>
+</preference-set>
</preference-set>
</project>
@@ -2,7 +2,7 @@ package Couchbase::Client;
BEGIN {
require XSLoader;
- our $VERSION = '0.16_0';
+ our $VERSION = '0.17_0';
XSLoader::load(__PACKAGE__, $VERSION);
}
@@ -1,7 +1,7 @@
package Couchbase::Client::Async;
use strict;
use warnings;
-our $VERSION = '0.16_0';
+our $VERSION = '0.17_0';
use Couchbase::Client;
use Couchbase::Client::IDXConst;
use Log::Fu;
@@ -89,7 +89,7 @@ sub T20_settings_connect :Test(no_plan)
ok(!$client->connect, "Failure to connect to nonexistent host");
my $errors = $client->get_errors;
ok(scalar @$errors, "Have error");
- is($errors->[0]->[0], COUCHBASE_NETWORK_ERROR, "Got NETWORK_ERROR");
+ is($errors->[0]->[0], COUCHBASE_CONNECT_ERROR, "Got CONNECT_ERROR");
$client = Couchbase::Client->new({
%{$self->common_options},
@@ -245,7 +245,10 @@ sub T24_timeout_settings :Test(no_plan)
sub T25_multi_server_list :Test(no_plan)
{
my $self = shift;
- my $server_list = ['localhost:0'];
+ # We can't use null for a port here because it might fail on GAI for
+ # SOCK_STREAM
+
+ my $server_list = ['localhost:1'];
my %options = %{$self->common_options};
my $bucket = $options{bucket};
my ($username,$password) = @options{qw(username password)};
@@ -259,10 +262,16 @@ sub T25_multi_server_list :Test(no_plan)
$cbo = Couchbase::Client->new({%options});
note "Connecting with bucket $bucket";
isa_ok($cbo, 'Couchbase::Client');
- is(scalar @{$cbo->get_errors}, 1, "have single error");
- is($cbo->get_errors->[0]->[0], COUCHBASE_NETWORK_ERROR,
+ ok(scalar @{$cbo->get_errors}, "have error(s)");
+ is($cbo->get_errors->[0]->[0], COUCHBASE_CONNECT_ERROR,
"Got network error for nonexistent host");
+ # If we have more than a single error, print them out (via dumper);
+ if(@{$cbo->get_errors()} > 1) {
+ diag "We really expected a single error. Extra info:";
+ diag Dumper($cbo->get_errors());
+ }
+
$ret = $cbo->set("foo", "fooval");
ok($ret->is_ok, "connected and can set value (retry ok)");
if(!$ret->is_ok){
Oops, something went wrong. Retry.

0 comments on commit c25036b

Please sign in to comment.