Create an independent directory to place jar libraries

Previously we place all lib files under /usr/local/lib/storlets, but
this makes it more difficult to have lang specific files there.

This patch creates java directory where we place jar files, so that
we can place libraries for other languages like python in the future.

Change-Id: Id384c72ab6e658c55312ad62499dfc2100ba3ca3
This commit is contained in:
Takashi Kajinami 2019-07-20 23:13:51 +09:00
parent e6f7869974
commit d0194f66b2
7 changed files with 30 additions and 23 deletions

View File

@ -4,6 +4,7 @@
#
# NOTE: The libraries are currently installed under /usr/lib/storlets
# so you may need root privilege to execute this script
set -x
# build scripts
cd scripts

View File

@ -15,7 +15,7 @@
-->
<project>
<property name="jarname" value="SBusJavaFacade.jar"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

View File

@ -18,7 +18,7 @@
<project>
<property name="jarname" value="SCommon.jar"/>
<property environment="env"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

View File

@ -16,7 +16,7 @@
<project>
<property name="jarname" value="SDaemon.jar"/>
<property name="libdir" value="/usr/local/lib/storlets"/>
<property name="libdir" value="/usr/local/lib/storlets/java"/>
<target name="clean">
<delete dir="bin" />

View File

@ -37,7 +37,7 @@
</target>
<!-- Install build Dependencies-->
<target name="install_dependencies" depends="dependencies">
<copy todir="/usr/local/lib/storlets">
<copy todir="/usr/local/lib/storlets/java">
<fileset dir="dependencies" />
</copy>
</target>

View File

@ -69,7 +69,8 @@ class StorletDaemonFactory(SBusServer):
:returns: (A list of the JVM arguments, A list of environ parameters)
"""
str_prfx = "/usr/local/lib/storlets"
lib_dir = "/usr/local/lib/storlets"
java_lib_dir = os.path.join(lib_dir, "java")
jar_deps = ['logback-classic-1.1.2.jar',
'logback-core-1.1.2.jar',
@ -79,9 +80,9 @@ class StorletDaemonFactory(SBusServer):
'SCommon.jar',
'SDaemon.jar',
'']
jar_deps = [os.path.join(str_prfx, x) for x in jar_deps]
str_dmn_clspth = ':'.join(jar_deps) + ':' + storlet_path
str_library_path = str_prfx
jar_deps = [os.path.join(java_lib_dir, x) for x in jar_deps]
str_dmn_clspth = ':'.join(jar_deps + [storlet_path])
str_library_path = ':'.join([lib_dir, java_lib_dir])
str_daemon_main_class = "org.openstack.storlet.daemon.SDaemon"

View File

@ -57,22 +57,27 @@ class TestStorletDaemonFactory(unittest.TestCase):
'Storlet-1.0.jar', 'path/to/uds/a', 'DEBUG', '1',
self.container_id],
pargs)
self.assertIn('CLASSPATH', env)
self.assertEqual(
{'CLASSPATH':
'/default/classpath:'
'/usr/local/lib/storlets/logback-classic-1.1.2.jar:'
'/usr/local/lib/storlets/logback-core-1.1.2.jar:'
'/usr/local/lib/storlets/slf4j-api-1.7.7.jar:'
'/usr/local/lib/storlets/json_simple-1.1.jar:'
'/usr/local/lib/storlets/SBusJavaFacade.jar:'
'/usr/local/lib/storlets/SCommon.jar:'
'/usr/local/lib/storlets/SDaemon.jar:'
'/usr/local/lib/storlets/:'
'path/to/storlet/a',
'LD_LIBRARY_PATH':
'/default/ld/library/path:'
'/usr/local/lib/storlets'},
env)
['/default/classpath',
'/usr/local/lib/storlets/java/logback-classic-1.1.2.jar',
'/usr/local/lib/storlets/java/logback-core-1.1.2.jar',
'/usr/local/lib/storlets/java/slf4j-api-1.7.7.jar',
'/usr/local/lib/storlets/java/json_simple-1.1.jar',
'/usr/local/lib/storlets/java/SBusJavaFacade.jar',
'/usr/local/lib/storlets/java/SCommon.jar',
'/usr/local/lib/storlets/java/SDaemon.jar',
'/usr/local/lib/storlets/java/',
'path/to/storlet/a'],
env['CLASSPATH'].split(':'))
self.assertIn('LD_LIBRARY_PATH', env)
self.assertEqual(
['/default/ld/library/path',
'/usr/local/lib/storlets',
'/usr/local/lib/storlets/java'],
env['LD_LIBRARY_PATH'].split(':'))
def test_get_python_args(self):
self._test_get_python_args(DEFAULT_PY2, DEFAULT_PY2)