File 0004-Reproducible-manifest-modification-time.patch of Package xmvn

From 3c2036e15f127c4ab90eb2312af27e13711d5a24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Wed, 18 Sep 2024 18:31:24 +0200
Subject: [PATCH 4/4] Reproducible manifest modification time

---
 .../org/fedoraproject/xmvn/tools/install/JarUtils.java     | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
index 815d19a6..844510b6 100644
--- a/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
+++ b/xmvn-tools/xmvn-install/src/main/java/org/fedoraproject/xmvn/tools/install/JarUtils.java
@@ -249,12 +249,17 @@ public final class JarUtils
         try ( ZipFile jar = new ZipFile( backupPath.toFile() );
                         ZipArchiveOutputStream os = new ZipArchiveOutputStream( targetJar.toFile() ) )
         {
-            try ( InputStream mfIs = jar.getInputStream( jar.getEntry( MANIFEST_PATH ) ) )
+            ZipArchiveEntry jarEntry = jar.getEntry( MANIFEST_PATH );
+            try ( InputStream mfIs = jar.getInputStream( jarEntry ) )
             {
                 Manifest mf = new Manifest( mfIs );
                 updateManifest( artifact, mf );
                 // write manifest
                 ZipArchiveEntry newManifestEntry = new ZipArchiveEntry( MANIFEST_PATH );
+                if ( jarEntry != null )
+                {
+                    newManifestEntry.setTime( jarEntry.getTime() );
+                }
                 os.putArchiveEntry( newManifestEntry );
                 mf.write( os );
                 os.closeArchiveEntry();
-- 
2.46.0

openSUSE Build Service is sponsored by