From nobody@FreeBSD.org  Tue Jan 30 19:49:08 2007
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52])
	by hub.freebsd.org (Postfix) with ESMTP id EC0BD16A409
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Jan 2007 19:49:08 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [69.147.83.33])
	by mx1.freebsd.org (Postfix) with ESMTP id C566C13C4A8
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Jan 2007 19:49:08 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id l0UJn8GN017921
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 30 Jan 2007 19:49:08 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id l0UJn89G017920;
	Tue, 30 Jan 2007 19:49:08 GMT
	(envelope-from nobody)
Message-Id: <200701301949.l0UJn89G017920@www.freebsd.org>
Date: Tue, 30 Jan 2007 19:49:08 GMT
From: Andrew Hammond<andrew.george.hammond@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: databases/postgresql82-server fails when PREFIX is set
X-Send-Pr-Version: www-3.0

>Number:         108570
>Category:       ports
>Synopsis:       databases/postgresql82-server fails when PREFIX is set
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    girgen
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jan 30 19:50:14 GMT 2007
>Closed-Date:    Fri Mar 18 10:24:12 UTC 2011
>Last-Modified:  Fri Mar 18 10:24:12 UTC 2011
>Originator:     Andrew Hammond
>Release:        6.2 on amd64, cvsup'd ports to lastest as of 2007-01-29
>Organization:
AdECN Ltd.
>Environment:
FreeBSD ahammond.ecoffice.experclick.com 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12 08:43:30 UTC 2007     root@portnoy.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP  amd64
>Description:
I'm attempting to support multiple versions of the PostgreSQL database on a single box. In order to do this, I'd like to use the PREFIX feature to install binary builds into /usr/local/pgsql<version> subdirs. After setting the PREFIX, make install fails. I tried to attach a typescript of this, but... that didn't fly too well. Here's the tail end of the typescript.

gmake[1]: Leaving directory `/usr/ports/databases/postgresql82-server/work/postgresql-8.2.1/src/pl/plpgsql'
install  -o root -g wheel -m 444 /usr/ports/databases/postgresql82-server/work/dot.profile /usr/local/pgsql821_sl126_amd64_fbsd62/share/postgresql/dot.profile.dist;  install  -o root -g wheel -m 444 -o pgsql -g pgsql /usr/ports/databases/postgresql82-server/work/dot.profile ~pgsql/dot.profile.dist ;  if [ ! -f ~pgsql/.profile ]; then  /bin/cp -p ~pgsql/dot.profile.dist ~pgsql/.profile;  fi
install: /usr/local/pgsql/dot.profile.dist: No such file or directory
*** Error code 71

Stop in /usr/ports/databases/postgresql82-server.
ahammond# pwd
/usr/ports/databases/postgresql82-server
ahammond# exit
exit

Script done on Tue Jan 30 13:17:01 2007

I think this exposes a deeper problem. The current PostgreSQL packaging scripts assume that there is a 1:1 relationship between the box and the PostgreSQL binary, as well as a 1:1 relationship between the binary and the number of back-ends (PGDATA directories) it is running. This is the case in the majority of instances; a single server has a single binary to support a single back-end process, almost certainly on the default port.

Bug ports/104075 documents another symptom of this same problem.

However, in environments where availability or scalability are key goals, it is often the case that a single box will have more than one version of the PostgreSQL binary, and that these binaries may be supporting more than one PostgreSQL back-end (PGDATA/port).
>How-To-Repeat:
cd /usr/ports/databases/postgresql82-server;
PREFIX=/usr/local/pgsql821 sudo make install
>Fix:
The debian packages support this level of flexibility for example.
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-ports-bugs->girgen 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Tue Jan 30 19:50:24 UTC 2007 
Responsible-Changed-Why:  
Over to maintainer 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108570 

From: Palle Girgensohn <girgen@FreeBSD.org>
To: bug-followup@FreeBSD.org, andrew.george.hammond@gmail.com
Cc: "Marc G. Fournier" <scrappy@FreeBSD.org>
Subject: Re: ports/108570: databases/postgresql82-server fails when PREFIX
 is set
Date: Wed, 31 Jan 2007 16:38:00 +0100

 Hello Andrew, (Cc: Marc, due to earlier email)
 
 Interesting thing you're trying to accomplish. I have to check how debian 
 solves this. The example you are supplying is really only that the user 
 pgsql's home directory does not exist. The port makes the assumption that 
 if there is a pgsql user created already, it will use that userid for the 
 installation. This seems to fail in some way with your example.
 
 I think you also need a postgresqlNN-client in each install PREFIX subdir.
 
 What happens if you remove the pgsql user (or modify its home directory) 
 before each build/install?
 
 Palle
 

From: "Andrew Hammond" <andrew.george.hammond@gmail.com>
To: "Palle Girgensohn" <girgen@freebsd.org>
Cc: bug-followup@freebsd.org, "Marc G. Fournier" <scrappy@freebsd.org>
Subject: Re: ports/108570: databases/postgresql82-server fails when PREFIX is set
Date: Thu, 1 Feb 2007 18:07:18 -0800

 On 1/31/07, Palle Girgensohn <girgen@freebsd.org> wrote:
 > Hello Andrew, (Cc: Marc, due to earlier email)
 >
 > Interesting thing you're trying to accomplish. I have to check how debian
 > solves this.
 
 I think the interesting script is called pg_ctlcluster in the
 postgresql-common package. I'm actually pretty impressed with how they
 do that stuff.
 
 Currently the packages seem to create a boatload of dependencies that
 get in the way of installing other bins. I'm thinking about how to
 work around this. I suspect I'll end up hacking the packages to make
 them all use a PREFIX and not conflict with each-other.
 
 > The example you are supplying is really only that the user
 > pgsql's home directory does not exist. The port makes the assumption that
 > if there is a pgsql user created already, it will use that userid for the
 > installation. This seems to fail in some way with your example.
 >
 > I think you also need a postgresqlNN-client in each install PREFIX subdir.
 >
 > What happens if you remove the pgsql user (or modify its home directory)
 > before each build/install?
 
 I tried the following
 1) use vipw to alter pgsql user's home dir to /usr/local/pgsql821
 2) mkdir /usr/local/pgsql821; chown pgsql pgsql821
 3) cd /usr/ports/databases/postgresql82-server
 4) PREFIX=/usr/local/pgsql821 make install
 
 And it appears to have worked, perfectly! However attempting to
 install the -client package blew everything up. Same with slony1 and
 the PLs.
State-Changed-From-To: open->closed 
State-Changed-By: miwi 
State-Changed-When: Fri Mar 18 10:24:11 UTC 2011 
State-Changed-Why:  
this port goes soon 

http://www.freebsd.org/cgi/query-pr.cgi?pr=108570 
>Unformatted:
