PragmaTwice commented on code in PR #2845:
URL: https://github.com/apache/kvrocks/pull/2845#discussion_r2048130772


##########
x.py:
##########
@@ -223,6 +223,60 @@ def clang_tidy(dir: str, jobs: Optional[int], 
clang_tidy_path: str, run_clang_ti
     run(run_command, *options, *regexes, verbose=True, cwd=basedir)
 
 
+def is_rocky_linux():
+    try:
+        with open('/etc/os-release') as f:
+            lines = f.readlines()
+        data = {}
+        for line in lines:
+            if '=' in line:
+                key, value = line.strip().split('=', 1)
+                data[key] = value.strip('"')
+
+        is_rocky = data.get('ID') == 'rocky'
+        version_id = data.get('VERSION_ID', '').split('.')[0]
+        version_match = version_id in ('8', '9')
+
+        return is_rocky and version_match
+    except FileNotFoundError:
+        print("File /etc/os-release not found.")
+        return False
+    except Exception as e:
+        print(f"Unexpected error: {e}")
+        return False
+
+
+def get_custom_env():
+    rocksdb = 
Path(__file__).parent.absolute().joinpath('build/_deps/rocksdb-src/include')
+    rocksdb_lib = 
Path(__file__).parent.absolute().joinpath('build/_deps/rocksdb-build')
+    zlib = 
Path(__file__).parent.absolute().joinpath('build/_deps/zstd-src/lib')
+    z4lib = 
Path(__file__).parent.absolute().joinpath('build/_deps/lz4-src/lib')
+    snappy_lib = 
Path(__file__).parent.absolute().joinpath('build/_deps/snappy-build')
+
+    additional_flags = ""
+    libstdc_folder = ""
+    env = os.environ.copy()
+    
+    if is_rocky_linux():
+        output = run_pipe("find", "/opt/rh/gcc-toolset-12/root/", "-name", 
"libstdc++.so*")
+        output = run_pipe("grep", "-v", "32",stdin=output)
+        output = run_pipe("xargs", "dirname", stdin=output)
+        libstdc_folder = output.read().strip() + "/"
+
+    if libstdc_folder != "":
+        additional_flags = f"-L{libstdc_folder} -lstdc++"
+
+    with_cov = env.get("WITH_COVERAGE","false")
+    if with_cov == "true":
+        additional_flags += "-lgcov"

Review Comment:
   Do we need to retrieve coverage info for go test cases? Maybe we can just 
ignore them?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to