Обсуждение: pg_config/share_dir

Поиск
Список
Период
Сортировка

pg_config/share_dir

От
Andrew Dunstan
Дата:
pg_config doesn't currently seem to have an option to report the 
share_dir. Should it?

cheers

andrew


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Andrew Dunstan wrote:
> pg_config doesn't currently seem to have an option to report the
> share_dir. Should it?

Is there a case where a user would need anything from there?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Andrew Dunstan
Дата:

Peter Eisentraut wrote:

>Andrew Dunstan wrote:
>  
>
>>pg_config doesn't currently seem to have an option to report the
>>share_dir. Should it?
>>    
>>
>
>Is there a case where a user would need anything from there?
>
>  
>

Why would they need pkglibdir either? I was asked about this by an 
author who wanted to use it to find where to put module config/setup 
scripts.

cheers

andrew


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Andrew Dunstan wrote:
> Why would they need pkglibdir either?

To determine what $libdir resolves to.

> I was asked about this by an 
> author who wanted to use it to find where to put module config/setup
> scripts.

Probably not in PostgreSQL's data directory, but his own.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Darcy Buskermolen
Дата:
On Wednesday 07 September 2005 15:52, Andrew Dunstan wrote:
> Peter Eisentraut wrote:
> >Andrew Dunstan wrote:
> >>pg_config doesn't currently seem to have an option to report the
> >>share_dir. Should it?
> >
> >Is there a case where a user would need anything from there?

the way wo do this in slony is with the following macro:

AC_MSG_CHECKING(for postgresql.conf.sample)
PGSHARE_POSSIBLE_LOCATIONS="${with_pgsharedir} /usr/local/pgsql/share /usr/local/share/postgresql /usr/share/postgresql
/usr/local/share/pgsql/usr/share/pgsql /opt/local/pgsql/share /opt/pgsql/share 
 
${PG_BINDIR}/../share
for i in $PGSHARE_POSSIBLE_LOCATIONS; do   if test -s "$i/postgresql.conf.sample" ; then       PG_SHAREDIR=$i/
break;  fi
 
done

if test -n "$PG_SHAREDIR" ; then   AC_MSG_RESULT(${PG_SHAREDIR}postgresql.conf.sample)
AC_DEFINE(PG_SHAREDIR_VERIFIED,1,[PostgreSQLsharedir])
 
else   AC_MSG_RESULT(not found)   AC_MSG_ERROR(       postgresql.conf.sample not found! Please specify the sharedir
 with --with-pgsharedir=<dir>       )
 
fi


(where ${PG_BINDIR} is the result of: pg_config --bindir )

>
> Why would they need pkglibdir either? I was asked about this by an
> author who wanted to use it to find where to put module config/setup
> scripts.
>
> cheers
>
> andrew
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

-- 
Darcy Buskermolen
Wavefire Technologies Corp.

http://www.wavefire.com
ph: 250.717.0200
fx: 250.763.1759


Re: pg_config/share_dir

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> Andrew Dunstan wrote:
>> pg_config doesn't currently seem to have an option to report the
>> share_dir. Should it?

> Is there a case where a user would need anything from there?

pg_config serves a function of recording the configuration, so I tend
to agree with Andrew that this should be available.  I notice that
SYSCONFDIR, PKGINCLUDEDIR, and LOCALEDIR aren't available either.
        regards, tom lane


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Tom Lane wrote:
> pg_config serves a function of recording the configuration,

pg_config was meant (as opposed to "serves") to provide information that 
is of use for building third-party things.  Hence includedir, libdir 
for building, pkglibdir for installing.  The option --configure records 
the configuration, if you like, but I don't see the point of giving 
users direct access to directories that they have no use for.  I mean, 
what would anyone want to do with pg_config --localedir?  Certainly not 
store the locale files of his own module there.  There is a point to be 
made that sysconfdir should be exposed, perhaps for the benefit of GUI 
configuration editors, but that seems theoretical to me.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Andrew Dunstan
Дата:

Darcy Buskermolen wrote:

>On Wednesday 07 September 2005 15:52, Andrew Dunstan wrote:
>  
>
>>Peter Eisentraut wrote:
>>    
>>
>>>Andrew Dunstan wrote:
>>>      
>>>
>>>>pg_config doesn't currently seem to have an option to report the
>>>>share_dir. Should it?
>>>>        
>>>>
>>>Is there a case where a user would need anything from there?
>>>      
>>>
>
>the way wo do this in slony is with the following macro:
>
>AC_MSG_CHECKING(for postgresql.conf.sample)
>PGSHARE_POSSIBLE_LOCATIONS="${with_pgsharedir} /usr/local/pgsql/share /usr/local/share/postgresql
/usr/share/postgresql/usr/local/share/pgsql /usr/share/pgsql /opt/local/pgsql/share /opt/pgsql/share 
 
>${PG_BINDIR}/../share
>for i in $PGSHARE_POSSIBLE_LOCATIONS; do
>    if test -s "$i/postgresql.conf.sample" ; then
>        PG_SHAREDIR=$i/
>        break;
>    fi
>done
>
>if test -n "$PG_SHAREDIR" ; then
>    AC_MSG_RESULT(${PG_SHAREDIR}postgresql.conf.sample)
>    AC_DEFINE(PG_SHAREDIR_VERIFIED,1,[PostgreSQL sharedir])
>else
>    AC_MSG_RESULT(not found)
>    AC_MSG_ERROR(
>        postgresql.conf.sample not found! Please specify the sharedir
>        with --with-pgsharedir=<dir>
>        )
>fi
>
>
>(where ${PG_BINDIR} is the result of: pg_config --bindir )
>
>  
>

That's foul, and looks horribly fragile too. You have just provided what 
seems to me a perfect use case.

cheers

andrew


Re: pg_config/share_dir

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> what would anyone want to do with pg_config --localedir?  Certainly not 
> store the locale files of his own module there.

I'm wondering why localedir is even treated as an independently settable
directory in the first place.  Why doesn't the code just use PGSHAREDIR
and plaster on a hardwired "/locale"?

> There is a point to be made that sysconfdir should be exposed, perhaps
> for the benefit of GUI configuration editors, but that seems
> theoretical to me.

Certainly we make only minimal use of sysconfdir at present.  But we
have the infrastructure for it in configure, path.c, etc, and it seems
to me that pg_config support should be considered part of that
infrastructure.  If it's not important enough to be in pg_config, why
is it a separate option at all?
        regards, tom lane


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Tom Lane wrote:
> I'm wondering why localedir is even treated as an independently
> settable directory in the first place.  Why doesn't the code just use
> PGSHAREDIR and plaster on a hardwired "/locale"?

You can't really set localedir independently; it's hardwired to 
$prefix/share/locale (see config/program.m4 for details).  The reason 
that it's dealt with separately from $datadir ($prefix/share) is to 
arrive at a conventional layout when prefix=/usr (or /usr/local etc.).  
datadir would then be /usr/share/postgresql and localedir would 
be /usr/share/locale.  This is just the way most software arranges 
these things.  Earlier versions of gettext (or non-GNU versions of 
gettext?) also had a hard-coded path where it looked for the locale 
data, which sort of lead to the convention that the locale files have 
to be in that particular directory.

> Certainly we make only minimal use of sysconfdir at present.  But we
> have the infrastructure for it in configure, path.c, etc, and it
> seems to me that pg_config support should be considered part of that
> infrastructure.  If it's not important enough to be in pg_config, why
> is it a separate option at all?

I'd say that the nonexposure of sysconfdir is an oversight.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Why do you need access to postgresql.conf.sample?

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Darcy Buskermolen
Дата:
On Wednesday 07 September 2005 18:44, Peter Eisentraut wrote:
> Why do you need access to postgresql.conf.sample?

We don't need access to that file, but install some sql files into the share 
dir,  the test for postgresql.conf.sample is there just to see if the dir 
looks like a likely candidate to be the dir we are infact after..

-- 
Darcy Buskermolen
Wavefire Technologies Corp.

http://www.wavefire.com
ph: 250.717.0200
fx: 250.763.1759


Re: pg_config/share_dir

От
Darcy Buskermolen
Дата:
On Wednesday 07 September 2005 17:31, Andrew Dunstan wrote:
> Darcy Buskermolen wrote:
> >On Wednesday 07 September 2005 15:52, Andrew Dunstan wrote:
> >>Peter Eisentraut wrote:
> >>>Andrew Dunstan wrote:
> >>>>pg_config doesn't currently seem to have an option to report the
> >>>>share_dir. Should it?
> >>>
> >>>Is there a case where a user would need anything from there?
> >
> >the way wo do this in slony is with the following macro:
> >
> >AC_MSG_CHECKING(for postgresql.conf.sample)
> >PGSHARE_POSSIBLE_LOCATIONS="${with_pgsharedir} /usr/local/pgsql/share
> > /usr/local/share/postgresql /usr/share/postgresql /usr/local/share/pgsql
> > /usr/share/pgsql /opt/local/pgsql/share /opt/pgsql/share
> > ${PG_BINDIR}/../share
> >for i in $PGSHARE_POSSIBLE_LOCATIONS; do
> >    if test -s "$i/postgresql.conf.sample" ; then
> >        PG_SHAREDIR=$i/
> >        break;
> >    fi
> >done
> >
> >if test -n "$PG_SHAREDIR" ; then
> >    AC_MSG_RESULT(${PG_SHAREDIR}postgresql.conf.sample)
> >    AC_DEFINE(PG_SHAREDIR_VERIFIED,1,[PostgreSQL sharedir])
> >else
> >    AC_MSG_RESULT(not found)
> >    AC_MSG_ERROR(
> >        postgresql.conf.sample not found! Please specify the sharedir
> >        with --with-pgsharedir=<dir>
> >        )
> >fi
> >
> >
> >(where ${PG_BINDIR} is the result of: pg_config --bindir )
>
> That's foul, and looks horribly fragile too. You have just provided what
> seems to me a perfect use case.

Yes it is foul :-) but it's the best we could do given the tools we had to 
work with.....  which is precisely why we provide the failover to 
-with-pgsharedir=<dir> incase the system can't get it right.

>
> cheers
>
> andrew
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

-- 
Darcy Buskermolen
Wavefire Technologies Corp.

http://www.wavefire.com
ph: 250.717.0200
fx: 250.763.1759


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Darcy Buskermolen wrote:
> We don't need access to that file, but install some sql files into
> the share dir,  the test for postgresql.conf.sample is there just to
> see if the dir looks like a likely candidate to be the dir we are
> infact after..

Then my response is that Slony has absolutely no business installing its 
files into one of PostgreSQL's private directories.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Andrew Dunstan
Дата:

Peter Eisentraut wrote:

>Darcy Buskermolen wrote:
>  
>
>>We don't need access to that file, but install some sql files into
>>the share dir,  the test for postgresql.conf.sample is there just to
>>see if the dir looks like a likely candidate to be the dir we are
>>infact after..
>>    
>>
>
>Then my response is that Slony has absolutely no business installing its 
>files into one of PostgreSQL's private directories.
>  
>

Why be so prescriptive? pgxs already exposes <share_dir>/contrib as an 
install target via DATA and DATA_built. Arguably, other modules would be 
playing nicer if they put their private stuff in some other private 
<share_dir>/subdirectory rather than under contrib.

cheers

andrew


Re: pg_config/share_dir

От
Peter Eisentraut
Дата:
Andrew Dunstan wrote:
> Why be so prescriptive?

We're not prescribing anything.  You can install your stuff anywhere you 
want to, but we're certainly not going to encourage or facilitate that 
other software installs files in directories that belong to PostgreSQL, 
except where this is specifically intended (e.g., $libdir).

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/


Re: pg_config/share_dir

От
Bruce Momjian
Дата:
Added to TODO:
* Add options to pg_config to show the share_dir, sysconfdir,  pkgincludedir, and localedir


---------------------------------------------------------------------------

Tom Lane wrote:
> Peter Eisentraut <peter_e@gmx.net> writes:
> > Andrew Dunstan wrote:
> >> pg_config doesn't currently seem to have an option to report the
> >> share_dir. Should it?
> 
> > Is there a case where a user would need anything from there?
> 
> pg_config serves a function of recording the configuration, so I tend
> to agree with Andrew that this should be available.  I notice that
> SYSCONFDIR, PKGINCLUDEDIR, and LOCALEDIR aren't available either.
> 
>             regards, tom lane
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>        choose an index scan if your joining column's datatypes do not
>        match
> 

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
359-1001+  If your life is a hard drive,     |  13 Roberts Road +  Christ can be your backup.        |  Newtown Square,
Pennsylvania19073
 


Re: pg_config/share_dir

От
Tom Lane
Дата:
"Jim C. Nasby" <jnasby@pervasive.com> writes:
>> * Add options to pg_config to show the share_dir, sysconfdir,
>> pkgincludedir, and localedir

> Should that be marked as a beginner TODO?

It could, but I think it's going to get DONE in the next few days as
a necessary step in fixing the pgxs relocatability issue.  So if any
beginners want to do it, they should step right up.
        regards, tom lane


Re: pg_config/share_dir

От
"Jim C. Nasby"
Дата:
Should that be marked as a beginner TODO?
On Thu, Sep 22, 2005 at 11:04:23PM -0400, Bruce Momjian wrote:
> 
> Added to TODO:
> 
>     * Add options to pg_config to show the share_dir, sysconfdir,
>       pkgincludedir, and localedir
> 
> 
> ---------------------------------------------------------------------------
> 
> Tom Lane wrote:
> > Peter Eisentraut <peter_e@gmx.net> writes:
> > > Andrew Dunstan wrote:
> > >> pg_config doesn't currently seem to have an option to report the
> > >> share_dir. Should it?
> > 
> > > Is there a case where a user would need anything from there?
> > 
> > pg_config serves a function of recording the configuration, so I tend
> > to agree with Andrew that this should be available.  I notice that
> > SYSCONFDIR, PKGINCLUDEDIR, and LOCALEDIR aren't available either.
> > 
> >             regards, tom lane
> > 
> > ---------------------------(end of broadcast)---------------------------
> > TIP 9: In versions below 8.0, the planner will ignore your desire to
> >        choose an index scan if your joining column's datatypes do not
> >        match
> > 
> 
> -- 
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 359-1001
>   +  If your life is a hard drive,     |  13 Roberts Road
>   +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>        subscribe-nomail command to majordomo@postgresql.org so that your
>        message can get through to the mailing list cleanly
> 

-- 
Jim C. Nasby, Sr. Engineering Consultant      jnasby@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461