Skip Menu |

This queue is for tickets about the DBD-Pg CPAN distribution.

Report information
The Basics
Id: 45769
Status: resolved
Priority: 0/
Queue: DBD-Pg

People
Owner: greg [...] turnstep.com
Requestors: GAURAV [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: 2.13.1
Fixed in: 2.14.0



Subject: [patch] Makefile.PL temporarily ignores App::Info::RDBMS::PostgreSQL
Makefile.PL currently sets up $POSTGRES_INCLUDE (and, correspondingly, $POSTGRES_LIB) in the following order: 1. $ENV{POSTGRES_INCLUDE} 2. $ENV{POSTGRES_HOME} . '/include' 3. App::Info::RDBMS::PostgreSQL's 'inc_dir' method. I've simplified the code for this, in a way that makes this order clearer. Additionally, the code immediately after this section would display $ENV {POSTGRES_INCLUDE}, whether or not $ENV{POSTGRES_INCLUDE} was actually set. I've changed it to use $POSTGRES_INCLUDE instead. The rest of the Makefile.PL correctly uses $POSTGRES_INCLUDE, so this only affects Makefile.PL's output.
Subject: DBD-Pg-Makefile.PL.diff
Index: Makefile.PL =================================================================== --- Makefile.PL (revision 12746) +++ Makefile.PL (working copy) @@ -91,36 +91,48 @@ $defaultport = $conf =~ /with-pgport=(\d+)/ ? $1 : 5432; } -if ((!$ENV{POSTGRES_INCLUDE} or !$ENV{POSTGRES_LIB}) and !$ENV{POSTGRES_HOME}) { - $POSTGRES_INCLUDE = $pg->inc_dir; - $POSTGRES_LIB = $pg->lib_dir; -} elsif ((!$ENV{POSTGRES_INCLUDE} or !$ENV{POSTGRES_LIB}) and $ENV{POSTGRES_HOME}) { - $POSTGRES_INCLUDE = "$ENV{POSTGRES_HOME}/include"; - $POSTGRES_LIB = "$ENV{POSTGRES_HOME}/lib"; -} else { - $POSTGRES_INCLUDE = "$ENV{POSTGRES_INCLUDE}"; - $POSTGRES_LIB = "$ENV{POSTGRES_LIB}"; +# Set up $POSTGRES_INCLUDE and $POSTGRES_LIB from either the +# %ENVironment or App::Info::RDBMS::PostgreSQL. +$POSTGRES_INCLUDE = $ENV{POSTGRES_INCLUDE}; +$POSTGRES_INCLUDE = $pg->inc_dir unless defined $POSTGRES_INCLUDE; + +$POSTGRES_LIB = $ENV{POSTGRES_LIB}; +$POSTGRES_LIB = $pg->lib_dir unless defined $POSTGRES_LIB; + +if(exists $ENV{POSTGRES_HOME}) { + $POSTGRES_INCLUDE = $ENV{POSTGRES_HOME} . '/include' + unless defined $POSTGRES_INCLUDE; + + $POSTGRES_LIB = $ENV{POSTGRES_LIB} . '/lib' + unless defined $POSTGRES_LIB; } my $os = $^O; print "PostgreSQL version: $serverversion (default port: $defaultport)\n"; -my $showhome = $ENV{POSTGRES_HOME} || '(not set)'; +my $showhome = $ENV{'POSTGRES_HOME'} || '(not set)'; print "POSTGRES_HOME: $showhome\n"; -my $showinc = $ENV{POSTGRES_INCLUDE} || '(not set)'; +my $showinc = $POSTGRES_INCLUDE || '(not set)'; print "POSTGRES_INCLUDE: $showinc\n"; -my $showlib = $ENV{POSTGRES_LIB} || '(not set)'; +my $showlib = $POSTGRES_LIB || '(not set)'; print "POSTGRES_LIB: $showlib\n"; print "OS: $os\n"; my $baddir; -for my $d (qw/HOME INCLUDE/) { - next if ! exists $ENV{"POSTGRES_$d"} or ! length $ENV{"POSTGRES_$d"}; - if (! -d $ENV{"POSTGRES_$d"}) { + +sub does_path_exist { + my ($path_name, $path) = @_; + + return if ! defined $path or ! length $path; + if (! -d $path) { printf "The environment variable %s points to a non-existent directory: %s\n", - "POSTGRES_$d", $ENV{"POSTGRES_$d"}; + $path_name, $path; $baddir++; } } + +does_path_exist("POSTGRES_HOME", $ENV{'POSTGRES_HOME'}); +does_path_exist("POSTGRES_LIB", $POSTGRES_LIB); + if ($baddir) { print "Cannot build unless the directories exist, exiting.\n"; exit 0;
Thanks, applied a slightly modified version in r12760.