Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 578402 - dev-db/oracle-instantclient - DEPENDing ebuilds need a way to get ORACLE_HOME without depending on user calling env-update
Summary: dev-db/oracle-instantclient - DEPENDing ebuilds need a way to get ORACLE_HOME...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Michael Haubenwallner (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-27 20:01 UTC by Thomas Deutschmann (RETIRED)
Modified: 2018-10-19 16:29 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 Thomas Deutschmann (RETIRED) gentoo-dev 2016-03-27 20:01:00 UTC
Today I run into the following problem:

I updated "world" and emerge wanted to migrate away from dev-db/oracle-instantclient-basic to dev-db/oracle-instantclient and reinstall app-admin/collectd[-collectd_plugins_notify_oracle] due to changed USE flags.

app-admin/collectd failed because it was unable to find "oci.h".

The problem was, that ORACLE_HOME was set but set to the previous version (v11.2.0.4) which was now updated (v12.1.0.2).

To fix the problem I had to call `env-update && source /etc/profile`.

You have the same problem on a vanilla system without dev-db/oracle-instantclient when installing an ebuild which DEPEND on dev-db/oracle-instantclient. That emerge run will always fail until the user manually updates his/her environment after installing dev-db/oracle-instantclient (like the elog will tell).

After discussing on IRC if I can do something in the depending ebuild for a better user experience (took me some time to notice that "oci.h" couldn't be found due to old path still set in terminal running emerge) I was told that dev-db/oracle-instantclient is doing it wrong and/or can do it better.

Idea:
This is the same situation we have with JAVA (JAVA_HOME).

What about having an eclass "oracle-pkg" which will do something like

> set_oracle_env() {
> 	debug-print-function ${FUNCNAME} $*
> 
> 	local oracle_home=
> 	local env_files="${ED}/etc/env.d/50oracle-instantclient ${ED}/etc/env.d/99oracle-instantclient"
> 	for env_file in ${env_files}; do
> 		if [ -f "${env_file}" ]; then
> 			local oracle_home_temp=$(source "${env_file}"; echo ${ORACLE_HOME})
> 			if [ -n "${oracle_home_temp}" ]; then
> 				debug-print "Found ORACLE_HOME \"${oracle_home_temp}\" in \"${env_file}\""
> 				oracle_home=${oracle_home_temp}
> 			fi
> 		else
> 			debug-print "WARNING: \"${env_file}\" does not exist! Skipping ..."
> 		fi
> 	done
> 
> 	if [ -n "${oracle_home}" ]; then
> 		debug-print "Setting ORACLE_HOME to \"${oracle_home}\" ..."
> 		export ORACLE_HOME=${oracle_home}
> 	else
> 		debug-print "WARNING: Could not determine ORACLE_HOME. You probably have not installed dev-db/oracle-instantclient!"
> 	fi
> }

Basically you would provide something like the "java-pkg-opt-2" eclass.
Comment 1 Michael Haubenwallner (RETIRED) gentoo-dev 2016-04-13 09:27:10 UTC
The value of the ORACLE_HOME environment variable probably should not contain any instantclient version number at all, but name some symlink instead - much like JAVA_HOME indeed.
Comment 2 Larry the Git Cow gentoo-dev 2018-10-19 16:29:01 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5a8db975b241e26c2cfcc52728829b74bfc2e166

commit 5a8db975b241e26c2cfcc52728829b74bfc2e166
Author:     Michael Haubenwallner <haubi@gentoo.org>
AuthorDate: 2018-10-19 15:43:13 +0000
Commit:     Michael Haubenwallner <haubi@gentoo.org>
CommitDate: 2018-10-19 16:25:24 +0000

    dev-db/oracle-instantclient: revbump
    
    Closes: https://bugs.gentoo.org/578402
    Closes: https://bugs.gentoo.org/597520
    Closes: https://bugs.gentoo.org/652096
    Package-Manager: Portage-2.3.49, Repoman-2.3.10
    Signed-off-by: Michael Haubenwallner <haubi@gentoo.org>

 dev-db/oracle-instantclient/Manifest               |  14 +
 .../files/18.3.0.0-makefile.patch                  |  40 +++
 dev-db/oracle-instantclient/metadata.xml           |  11 +-
 .../oracle-instantclient-18.3.0.0.ebuild           | 342 +++++++++++++++++++++
 4 files changed, 402 insertions(+), 5 deletions(-)