Bug 1127346

Summary: Need ability to add custom directories to find_jar search path for SCLs
Product: Red Hat Enterprise Linux 6 Reporter: Alex Wood <awood>
Component: jpackage-utilsAssignee: Mikolaj Izdebski <mizdebsk>
Status: CLOSED NEXTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.6Keywords: FutureFeature
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-11 10:22:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Alex Wood 2014-08-06 17:18:57 UTC
Description of problem:

Currently, you cannot use build-jar-repository to link in JAR files located in SCLs.  The build-jar-repository script ultimately depends on the do_find_jar function in java-functions.  The do_find_jar function only looks through  $JVM_LIBDIR $JAVAVER_JNIDIR $JAVAVER_LIBDIR $JAVAAPP_LIBDIR $JNI_LIBDIR and $JAVA_LIBDIR.  Those directories can be override in a java.conf file but it would result in the loss of the original value.

It would be better if one could specify a JAVA_CUSTOM_LIBDIR value in a java.conf file that is a colon delimited list of other directories to search through.

This problem also exists in RHEL 7's javapackages-tools although the version in RHEL 7 is a bit more flexible.  In the RHEL 7 version you can set _javadirs in java.conf to a comma delimited list but it depends on an implementation detail to work.

Alternatively the script could implement internal logic to examine SCLs but I feel like that would be much more complicated to implement.

How reproducible: Always

Steps to Reproduce:
1. Enable SCLs
2. yum install mongodb24-mongo-java-driver
3. build-jar-repository mongo

Actual results: Script fails to find mongo.jar located under /opt/rh/mongodb24/root/usr/share/java

Expected results: Script succeeds at finding the JAR after user sets JAVA_CUSTOM_LIBDIR in ~/.java/java.conf


Additional info:

Comment 2 Mikolaj Izdebski 2014-08-07 13:27:06 UTC
Alex, you have to enable software collection before using it. Does the following command work for you?

scl enable mongodb24 -- build-jar-repository mongo

Comment 3 Alex Wood 2014-08-07 19:43:40 UTC
(In reply to Mikolaj Izdebski from comment #2)
> Alex, you have to enable software collection before using it. Does the
> following command work for you?
> 
> scl enable mongodb24 -- build-jar-repository mongo

Yes, that does work in RHEL 7, but not in RHEL 6 (or at least not in my RHEL 6 Docker container).  I'll try in a VM just to make sure.

# ls /opt/rh/mongodb24/root/usr/share/java 
bson.jar  mongo.jar
[root@bab7086720c6:~] 
# scl enable mongodb24 -- build-jar-repository /tmp bson
/usr/bin/build-jar-repository: error: Could not find bson Java extension for this JVM
/usr/bin/build-jar-repository: error: Some specified jars were not found for this jvm

Comment 4 Alex Wood 2014-08-08 15:05:07 UTC
I checked in a VM and in a Mock chroot and the scl enable did not work in either place for RHEL 6.

% mock -r candlepin-1-rhel-6-x86_64 --shell
INFO: mock.py version 1.1.41 starting...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
Start: lock buildroot
Start: device setup
Finish: device setup
Start: shell
<mock-chroot>[root@arkham /]# scl enable mongodb24 -- build-jar-repository /tmp mongo
Can't read /etc/scl/prefixes/v8314, v8314 is probably not installed.
/usr/bin/build-jar-repository: error: Could not find mongo Java extension for this JVM
/usr/bin/build-jar-repository: error: Some specified jars were not found for this jvm
<mock-chroot>[root@arkham /]# ls /opt/rh/
candlepin-scl/ mongodb24/     
[root@arkham /]# ls /opt/rh/mongodb24/root/usr/share/java
bson.jar  mongo.jar

Comment 5 Mikolaj Izdebski 2014-08-11 10:22:21 UTC
For Java SCLs specifically: JAR file resolution from each collection should work after enabling that collection, as shown above. If it doesn't then you can report a bug against that particular collection.

In general feature(*) which allows customizing JAR search paths has been added in javapackages-tools in RHEL 7 and it is not planned for RHEL 6. I am closing this bug as NEXTRELEASE. If you need this feature included in RHEL 6 you can request that by contacting your support representative.

(*) The feature mentioned above can be used by setting and exporting JAVACONFDIRS environmental variable to a colon-separated list of directories containing java.conf files. Each of the conf files can define different directories where JAR files should be searched for. This feature is used by Java SCLs, which install their own java.conf and set JAVACONFDIRS accordingly in their enable scripts.