This is an automated email from the ASF dual-hosted git repository.

mpochatkin pushed a commit to branch IGN-29535
in repository https://gitbox.apache.org/repos/asf/ignite-3.git

commit 2529e237c5c0297a715329766262ed02a5319df5
Author: Pochatkin Mikhail <[email protected]>
AuthorDate: Thu Mar 19 17:26:41 2026 +0300

    IGN-29535 Preserve ODBC symlinks in TAR distribution, fix ZIP duplication
    
    Gradle's Tar/Copy tasks resolve symlinks, causing duplicate files in
    the ODBC distribution. Fix by:
    - distZip: exclude symlink files (ZIP format doesn't support symlinks)
    - distTar: replaced with custom odbcDistTar task that stages files
      with 'cp -P' (preserving symlinks) and creates the tar archive
      using the system tar command
---
 packaging/odbc/build.gradle | 49 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/packaging/odbc/build.gradle b/packaging/odbc/build.gradle
index 5f23e1cbf4a..4157d213d2d 100644
--- a/packaging/odbc/build.gradle
+++ b/packaging/odbc/build.gradle
@@ -98,14 +98,61 @@ distZip {
     }
 
     dependsOn replacePackageScriptVars
+
+    // ZIP format does not support symlinks. Exclude symlink files to avoid 
duplicating
+    // the library content. Users should create symlinks manually after 
extraction if needed.
+    eachFile { details ->
+        if (java.nio.file.Files.isSymbolicLink(details.file.toPath())) {
+            details.exclude()
+        }
+    }
 }
 
-distTar {
+// Disable the default distTar task because Gradle's Tar resolves symlinks, 
duplicating files.
+distTar.enabled = false
+
+// Custom tar task that preserves symlinks using the system 'tar' command.
+// Gradle's Tar and Copy tasks always resolve symlinks, so we stage files with 
'cp -P'
+// (which preserves symlinks) and then create the tar archive manually.
+def odbcDistTar = tasks.register('odbcDistTar') {
     onlyIf {
         project.hasProperty('platforms.enable')
     }
 
     dependsOn replacePackageScriptVars
+
+    def archiveName = "ignite3-odbc-${project.version}.tar.gz"
+    def outputFile = file("${buildDir}/distributions/${archiveName}")
+    def stageDir = 
file("${buildDir}/tar-stage/ignite3-odbc-${project.version}")
+
+    outputs.file outputFile
+
+    doLast {
+        delete stageDir
+        stageDir.mkdirs()
+        file("${buildDir}/distributions").mkdirs()
+
+        // Stage ODBC library files preserving symlinks
+        configurations.odbc.files.each { f ->
+            exec {
+                commandLine 'cp', '-P', f.absolutePath, stageDir.absolutePath
+            }
+        }
+
+        // Stage ini file
+        def iniFile = file("${buildDir}/scripts/ignite3-odbc.ini")
+        def tmpDir = new File(stageDir, 'tmp')
+        tmpDir.mkdirs()
+        exec {
+            commandLine 'cp', iniFile.absolutePath, tmpDir.absolutePath
+        }
+
+        // Create tar.gz archive
+        exec {
+            workingDir "${buildDir}/tar-stage"
+            commandLine 'tar', '-czf', outputFile.absolutePath, 
"ignite3-odbc-${project.version}"
+        }
+    }
 }
 
 buildRpm {

Reply via email to