This is an automated email from the ASF dual-hosted git repository. rzo1 pushed a commit to branch reduce-distro-size in repository https://gitbox.apache.org/repos/asf/storm.git
commit 3aeac63c8477307d1598917dd1d332c3534a9b69 Author: Richard Zowalla <[email protected]> AuthorDate: Tue Jun 30 20:05:14 2026 +0200 build: add lib-common to the daemon and worker classpaths Prepares de-duplication of the jars shared by the daemon (lib) and worker (lib-worker) classpaths into a single lib-common directory. storm.py now includes lib-common on both classpaths; when the directory is absent (older layouts) it contributes nothing, so the change is backward compatible. --- bin/storm.py | 11 ++++++++--- bin/test_storm.py | 13 +++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bin/storm.py b/bin/storm.py index 81d6e4e4d..eb1afa2f8 100755 --- a/bin/storm.py +++ b/bin/storm.py @@ -107,6 +107,7 @@ def confvalue(name, storm_config_opts, extrapaths, overriding_conf_file=None, da def get_classpath(extrajars, daemon=True, client=False): ret = get_wildcard_dir(STORM_DIR) + ret.extend(get_wildcard_dir(STORM_COMMON_LIB_DIR)) if client: ret.extend(get_wildcard_dir(STORM_WORKER_LIB_DIR)) else: @@ -125,9 +126,9 @@ def get_classpath(extrajars, daemon=True, client=False): def init_storm_env(within_unittest=False): global NORMAL_CLASS_PATH, STORM_DIR, USER_CONF_DIR, STORM_CONF_DIR, STORM_WORKER_LIB_DIR, STORM_LIB_DIR,\ - STORM_TOOLS_LIB_DIR, STORM_WEBAPP_LIB_DIR, STORM_BIN_DIR, STORM_LOG4J2_CONF_DIR, STORM_SUPERVISOR_LOG_FILE,\ - CLUSTER_CONF_DIR, JAR_JVM_OPTS, JAVA_HOME, JAVA_CMD, CONF_FILE, STORM_EXT_CLASSPATH, \ - STORM_EXT_CLASSPATH_DAEMON, LOCAL_TTL_DEFAULT + STORM_COMMON_LIB_DIR, STORM_TOOLS_LIB_DIR, STORM_WEBAPP_LIB_DIR, STORM_BIN_DIR, STORM_LOG4J2_CONF_DIR,\ + STORM_SUPERVISOR_LOG_FILE, CLUSTER_CONF_DIR, JAR_JVM_OPTS, JAVA_HOME, JAVA_CMD, CONF_FILE, \ + STORM_EXT_CLASSPATH, STORM_EXT_CLASSPATH_DAEMON, LOCAL_TTL_DEFAULT NORMAL_CLASS_PATH = cygpath if sys.platform == 'cygwin' else identity STORM_DIR = os.sep.join(os.path.realpath( __file__ ).split(os.sep)[:-2]) @@ -141,6 +142,10 @@ def init_storm_env(within_unittest=False): STORM_WORKER_LIB_DIR = os.path.join(STORM_DIR, "lib-worker") STORM_LIB_DIR = os.path.join(STORM_DIR, "lib") + # Jars shared by the daemon (lib) and worker (lib-worker) classpaths are de-duplicated into + # lib-common to keep the distribution small. It is added to both classpaths; absent in older + # layouts, in which case it contributes nothing. + STORM_COMMON_LIB_DIR = os.path.join(STORM_DIR, "lib-common") STORM_TOOLS_LIB_DIR = os.path.join(STORM_DIR, "lib-tools") STORM_WEBAPP_LIB_DIR = os.path.join(STORM_DIR, "lib-webapp") diff --git a/bin/test_storm.py b/bin/test_storm.py index 11c8057b0..a44669919 100644 --- a/bin/test_storm.py +++ b/bin/test_storm.py @@ -66,6 +66,19 @@ class Test(unittest.TestCase): expected = ":".join(extrajars) self.assertEqual(s[-len(expected):], expected) + def test_get_classpath_includes_lib_common(self): + extrajars = [] + # When lib-common exists, it is included on both the daemon and the client classpaths. + storm.STORM_COMMON_LIB_DIR = storm.STORM_BIN_DIR + expected = os.path.join(storm.STORM_BIN_DIR, "*") + for client in (True, False): + cp = storm.get_classpath(extrajars, daemon=True, client=client) + self.assertIn(expected, cp.split(os.pathsep)) + # When it does not exist, it contributes nothing (backward compatible with older layouts). + storm.STORM_COMMON_LIB_DIR = os.path.join(storm.STORM_DIR, "no-such-lib-common") + cp = storm.get_classpath(extrajars, daemon=True, client=False) + self.assertNotIn(os.path.join(storm.STORM_COMMON_LIB_DIR, "*"), cp.split(os.pathsep)) + def test_resolve_dependencies(self): artifacts = "org.apache.commons.commons-api" artifact_repositories = "maven-central"
