Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 273960 - dev-db/postgis-1.3.6 reads PG_USER & PGDATABASE when installed and not when configured
Summary: dev-db/postgis-1.3.6 reads PG_USER & PGDATABASE when installed and not when c...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Sci-geo Project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-13 08:43 UTC by redneb
Modified: 2011-05-01 17:39 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description redneb 2009-06-13 08:43:41 UTC
When the user issues a
  emerge --config postgis
then the ebuild will use the values that PG_USER & PGDATABASE had when the package was originally installed and not the current ones. So if you do the following
  PGDATABASE=db1 emerge postgis
  PGDATABASE=db2 emerge --config postgis
then in the configuration stage, it will try to connect to the database db1 and not to db2. So if the user has many postgis-enabled databases (say db1, db2 and db3) then the following will not upgrade them:
  PGDATABASE=db1 emerge --config postgis
  PGDATABASE=db2 emerge --config postgis
  PGDATABASE=db3 emerge --config postgis
I think it would be really useful if the above would work.

Reproducible: Always

Steps to Reproduce:
Comment 1 FENOY Gérald (RETIRED) gentoo-dev 2009-06-13 11:47:40 UTC
You're right, it should work like this.

As I always use the ebuild command to config postgis, there is no need to copy the environment tarball used when emerging the ebuild.

So using this commands should work :

rm /var/tmp/portage/dev-db/postgis-1.3.6/temp/environment
for i in db1 db2 ; do 
  PGDATABASE=${i} ebuild /usr/portage/dev-db/postgis/postgis-1.3.6.ebuild config;
done

When we use the emerge --config command, then the environment tarball stored in /var/db/pkg/${CATEGORY}/${P}/environment.bz2 will be unpacked in /var/tmp/portage/${CATEGORY}/${P}/temp/environment. Then pkg_config will use this environment file to load your variables into its environment. So we have to find a way to force overloading of the evironment variables defined in this file. One way could be to use a specific variable which is for sure not set in your environment variables, but we can't ensure that the variable wasn't defined in your environment. By the way, the environment variables defined localy won't be used from pkg_config. 

I will invetigate more to find a solution, if there is any, to make emerge --config using localy defined evironment variables but realy unsure to be able to do something like that.
Comment 2 redneb 2009-06-13 13:19:47 UTC
How about moving the pkg_config function from the ebuild into a separate helper script that will be installed along with postgis?
Comment 3 FENOY Gérald (RETIRED) gentoo-dev 2009-06-13 14:50:00 UTC
I think it could be a good idea. Nevertheless, imho the ebuild should be responsible to upgrade your databases.

I'm currently creating a new ebuild using a conf.d file called postgis_dbs which includes on each line a database name to be updated by the emerge --config process. This way users only have to add their spatialy enabled databases in this file to be able to update them when they do the emerge --config part.

Note that this conf.d file should be created automaticaly if needed.
Comment 4 Tupone Alfredo gentoo-dev 2009-06-14 18:51:12 UTC
I heard that if set the variables in /etc/portage/bashrc they will be taken into account.
Please test
Comment 5 Aaron W. Swenson gentoo-dev 2011-05-01 17:39:35 UTC
  01 May 2011; Aaron W. Swenson <titanofold@gentoo.org>
  +postgis-1.5.2-r1.ebuild, +files/postgis_dbs, metadata.xml:
  Fixes bug 273960, 285082, 296172, 314243, 325113 and 339312